Merge pull request #15398 from spray/http-model-java-latest

Latest version of Java HTTP model
This commit is contained in:
Björn Antonsson 2014-06-16 16:55:12 +02:00
commit d7b4770657
143 changed files with 4380 additions and 431 deletions

View file

@ -0,0 +1,34 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.util.ByteString;
/**
* Represents part of a stream of incoming data for `Transfer-Encoding: chunked` messages.
*/
public abstract class ChunkStreamPart {
/**
* Returns the byte data of this chunk. Will be non-empty for every regular
* chunk. Will be empty for the last chunk.
*/
public abstract ByteString data();
/**
* Returns extensions data for this chunk.
*/
public abstract String extension();
/**
* Returns if this is the last chunk
*/
public abstract boolean isLastChunk();
/**
* If this is the last chunk, this will return an Iterable of the trailer headers. Otherwise,
* it will be empty.
*/
public abstract Iterable<HttpHeader> getTrailerHeaders();
}

View file

@ -0,0 +1,38 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.http.model.ContentRange$;
import akka.japi.Option;
public abstract class ContentRange {
public abstract boolean isByteContentRange();
public abstract boolean isSatisfiable();
public abstract boolean isOther();
public abstract Option<Long> getSatisfiableFirst();
public abstract Option<Long> getSatisfiableLast();
public abstract Option<String> getOtherValue();
public abstract Option<Long> getInstanceLength();
public static ContentRange create(long first, long last) {
return ContentRange$.MODULE$.apply(first, last);
}
public static ContentRange create(long first, long last, long instanceLength) {
return ContentRange$.MODULE$.apply(first, last, instanceLength);
}
@SuppressWarnings("unchecked")
public static ContentRange create(long first, long last, Option<Long> instanceLength) {
return ContentRange$.MODULE$.apply(first, last, ((Option<Object>) (Option) instanceLength).asScala());
}
public static ContentRange createUnsatisfiable(long length) {
return new akka.http.model.ContentRange.Unsatisfiable(length);
}
public static ContentRange createOther(String value) {
return new akka.http.model.ContentRange.Other(value);
}
}

View file

@ -0,0 +1,40 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
/**
* Represents an Http content-type. A content-type consists of a media-type and an optional charset.
*/
public abstract class ContentType {
/**
* Returns the media-type of the this content-type.
*/
public abstract MediaType mediaType();
/**
* Returns if this content-type defines a charset.
*/
public abstract boolean isCharsetDefined();
/**
* Returns the charset of this content-type if there is one or throws an exception
* otherwise.
*/
public abstract HttpCharset getDefinedCharset();
/**
* Creates a content-type from a media-type and a charset.
*/
public static ContentType create(MediaType mediaType, HttpCharset charset) {
return akka.http.model.ContentType.apply((akka.http.model.MediaType) mediaType, (akka.http.model.HttpCharset) charset);
}
/**
* Creates a content-type from a media-type without specifying a charset.
*/
public static ContentType create(MediaType mediaType) {
return akka.http.model.ContentType.apply((akka.http.model.MediaType) mediaType);
}
}

View file

@ -0,0 +1,123 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.japi.Option;
/**
* Immutable, fast and efficient Date + Time implementation without any dependencies.
* Does not support TimeZones, all DateTime values are always GMT based.
* Note that this implementation discards milliseconds (i.e. rounds down to full seconds).
*/
public abstract class DateTime {
/**
* Returns the year of this instant in GMT.
*/
public abstract int year();
/**
* Returns the month of this instant in GMT.
*/
public abstract int month();
/**
* Returns the day of this instant in GMT.
*/
public abstract int day();
/**
* Returns the hour of this instant in GMT.
*/
public abstract int hour();
/**
* Returns the minute of this instant in GMT.
*/
public abstract int minute();
/**
* Returns the second of this instant in GMT.
*/
public abstract int second();
/**
* Returns the weekday of this instant in GMT. Sunday is 0, Monday is 1, etc.
*/
public abstract int weekday();
/**
* Returns this instant as "clicks", i.e. as milliseconds since January 1, 1970, 00:00:00 GMT
*/
public abstract long clicks();
/**
* Returns if this instant interpreted as a Date in GMT belongs to a leap year.
*/
public abstract boolean isLeapYear();
/**
* Returns the day of the week as a 3 letter abbreviation:
* `Sun`, `Mon`, `Tue`, `Wed`, `Thu`, `Fri` or `Sat`
*/
public abstract String weekdayStr();
/**
* Returns the the month as a 3 letter abbreviation:
* `Jan`, `Feb`, `Mar`, `Apr`, `May`, `Jun`, `Jul`, `Aug`, `Sep`, `Oct`, `Nov` or `Dec`
*/
public abstract String monthStr();
/**
* Returns a String representation like this: `yyyy-mm-dd`
*/
public abstract String toIsoDateString();
/**
* Returns a String representation like this: `yyyy-mm-ddThh:mm:ss`
*/
public abstract String toIsoDateTimeString();
/**
* Returns a String representation like this: `yyyy-mm-dd hh:mm:ss`
*/
public abstract String toIsoLikeDateTimeString();
/**
* Returns an RFC1123 date string, e.g. `Sun, 06 Nov 1994 08:49:37 GMT`
*/
public abstract String toRfc1123DateTimeString();
/**
* Returns a new DateTime instance representing the current instant.
*/
public static DateTime now() {
return akka.http.util.DateTime.now();
}
/**
* Returns a new DateTime instance parsed from IsoDateTimeString as Some(dateTime). Returns None if
* parsing has failed.
*/
public static Option<DateTime> fromIsoDateTimeString(String isoDateTimeString) {
return Util.<DateTime, akka.http.util.DateTime>convertOption(akka.http.util.DateTime.fromIsoDateTimeString(isoDateTimeString));
}
/**
* Returns a new DateTime instance representing the instant as defined by "clicks"
* i.e. from the number of milliseconds since the start of "the epoch", namely
* January 1, 1970, 00:00:00 GMT.
* Note that this implementation discards milliseconds (i.e. rounds down to full seconds).
*/
public static DateTime create(long clicks) {
return akka.http.util.DateTime.apply(clicks);
}
/**
* Returns a new DateTime instance by interpreting the given date/time components as an instant in GMT.
*/
public static DateTime create(int year, int month, int day, int hour, int minute, int second) {
return akka.http.util.DateTime.apply(year, month, day, hour, minute, second);
}
}

View file

@ -0,0 +1,59 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.http.model.Uri;
import java.net.InetAddress;
import java.nio.charset.Charset;
/**
* Represents a host in a URI or a Host header. The host can either be empty or be represented
* by an IPv4 or IPv6 address or by a host name.
*/
public abstract class Host {
/**
* Returns a String representation of the address.
*/
public abstract String address();
public abstract boolean isEmpty();
public abstract boolean isIPv4();
public abstract boolean isIPv6();
public abstract boolean isNamedHost();
/**
* Returns an Iterable of InetAddresses represented by this Host. If this Host is empty the
* returned Iterable will be empty. If this is an IP address the Iterable will contain this address.
* If this Host is represented by a host name, the name will be looked up and return all found
* addresses for this name.
*/
public abstract Iterable<InetAddress> getInetAddresses();
/**
* The constant representing an empty Host.
*/
public static final Host EMPTY = akka.http.model.Uri$Host$Empty$.MODULE$;
/**
* Parse the given Host string using the default charset and parsing-mode.
*/
public static Host create(String string) {
return create(string, Uri.Host$.MODULE$.apply$default$2());
}
/**
* Parse the given Host string using the given charset and the default parsing-mode.
*/
public static Host create(String string, Charset charset) {
return Uri.Host$.MODULE$.apply(string, charset, Uri.Host$.MODULE$.apply$default$3());
}
/**
* Parse the given Host string using the given charset and parsing-mode.
*/
public static Host create(String string, Charset charset, Uri.ParsingMode parsingMode) {
return Uri.Host$.MODULE$.apply(string, charset, parsingMode);
}
}

View file

@ -0,0 +1,21 @@
/*
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.actor.ActorSystem;
import akka.http.HttpExt;
public final class Http {
private Http(){}
/** Returns the Http extension for an ActorSystem */
public static HttpExt get(ActorSystem system) {
return (HttpExt) akka.http.Http.get(system);
}
/** Create a Bind message to send to the Http Manager */
public static Object bind(String host, int port) {
return Accessors$.MODULE$.Bind(host, port);
}
}

View file

@ -0,0 +1,40 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
/**
* Represents a charset in Http. See {@link HttpCharsets} for a set of predefined charsets and
* static constructors to create and register custom charsets.
*/
public abstract class HttpCharset {
/**
* Returns the name of this charset.
*/
public abstract String value();
/**
* Creates a range from this charset with qValue = 1.
*/
public HttpCharsetRange toRange() {
return withQValue(1f);
}
/**
* Creates a range from this charset with the given qValue.
*/
public HttpCharsetRange toRange(float qValue) {
return withQValue(qValue);
}
/**
* An alias for toRange(float).
*/
public abstract HttpCharsetRange withQValue(float qValue);
/**
* Returns the predefined (and registered) alias names for this charset.
*/
public abstract Iterable<String> getAliases();
}

View file

@ -0,0 +1,31 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
/**
* Represents an Http charset range. This can either be `*` which matches all charsets or a specific
* charset. {@link HttpCharsetRanges} contains static constructors for HttpCharsetRanges.
*/
public abstract class HttpCharsetRange {
/**
* Returns if this range matches all charsets.
*/
public abstract boolean matchesAll();
/**
* The qValue for this range.
*/
public abstract float qValue();
/**
* Returns if the given charset matches this range.
*/
public abstract boolean matches(HttpCharset charset);
/**
* Returns a copy of this range with the given qValue.
*/
public abstract HttpCharsetRange withQValue(float qValue);
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
/**
* Contains constructors to create a HttpCharsetRange.
*/
public final class HttpCharsetRanges {
private HttpCharsetRanges() {}
/**
* A constant representing the range that matches all charsets.
*/
public static final HttpCharsetRange ALL = akka.http.model.HttpCharsetRange.$times$.MODULE$;
}

View file

@ -0,0 +1,39 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.http.model.HttpCharsets$;
import akka.japi.Option;
/**
* Contains a set of predefined charsets.
*/
public final class HttpCharsets {
private HttpCharsets() {}
public static final HttpCharset US_ASCII = akka.http.model.HttpCharsets.US$minusASCII();
public static final HttpCharset ISO_8859_1 = akka.http.model.HttpCharsets.ISO$minus8859$minus1();
public static final HttpCharset UTF_8 = akka.http.model.HttpCharsets.UTF$minus8();
public static final HttpCharset UTF_16 = akka.http.model.HttpCharsets.UTF$minus16();
public static final HttpCharset UTF_16BE = akka.http.model.HttpCharsets.UTF$minus16BE();
public static final HttpCharset UTF_16LE = akka.http.model.HttpCharsets.UTF$minus16LE();
/**
* Registers a custom charset. Returns Some(newCharset) if the charset is supported by this JVM.
* Returns None otherwise.
*/
public static Option<HttpCharset> registerCustom(String value, String... aliases) {
scala.Option<akka.http.model.HttpCharset> custom = akka.http.model.HttpCharset.custom(value, Util.<String, String>convertArray(aliases));
if (custom.isDefined()) return Option.<HttpCharset>some(akka.http.model.HttpCharsets.register(custom.get()));
else return Option.none();
}
/**
* Returns Some(charset) if the charset with the given name was found and None otherwise.
*/
public static Option<HttpCharset> lookup(String name) {
return Util.<HttpCharset, akka.http.model.HttpCharset>lookupInRegistry(HttpCharsets$.MODULE$, name);
}
}

View file

@ -0,0 +1,110 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.http.model.HttpEntity$;
import akka.stream.FlowMaterializer;
import akka.util.ByteString;
import org.reactivestreams.api.Producer;
import java.io.File;
/**
* Represents the entity of an Http message. An entity consists of the content-type of the data
* and the actual data itself. Some subtypes of HttpEntity also define the content-length of the
* data.
*
* An HttpEntity can be of several kinds:
*
* - HttpEntity.Empty: the statically known empty entity
* - HttpEntityDefault: the default entity which has a known length and which contains
* a stream of ByteStrings.
* - HttpEntityChunked: represents an entity that is delivered using `Transfer-Encoding: chunked`
* - HttpEntityCloseDelimited: the entity which doesn't have a fixed length but which is delimited by
* closing the connection.
*
* All entity subtypes but HttpEntityCloseDelimited are subtypes of {@link HttpEntityRegular} which
* means they can be used in Http request that disallow close-delimited transfer of the entity.
*/
public abstract class HttpEntity {
/**
* Returns the content-type of this entity
*/
public abstract ContentType contentType();
/**
* The empty entity.
*/
public static final HttpEntityStrict EMPTY = HttpEntity$.MODULE$.Empty();
/**
* Returns if this entity is known to be empty. Open-ended entity types like
* HttpEntityChunked and HttpCloseDelimited will always return false here.
*/
public abstract boolean isKnownEmpty();
/**
* Returns if this entity is a subtype of HttpEntityRegular.
*/
public abstract boolean isRegular();
/**
* Returns if this entity is a subtype of HttpEntityChunked.
*/
public abstract boolean isChunked();
/**
* Returns if this entity is a subtype of HttpEntityDefault.
*/
public abstract boolean isDefault();
/**
* Returns if this entity is a subtype of HttpEntityCloseDelimited.
*/
public abstract boolean isCloseDelimited();
/**
* Returns a stream of data bytes this entity consists of.
*/
public abstract Producer<ByteString> getDataBytes(FlowMaterializer materializer);
public static HttpEntityStrict create(String string) {
return HttpEntity$.MODULE$.apply(string);
}
public static HttpEntityStrict create(byte[] bytes) {
return HttpEntity$.MODULE$.apply(bytes);
}
public static HttpEntityStrict create(ByteString bytes) {
return HttpEntity$.MODULE$.apply(bytes);
}
public static HttpEntityStrict create(ContentType contentType, String string) {
return HttpEntity$.MODULE$.apply((akka.http.model.ContentType) contentType, string);
}
public static HttpEntityStrict create(ContentType contentType, byte[] bytes) {
return HttpEntity$.MODULE$.apply((akka.http.model.ContentType) contentType, bytes);
}
public static HttpEntityStrict create(ContentType contentType, ByteString bytes) {
return HttpEntity$.MODULE$.apply((akka.http.model.ContentType) contentType, bytes);
}
public static HttpEntityRegular create(ContentType contentType, File file) {
return (HttpEntityRegular) HttpEntity$.MODULE$.apply((akka.http.model.ContentType) contentType, file);
}
public static HttpEntityDefault create(ContentType contentType, long contentLength, Producer<ByteString> data) {
return new akka.http.model.HttpEntity.Default((akka.http.model.ContentType) contentType, contentLength, data);
}
public static HttpEntityCloseDelimited createCloseDelimited(ContentType contentType, Producer<ByteString> data) {
return new akka.http.model.HttpEntity.CloseDelimited((akka.http.model.ContentType) contentType, data);
}
public static HttpEntityChunked createChunked(ContentType contentType, Producer<ChunkStreamPart> chunks) {
return new akka.http.model.HttpEntity.Chunked(
(akka.http.model.ContentType) contentType,
Util.<ChunkStreamPart, akka.http.model.HttpEntity.ChunkStreamPart>upcastProducer(chunks));
}
public static HttpEntityChunked createChunked(ContentType contentType, Producer<ByteString> data, FlowMaterializer materializer) {
return akka.http.model.HttpEntity.Chunked$.MODULE$.apply(
(akka.http.model.ContentType) contentType,
data, materializer);
}
}

View file

@ -0,0 +1,15 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import org.reactivestreams.api.Producer;
/**
* Represents an entity transferred using `Transfer-Encoding: chunked`. It consists of a
* stream of {@link ChunkStreamPart}.
*/
public abstract class HttpEntityChunked extends HttpEntityRegular {
public abstract Producer<ChunkStreamPart> getChunks();
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.util.ByteString;
import org.reactivestreams.api.Producer;
/**
* Represents an entity without a predetermined content-length. Its length is implicitly
* determined by closing the underlying connection. Therefore, this entity type is only
* available for Http responses.
*/
public abstract class HttpEntityCloseDelimited extends HttpEntity {
public abstract Producer<ByteString> data();
}

View file

@ -0,0 +1,16 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.util.ByteString;
import org.reactivestreams.api.Producer;
/**
* The default entity type which has a predetermined length and a stream of data bytes.
*/
public abstract class HttpEntityDefault extends HttpEntityRegular {
public abstract long contentLength();
public abstract Producer<ByteString> data();
}

View file

@ -0,0 +1,14 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.util.ByteString;
import java.io.File;
/**
* A marker type that denotes HttpEntity subtypes that can be used in Http requests.
*/
public abstract class HttpEntityRegular extends HttpEntity {}

View file

@ -0,0 +1,14 @@
/*
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.util.ByteString;
/**
* The entity type which consists of a predefined fixed ByteString of data.
*/
public abstract class HttpEntityStrict extends HttpEntityRegular {
public abstract ByteString data();
}

View file

@ -0,0 +1,37 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
/**
* The base type representing Http headers. All actual header values will be instances
* of one of the subtypes defined in the `headers` packages. Unknown headers will be subtypes
* of {@link akka.http.model.japi.headers.RawHeader}.
*/
public abstract class HttpHeader {
/**
* Returns the name of the header.
*/
public abstract String name();
/**
* Returns the String representation of the value of the header.
*/
public abstract String value();
/**
* Returns the lower-cased name of the header.
*/
public abstract String lowercaseName();
/**
* Returns true iff nameInLowerCase.equals(lowercaseName()).
*/
public abstract boolean is(String nameInLowerCase);
/**
* Returns !is(nameInLowerCase).
*/
public abstract boolean isNot(String nameInLowerCase);
}

View file

@ -0,0 +1,114 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.japi.Option;
import akka.util.ByteString;
import java.io.File;
/**
* The base type for an Http message (request or response).
*/
public interface HttpMessage {
/**
* Is this instance a request.
*/
boolean isRequest();
/**
* Is this instance a response.
*/
boolean isResponse();
/**
* The protocol of this message.
*/
HttpProtocol protocol();
/**
* An iterable containing the headers of this message.
*/
Iterable<HttpHeader> getHeaders();
/**
* Try to find the first header with the given name (case-insensitive) and return
* Some(header), otherwise this method returns None.
*/
Option<HttpHeader> getHeader(String headerName);
/**
* Try to find the first header of the given class and return
* Some(header), otherwise this method returns None.
*/
<T extends HttpHeader> Option<T> getHeader(Class<T> headerClass);
/**
* The entity of this message.
*/
HttpEntity entity();
public static interface MessageTransformations<Self> {
/**
* Returns a copy of this message with a new protocol.
*/
Self withProtocol(HttpProtocol protocol);
/**
* Returns a copy of this message with the given header added to the list of headers.
*/
Self addHeader(HttpHeader header);
/**
* Returns a copy of this message with the given headers added to the list of headers.
*/
Self addHeaders(Iterable<HttpHeader> headers);
/**
* Returns a copy of this message with all headers of the given name (case-insensitively) removed.
*/
Self removeHeader(String headerName);
/**
* Returns a copy of this message with a new entity.
*/
Self withEntity(HttpEntity entity);
/**
* Returns a copy of this message with a new entity.
*/
Self withEntity(String string);
/**
* Returns a copy of Self message with a new entity.
*/
Self withEntity(byte[] bytes);
/**
* Returns a copy of Self message with a new entity.
*/
Self withEntity(ByteString bytes);
/**
* Returns a copy of Self message with a new entity.
*/
Self withEntity(ContentType type, String string);
/**
* Returns a copy of Self message with a new entity.
*/
Self withEntity(ContentType type, byte[] bytes);
/**
* Returns a copy of Self message with a new entity.
*/
Self withEntity(ContentType type, ByteString bytes);
/**
* Returns a copy of Self message with a new entity.
*/
Self withEntity(ContentType type, File file);
}
}

View file

@ -0,0 +1,33 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
/**
* Represents an HTTP request method. See {@link HttpMethods} for a set of predefined methods
* and static constructors to build and register custom ones.
*/
public abstract class HttpMethod {
/**
* Returns the name of the method.
*/
public abstract String value();
/**
* Returns if this method is "safe" as defined in
* http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-4.2.1
*/
public abstract boolean isSafe();
/**
* Returns if this method is "idempotent" as defined in
* http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-4.2.2
*/
public abstract boolean isIdempotent();
/**
* Returns if requests with this method may contain an entity.
*/
public abstract boolean isEntityAccepted();
}

View file

@ -0,0 +1,36 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.japi.Option;
import akka.http.model.HttpMethods$;
/**
* Contains static constants for predefined method types.
*/
public final class HttpMethods {
private HttpMethods() {}
public static final HttpMethod CONNECT = akka.http.model.HttpMethods.CONNECT();
public static final HttpMethod DELETE = akka.http.model.HttpMethods.DELETE();
public static final HttpMethod GET = akka.http.model.HttpMethods.GET();
public static final HttpMethod HEAD = akka.http.model.HttpMethods.HEAD();
public static final HttpMethod OPTIONS = akka.http.model.HttpMethods.OPTIONS();
public static final HttpMethod PATCH = akka.http.model.HttpMethods.PATCH();
public static final HttpMethod POST = akka.http.model.HttpMethods.POST();
public static final HttpMethod PUT = akka.http.model.HttpMethods.PUT();
public static final HttpMethod TRACE = akka.http.model.HttpMethods.TRACE();
/**
* Register a custom method type.
*/
public static HttpMethod registerCustom(String value, boolean safe, boolean idempotent, boolean entityAccepted) {
return akka.http.model.HttpMethods.register(akka.http.model.HttpMethod.custom(value, safe, idempotent, entityAccepted));
}
public static Option<HttpMethod> lookup(String name) {
return Util.<HttpMethod, akka.http.model.HttpMethod>lookupInRegistry(HttpMethods$.MODULE$, name);
}
}

View file

@ -0,0 +1,16 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
/**
* Represents an Http protocol (currently only HTTP/1.0 or HTTP/1.1). See {@link HttpProtocols}
* for the predefined constants for the supported protocols.
*/
public abstract class HttpProtocol {
/**
* Returns the String representation of this protocol.
*/
public abstract String value();
}

View file

@ -0,0 +1,15 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
/**
* Contains constants of the supported Http protocols.
*/
public final class HttpProtocols {
private HttpProtocols() {}
final HttpProtocol HTTP_1_0 = akka.http.model.HttpProtocols.HTTP$div1$u002E0();
final HttpProtocol HTTP_1_1 = akka.http.model.HttpProtocols.HTTP$div1$u002E1();
}

View file

@ -0,0 +1,47 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
/**
* Represents an Http request.
*/
public abstract class HttpRequest implements HttpMessage, HttpMessage.MessageTransformations<HttpRequest> {
/**
* Returns the Http method of this request.
*/
public abstract HttpMethod method();
/**
* Returns the Uri of this request.
*/
public abstract Uri getUri();
/**
* Returns the entity of this request.
*/
public abstract HttpEntityRegular entity();
/**
* Returns a copy of this instance with a new method.
*/
public abstract HttpRequest withMethod(HttpMethod method);
/**
* Returns a copy of this instance with a new Uri.
*/
public abstract HttpRequest withUri(Uri relativeUri);
/**
* Returns a copy of this instance with a new Uri.
*/
public abstract HttpRequest withUri(String path);
/**
* Returns a default request to be changed using the `withX` methods.
*/
public static HttpRequest create() {
return Accessors$.MODULE$.HttpRequest();
}
}

View file

@ -0,0 +1,32 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
/**
* Represents an Http response.
*/
public abstract class HttpResponse implements HttpMessage, HttpMessage.MessageTransformations<HttpResponse> {
/**
* Returns the status-code of this response.
*/
public abstract StatusCode status();
/**
* Returns a copy of this instance with a new status-code.
*/
public abstract HttpResponse withStatus(StatusCode statusCode);
/**
* Returns a copy of this instance with a new status-code.
*/
public abstract HttpResponse withStatus(int statusCode);
/**
* Returns a default response to be changed using the `withX` methods.
*/
public static HttpResponse create() {
return Accessors$.MODULE$.HttpResponse();
}
}

View file

@ -0,0 +1,30 @@
/*
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import org.reactivestreams.api.Consumer;
import org.reactivestreams.api.Producer;
import java.net.InetSocketAddress;
/**
* Represents one incoming connection.
*/
public interface IncomingConnection {
/**
* The address of the other peer.
*/
InetSocketAddress remoteAddress();
/**
* A stream of requests coming in from the peer.
*/
Producer<HttpRequest> getRequestProducer();
/**
* A consumer of HttpResponses to be sent to the peer.
*/
Consumer<HttpResponse> getResponseConsumer();
}

View file

@ -0,0 +1,39 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import java.util.Map;
/**
* Represents an Http media-range. A media-range either matches a single media-type
* or it matches all media-types of a given main-type. Each range can specify a qValue
* or other parameters.
*/
public abstract class MediaRange {
/**
* Returns the main-type this media-range matches.
*/
public abstract String mainType();
/**
* Returns the qValue of this media-range.
*/
public abstract float qValue();
/**
* Checks if this range matches a given media-type.
*/
public abstract boolean matches(MediaType mediaType);
/**
* Returns a Map of the parameters of this media-range.
*/
public abstract Map<String, String> getParams();
/**
* Returns a copy of this instance with a changed qValue.
*/
public abstract MediaRange withQValue(float qValue);
}

View file

@ -0,0 +1,44 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import java.util.Map;
/**
* Contains a set of predefined media-ranges and static methods to create custom ones.
*/
public final class MediaRanges {
private MediaRanges() {}
public static final MediaRange ALL = akka.http.model.MediaRanges.$times$div$times();
public static final MediaRange ALL_APPLICATION = akka.http.model.MediaRanges.application$div$times();
public static final MediaRange ALL_AUDIO = akka.http.model.MediaRanges.audio$div$times();
public static final MediaRange ALL_IMAGE = akka.http.model.MediaRanges.image$div$times();
public static final MediaRange ALL_MESSAGE = akka.http.model.MediaRanges.message$div$times();
public static final MediaRange ALL_MULTIPART = akka.http.model.MediaRanges.multipart$div$times();
public static final MediaRange ALL_TEXT = akka.http.model.MediaRanges.text$div$times();
public static final MediaRange ALL_VIDEO = akka.http.model.MediaRanges.video$div$times();
/**
* Creates a custom universal media-range for a given main-type.
*/
public static MediaRange create(MediaType mediaType) {
return akka.http.model.MediaRange.apply((akka.http.model.MediaType) mediaType);
}
/**
* Creates a custom universal media-range for a given main-type and a Map of parameters.
*/
public static MediaRange custom(String mainType, Map<String, String> parameters) {
return akka.http.model.MediaRange.custom(mainType, Util.convertMapToScala(parameters), 1.0f);
}
/**
* Creates a custom universal media-range for a given main-type and qValue.
*/
public static MediaRange create(MediaType mediaType, float qValue) {
return akka.http.model.MediaRange.apply((akka.http.model.MediaType) mediaType, qValue);
}
}

View file

@ -0,0 +1,34 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
/**
* Represents an Http media-type. A media-type consists of a main-type and a sub-type.
*/
public abstract class MediaType {
/**
* Returns the main-type of this media-type.
*/
public abstract String mainType();
/**
* Returns the sub-type of this media-type.
*/
public abstract String subType();
/**
* Creates a media-range from this media-type.
*/
public MediaRange toRange() {
return MediaRanges.create(this);
}
/**
* Creates a media-range from this media-type with a given qValue.
*/
public MediaRange toRange(float qValue) {
return MediaRanges.create(this, qValue);
}
}

View file

@ -0,0 +1,200 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.http.model.MediaTypes$;
import akka.japi.Option;
import java.util.Map;
/**
* Contains the set of predefined media-types.
*/
public abstract class MediaTypes {
public static final MediaType APPLICATION_ATOM_XML = akka.http.model.MediaTypes.application$divatom$plusxml();
public static final MediaType APPLICATION_BASE64 = akka.http.model.MediaTypes.application$divbase64();
public static final MediaType APPLICATION_EXCEL = akka.http.model.MediaTypes.application$divexcel();
public static final MediaType APPLICATION_FONT_WOFF = akka.http.model.MediaTypes.application$divfont$minuswoff();
public static final MediaType APPLICATION_GNUTAR = akka.http.model.MediaTypes.application$divgnutar();
public static final MediaType APPLICATION_JAVA_ARCHIVE = akka.http.model.MediaTypes.application$divjava$minusarchive();
public static final MediaType APPLICATION_JAVASCRIPT = akka.http.model.MediaTypes.application$divjavascript();
public static final MediaType APPLICATION_JSON = akka.http.model.MediaTypes.application$divjson();
public static final MediaType APPLICATION_JSON_PATCH_JSON = akka.http.model.MediaTypes.application$divjson$minuspatch$plusjson();
public static final MediaType APPLICATION_LHA = akka.http.model.MediaTypes.application$divlha();
public static final MediaType APPLICATION_LZX = akka.http.model.MediaTypes.application$divlzx();
public static final MediaType APPLICATION_MSPOWERPOINT = akka.http.model.MediaTypes.application$divmspowerpoint();
public static final MediaType APPLICATION_MSWORD = akka.http.model.MediaTypes.application$divmsword();
public static final MediaType APPLICATION_OCTET_STREAM = akka.http.model.MediaTypes.application$divoctet$minusstream();
public static final MediaType APPLICATION_PDF = akka.http.model.MediaTypes.application$divpdf();
public static final MediaType APPLICATION_POSTSCRIPT = akka.http.model.MediaTypes.application$divpostscript();
public static final MediaType APPLICATION_RSS_XML = akka.http.model.MediaTypes.application$divrss$plusxml();
public static final MediaType APPLICATION_SOAP_XML = akka.http.model.MediaTypes.application$divsoap$plusxml();
public static final MediaType APPLICATION_VND_API_JSON = akka.http.model.MediaTypes.application$divvnd$u002Eapi$plusjson();
public static final MediaType APPLICATION_VND_GOOGLE_EARTH_KML_XML = akka.http.model.MediaTypes.application$divvnd$u002Egoogle$minusearth$u002Ekml$plusxml();
public static final MediaType APPLICATION_VND_GOOGLE_EARTH_KMZ = akka.http.model.MediaTypes.application$divvnd$u002Egoogle$minusearth$u002Ekmz();
public static final MediaType APPLICATION_VND_MS_FONTOBJECT = akka.http.model.MediaTypes.application$divvnd$u002Ems$minusfontobject();
public static final MediaType APPLICATION_VND_OASIS_OPENDOCUMENT_CHART = akka.http.model.MediaTypes.application$divvnd$u002Eoasis$u002Eopendocument$u002Echart();
public static final MediaType APPLICATION_VND_OASIS_OPENDOCUMENT_DATABASE = akka.http.model.MediaTypes.application$divvnd$u002Eoasis$u002Eopendocument$u002Edatabase();
public static final MediaType APPLICATION_VND_OASIS_OPENDOCUMENT_FORMULA = akka.http.model.MediaTypes.application$divvnd$u002Eoasis$u002Eopendocument$u002Eformula();
public static final MediaType APPLICATION_VND_OASIS_OPENDOCUMENT_GRAPHICS = akka.http.model.MediaTypes.application$divvnd$u002Eoasis$u002Eopendocument$u002Egraphics();
public static final MediaType APPLICATION_VND_OASIS_OPENDOCUMENT_IMAGE = akka.http.model.MediaTypes.application$divvnd$u002Eoasis$u002Eopendocument$u002Eimage();
public static final MediaType APPLICATION_VND_OASIS_OPENDOCUMENT_PRESENTATION = akka.http.model.MediaTypes.application$divvnd$u002Eoasis$u002Eopendocument$u002Epresentation();
public static final MediaType APPLICATION_VND_OASIS_OPENDOCUMENT_SPREADSHEET = akka.http.model.MediaTypes.application$divvnd$u002Eoasis$u002Eopendocument$u002Espreadsheet();
public static final MediaType APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT = akka.http.model.MediaTypes.application$divvnd$u002Eoasis$u002Eopendocument$u002Etext();
public static final MediaType APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT_MASTER = akka.http.model.MediaTypes.application$divvnd$u002Eoasis$u002Eopendocument$u002Etext$minusmaster();
public static final MediaType APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT_WEB = akka.http.model.MediaTypes.application$divvnd$u002Eoasis$u002Eopendocument$u002Etext$minusweb();
public static final MediaType APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_PRESENTATION = akka.http.model.MediaTypes.application$divvnd$u002Eopenxmlformats$minusofficedocument$u002Epresentationml$u002Epresentation();
public static final MediaType APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_SLIDE = akka.http.model.MediaTypes.application$divvnd$u002Eopenxmlformats$minusofficedocument$u002Epresentationml$u002Eslide();
public static final MediaType APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_SLIDESHOW = akka.http.model.MediaTypes.application$divvnd$u002Eopenxmlformats$minusofficedocument$u002Epresentationml$u002Eslideshow();
public static final MediaType APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_TEMPLATE = akka.http.model.MediaTypes.application$divvnd$u002Eopenxmlformats$minusofficedocument$u002Epresentationml$u002Etemplate();
public static final MediaType APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET = akka.http.model.MediaTypes.application$divvnd$u002Eopenxmlformats$minusofficedocument$u002Espreadsheetml$u002Esheet();
public static final MediaType APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_TEMPLATE = akka.http.model.MediaTypes.application$divvnd$u002Eopenxmlformats$minusofficedocument$u002Espreadsheetml$u002Etemplate();
public static final MediaType APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT = akka.http.model.MediaTypes.application$divvnd$u002Eopenxmlformats$minusofficedocument$u002Ewordprocessingml$u002Edocument();
public static final MediaType APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_TEMPLATE = akka.http.model.MediaTypes.application$divvnd$u002Eopenxmlformats$minusofficedocument$u002Ewordprocessingml$u002Etemplate();
public static final MediaType APPLICATION_X_7Z_COMPRESSED = akka.http.model.MediaTypes.application$divx$minus7z$minuscompressed();
public static final MediaType APPLICATION_X_ACE_COMPRESSED = akka.http.model.MediaTypes.application$divx$minusace$minuscompressed();
public static final MediaType APPLICATION_X_APPLE_DISKIMAGE = akka.http.model.MediaTypes.application$divx$minusapple$minusdiskimage();
public static final MediaType APPLICATION_X_ARC_COMPRESSED = akka.http.model.MediaTypes.application$divx$minusarc$minuscompressed();
public static final MediaType APPLICATION_X_BZIP = akka.http.model.MediaTypes.application$divx$minusbzip();
public static final MediaType APPLICATION_X_BZIP2 = akka.http.model.MediaTypes.application$divx$minusbzip2();
public static final MediaType APPLICATION_X_CHROME_EXTENSION = akka.http.model.MediaTypes.application$divx$minuschrome$minusextension();
public static final MediaType APPLICATION_X_COMPRESS = akka.http.model.MediaTypes.application$divx$minuscompress();
public static final MediaType APPLICATION_X_COMPRESSED = akka.http.model.MediaTypes.application$divx$minuscompressed();
public static final MediaType APPLICATION_X_DEBIAN_PACKAGE = akka.http.model.MediaTypes.application$divx$minusdebian$minuspackage();
public static final MediaType APPLICATION_X_DVI = akka.http.model.MediaTypes.application$divx$minusdvi();
public static final MediaType APPLICATION_X_FONT_TRUETYPE = akka.http.model.MediaTypes.application$divx$minusfont$minustruetype();
public static final MediaType APPLICATION_X_FONT_OPENTYPE = akka.http.model.MediaTypes.application$divx$minusfont$minusopentype();
public static final MediaType APPLICATION_X_GTAR = akka.http.model.MediaTypes.application$divx$minusgtar();
public static final MediaType APPLICATION_X_GZIP = akka.http.model.MediaTypes.application$divx$minusgzip();
public static final MediaType APPLICATION_X_LATEX = akka.http.model.MediaTypes.application$divx$minuslatex();
public static final MediaType APPLICATION_X_RAR_COMPRESSED = akka.http.model.MediaTypes.application$divx$minusrar$minuscompressed();
public static final MediaType APPLICATION_X_REDHAT_PACKAGE_MANAGER = akka.http.model.MediaTypes.application$divx$minusredhat$minuspackage$minusmanager();
public static final MediaType APPLICATION_X_SHOCKWAVE_FLASH = akka.http.model.MediaTypes.application$divx$minusshockwave$minusflash();
public static final MediaType APPLICATION_X_TAR = akka.http.model.MediaTypes.application$divx$minustar();
public static final MediaType APPLICATION_X_TEX = akka.http.model.MediaTypes.application$divx$minustex();
public static final MediaType APPLICATION_X_TEXINFO = akka.http.model.MediaTypes.application$divx$minustexinfo();
public static final MediaType APPLICATION_X_VRML = akka.http.model.MediaTypes.application$divx$minusvrml();
public static final MediaType APPLICATION_X_WWW_FORM_URLENCODED = akka.http.model.MediaTypes.application$divx$minuswww$minusform$minusurlencoded();
public static final MediaType APPLICATION_X_X509_CA_CERT = akka.http.model.MediaTypes.application$divx$minusx509$minusca$minuscert();
public static final MediaType APPLICATION_X_XPINSTALL = akka.http.model.MediaTypes.application$divx$minusxpinstall();
public static final MediaType APPLICATION_XHTML_XML = akka.http.model.MediaTypes.application$divxhtml$plusxml();
public static final MediaType APPLICATION_XML_DTD = akka.http.model.MediaTypes.application$divxml$minusdtd();
public static final MediaType APPLICATION_XML = akka.http.model.MediaTypes.application$divxml();
public static final MediaType APPLICATION_ZIP = akka.http.model.MediaTypes.application$divzip();
public static final MediaType AUDIO_AIFF = akka.http.model.MediaTypes.audio$divaiff();
public static final MediaType AUDIO_BASIC = akka.http.model.MediaTypes.audio$divbasic();
public static final MediaType AUDIO_MIDI = akka.http.model.MediaTypes.audio$divmidi();
public static final MediaType AUDIO_MOD = akka.http.model.MediaTypes.audio$divmod();
public static final MediaType AUDIO_MPEG = akka.http.model.MediaTypes.audio$divmpeg();
public static final MediaType AUDIO_OGG = akka.http.model.MediaTypes.audio$divogg();
public static final MediaType AUDIO_VOC = akka.http.model.MediaTypes.audio$divvoc();
public static final MediaType AUDIO_VORBIS = akka.http.model.MediaTypes.audio$divvorbis();
public static final MediaType AUDIO_VOXWARE = akka.http.model.MediaTypes.audio$divvoxware();
public static final MediaType AUDIO_WAV = akka.http.model.MediaTypes.audio$divwav();
public static final MediaType AUDIO_X_REALAUDIO = akka.http.model.MediaTypes.audio$divx$minusrealaudio();
public static final MediaType AUDIO_X_PSID = akka.http.model.MediaTypes.audio$divx$minuspsid();
public static final MediaType AUDIO_XM = akka.http.model.MediaTypes.audio$divxm();
public static final MediaType AUDIO_WEBM = akka.http.model.MediaTypes.audio$divwebm();
public static final MediaType IMAGE_GIF = akka.http.model.MediaTypes.image$divgif();
public static final MediaType IMAGE_JPEG = akka.http.model.MediaTypes.image$divjpeg();
public static final MediaType IMAGE_PICT = akka.http.model.MediaTypes.image$divpict();
public static final MediaType IMAGE_PNG = akka.http.model.MediaTypes.image$divpng();
public static final MediaType IMAGE_SVG_XML = akka.http.model.MediaTypes.image$divsvg$plusxml();
public static final MediaType IMAGE_TIFF = akka.http.model.MediaTypes.image$divtiff();
public static final MediaType IMAGE_X_ICON = akka.http.model.MediaTypes.image$divx$minusicon();
public static final MediaType IMAGE_X_MS_BMP = akka.http.model.MediaTypes.image$divx$minusms$minusbmp();
public static final MediaType IMAGE_X_PCX = akka.http.model.MediaTypes.image$divx$minuspcx();
public static final MediaType IMAGE_X_PICT = akka.http.model.MediaTypes.image$divx$minuspict();
public static final MediaType IMAGE_X_QUICKTIME = akka.http.model.MediaTypes.image$divx$minusquicktime();
public static final MediaType IMAGE_X_RGB = akka.http.model.MediaTypes.image$divx$minusrgb();
public static final MediaType IMAGE_X_XBITMAP = akka.http.model.MediaTypes.image$divx$minusxbitmap();
public static final MediaType IMAGE_X_XPIXMAP = akka.http.model.MediaTypes.image$divx$minusxpixmap();
public static final MediaType IMAGE_WEBP = akka.http.model.MediaTypes.image$divwebp();
public static final MediaType MESSAGE_HTTP = akka.http.model.MediaTypes.message$divhttp();
public static final MediaType MESSAGE_DELIVERY_STATUS = akka.http.model.MediaTypes.message$divdelivery$minusstatus();
public static final MediaType MESSAGE_RFC822 = akka.http.model.MediaTypes.message$divrfc822();
public static final MediaType MULTIPART_MIXED = akka.http.model.MediaTypes.multipart$divmixed();
public static final MediaType MULTIPART_ALTERNATIVE = akka.http.model.MediaTypes.multipart$divalternative();
public static final MediaType MULTIPART_RELATED = akka.http.model.MediaTypes.multipart$divrelated();
public static final MediaType MULTIPART_FORM_DATA = akka.http.model.MediaTypes.multipart$divform$minusdata();
public static final MediaType MULTIPART_SIGNED = akka.http.model.MediaTypes.multipart$divsigned();
public static final MediaType MULTIPART_ENCRYPTED = akka.http.model.MediaTypes.multipart$divencrypted();
public static final MediaType MULTIPART_BYTERANGES = akka.http.model.MediaTypes.multipart$divbyteranges();
public static final MediaType TEXT_ASP = akka.http.model.MediaTypes.text$divasp();
public static final MediaType TEXT_CACHE_MANIFEST = akka.http.model.MediaTypes.text$divcache$minusmanifest();
public static final MediaType TEXT_CALENDAR = akka.http.model.MediaTypes.text$divcalendar();
public static final MediaType TEXT_CSS = akka.http.model.MediaTypes.text$divcss();
public static final MediaType TEXT_CSV = akka.http.model.MediaTypes.text$divcsv();
public static final MediaType TEXT_HTML = akka.http.model.MediaTypes.text$divhtml();
public static final MediaType TEXT_MCF = akka.http.model.MediaTypes.text$divmcf();
public static final MediaType TEXT_PLAIN = akka.http.model.MediaTypes.text$divplain();
public static final MediaType TEXT_RICHTEXT = akka.http.model.MediaTypes.text$divrichtext();
public static final MediaType TEXT_TAB_SEPARATED_VALUES = akka.http.model.MediaTypes.text$divtab$minusseparated$minusvalues();
public static final MediaType TEXT_URI_LIST = akka.http.model.MediaTypes.text$divuri$minuslist();
public static final MediaType TEXT_VND_WAP_WML = akka.http.model.MediaTypes.text$divvnd$u002Ewap$u002Ewml();
public static final MediaType TEXT_VND_WAP_WMLSCRIPT = akka.http.model.MediaTypes.text$divvnd$u002Ewap$u002Ewmlscript();
public static final MediaType TEXT_X_ASM = akka.http.model.MediaTypes.text$divx$minusasm();
public static final MediaType TEXT_X_C = akka.http.model.MediaTypes.text$divx$minusc();
public static final MediaType TEXT_X_COMPONENT = akka.http.model.MediaTypes.text$divx$minuscomponent();
public static final MediaType TEXT_X_H = akka.http.model.MediaTypes.text$divx$minush();
public static final MediaType TEXT_X_JAVA_SOURCE = akka.http.model.MediaTypes.text$divx$minusjava$minussource();
public static final MediaType TEXT_X_PASCAL = akka.http.model.MediaTypes.text$divx$minuspascal();
public static final MediaType TEXT_X_SCRIPT = akka.http.model.MediaTypes.text$divx$minusscript();
public static final MediaType TEXT_X_SCRIPTCSH = akka.http.model.MediaTypes.text$divx$minusscriptcsh();
public static final MediaType TEXT_X_SCRIPTELISP = akka.http.model.MediaTypes.text$divx$minusscriptelisp();
public static final MediaType TEXT_X_SCRIPTKSH = akka.http.model.MediaTypes.text$divx$minusscriptksh();
public static final MediaType TEXT_X_SCRIPTLISP = akka.http.model.MediaTypes.text$divx$minusscriptlisp();
public static final MediaType TEXT_X_SCRIPTPERL = akka.http.model.MediaTypes.text$divx$minusscriptperl();
public static final MediaType TEXT_X_SCRIPTPERL_MODULE = akka.http.model.MediaTypes.text$divx$minusscriptperl$minusmodule();
public static final MediaType TEXT_X_SCRIPTPHYTON = akka.http.model.MediaTypes.text$divx$minusscriptphyton();
public static final MediaType TEXT_X_SCRIPTREXX = akka.http.model.MediaTypes.text$divx$minusscriptrexx();
public static final MediaType TEXT_X_SCRIPTSCHEME = akka.http.model.MediaTypes.text$divx$minusscriptscheme();
public static final MediaType TEXT_X_SCRIPTSH = akka.http.model.MediaTypes.text$divx$minusscriptsh();
public static final MediaType TEXT_X_SCRIPTTCL = akka.http.model.MediaTypes.text$divx$minusscripttcl();
public static final MediaType TEXT_X_SCRIPTTCSH = akka.http.model.MediaTypes.text$divx$minusscripttcsh();
public static final MediaType TEXT_X_SCRIPTZSH = akka.http.model.MediaTypes.text$divx$minusscriptzsh();
public static final MediaType TEXT_X_SERVER_PARSED_HTML = akka.http.model.MediaTypes.text$divx$minusserver$minusparsed$minushtml();
public static final MediaType TEXT_X_SETEXT = akka.http.model.MediaTypes.text$divx$minussetext();
public static final MediaType TEXT_X_SGML = akka.http.model.MediaTypes.text$divx$minussgml();
public static final MediaType TEXT_X_SPEECH = akka.http.model.MediaTypes.text$divx$minusspeech();
public static final MediaType TEXT_X_UUENCODE = akka.http.model.MediaTypes.text$divx$minusuuencode();
public static final MediaType TEXT_X_VCALENDAR = akka.http.model.MediaTypes.text$divx$minusvcalendar();
public static final MediaType TEXT_X_VCARD = akka.http.model.MediaTypes.text$divx$minusvcard();
public static final MediaType TEXT_XML = akka.http.model.MediaTypes.text$divxml();
public static final MediaType VIDEO_AVS_VIDEO = akka.http.model.MediaTypes.video$divavs$minusvideo();
public static final MediaType VIDEO_DIVX = akka.http.model.MediaTypes.video$divdivx();
public static final MediaType VIDEO_GL = akka.http.model.MediaTypes.video$divgl();
public static final MediaType VIDEO_MP4 = akka.http.model.MediaTypes.video$divmp4();
public static final MediaType VIDEO_MPEG = akka.http.model.MediaTypes.video$divmpeg();
public static final MediaType VIDEO_OGG = akka.http.model.MediaTypes.video$divogg();
public static final MediaType VIDEO_QUICKTIME = akka.http.model.MediaTypes.video$divquicktime();
public static final MediaType VIDEO_X_DV = akka.http.model.MediaTypes.video$divx$minusdv();
public static final MediaType VIDEO_X_FLV = akka.http.model.MediaTypes.video$divx$minusflv();
public static final MediaType VIDEO_X_MOTION_JPEG = akka.http.model.MediaTypes.video$divx$minusmotion$minusjpeg();
public static final MediaType VIDEO_X_MS_ASF = akka.http.model.MediaTypes.video$divx$minusms$minusasf();
public static final MediaType VIDEO_X_MSVIDEO = akka.http.model.MediaTypes.video$divx$minusmsvideo();
public static final MediaType VIDEO_X_SGI_MOVIE = akka.http.model.MediaTypes.video$divx$minussgi$minusmovie();
public static final MediaType VIDEO_WEBM = akka.http.model.MediaTypes.video$divwebm();
/**
* Register a custom media type.
*/
public static MediaType registerCustom(
String mainType,
String subType,
boolean compressible,
boolean binary,
Iterable<String> fileExtensions,
Map<String, String> params) {
return akka.http.model.MediaTypes.register(akka.http.model.MediaType.custom(mainType, subType, compressible, binary, Util.<String, String>convertIterable(fileExtensions), Util.convertMapToScala(params), false));
}
/**
* Looks up a media-type with the given main-type and sub-type.
*/
public static Option<MediaType> lookup(String mainType, String subType) {
return Util.<scala.Tuple2<String, String>, MediaType, akka.http.model.MediaType>lookupInRegistry(MediaTypes$.MODULE$, new scala.Tuple2<String, String>(mainType, subType));
}
}

View file

@ -0,0 +1,26 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.japi.Option;
import java.net.InetAddress;
public abstract class RemoteAddress {
public abstract boolean isUnknown();
public abstract Option<InetAddress> getAddress();
public static final RemoteAddress UNKNOWN = akka.http.model.RemoteAddress.Unknown$.MODULE$;
public static RemoteAddress create(InetAddress address) {
return akka.http.model.RemoteAddress.apply(address);
}
public static RemoteAddress create(String address) {
return akka.http.model.RemoteAddress.apply(address);
}
public static RemoteAddress create(byte[] address) {
return akka.http.model.RemoteAddress.apply(address);
}
}

View file

@ -0,0 +1,27 @@
/*
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import org.reactivestreams.api.Producer;
import java.net.InetSocketAddress;
/**
* The binding of a server. Allows access to its own address and to the stream
* of incoming connections.
*/
public interface ServerBinding {
/**
* The local address this server is listening on.
*/
InetSocketAddress localAddress();
/**
* The stream of incoming connections. The binding is solved and the listening
* socket closed as soon as all consumer of this streams have cancelled their
* subscription.
*/
Producer<IncomingConnection> getConnectionStream();
}

View file

@ -0,0 +1,43 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
/**
* Represents an Http status-code and message. See {@link StatusCodes} for the set of predefined
* status-codes.
*/
public abstract class StatusCode {
/**
* Returns the numeric code of this status code.
*/
public abstract int intValue();
/**
* Returns the reason message for this status code.
*/
public abstract String reason();
/**
* Returns the default message to be included as the content of an Http response
* with this status-code.
*/
public abstract String defaultMessage();
/**
* Returns if the status-code represents success.
*/
public abstract boolean isSuccess();
/**
* Returns if the status-code represents failure.
*/
public abstract boolean isFailure();
/**
* Returns if a response with this status-code is allowed to be accompanied with
* a non-empty entity.
*/
public abstract boolean allowsEntity();
}

View file

@ -0,0 +1,114 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.http.model.StatusCodes$;
import akka.japi.Option;
/**
* Contains the set of predefined status-codes along with static methods to access and create custom
* status-codes.
*/
public final class StatusCodes {
private StatusCodes() {}
public static final StatusCode CONTINUE = akka.http.model.StatusCodes.Continue();
public static final StatusCode SWITCHING_PROTOCOLS = akka.http.model.StatusCodes.SwitchingProtocols();
public static final StatusCode PROCESSING = akka.http.model.StatusCodes.Processing();
public static final StatusCode OK = akka.http.model.StatusCodes.OK();
public static final StatusCode CREATED = akka.http.model.StatusCodes.Created();
public static final StatusCode ACCEPTED = akka.http.model.StatusCodes.Accepted();
public static final StatusCode NON_AUTHORITATIVE_INFORMATION = akka.http.model.StatusCodes.NonAuthoritativeInformation();
public static final StatusCode NO_CONTENT = akka.http.model.StatusCodes.NoContent();
public static final StatusCode RESET_CONTENT = akka.http.model.StatusCodes.ResetContent();
public static final StatusCode PARTIAL_CONTENT = akka.http.model.StatusCodes.PartialContent();
public static final StatusCode MULTI_STATUS = akka.http.model.StatusCodes.MultiStatus();
public static final StatusCode ALREADY_REPORTED = akka.http.model.StatusCodes.AlreadyReported();
public static final StatusCode IMUSED = akka.http.model.StatusCodes.IMUsed();
public static final StatusCode MULTIPLE_CHOICES = akka.http.model.StatusCodes.MultipleChoices();
public static final StatusCode MOVED_PERMANENTLY = akka.http.model.StatusCodes.MovedPermanently();
public static final StatusCode FOUND = akka.http.model.StatusCodes.Found();
public static final StatusCode SEE_OTHER = akka.http.model.StatusCodes.SeeOther();
public static final StatusCode NOT_MODIFIED = akka.http.model.StatusCodes.NotModified();
public static final StatusCode USE_PROXY = akka.http.model.StatusCodes.UseProxy();
public static final StatusCode TEMPORARY_REDIRECT = akka.http.model.StatusCodes.TemporaryRedirect();
public static final StatusCode PERMANENT_REDIRECT = akka.http.model.StatusCodes.PermanentRedirect();
public static final StatusCode BAD_REQUEST = akka.http.model.StatusCodes.BadRequest();
public static final StatusCode UNAUTHORIZED = akka.http.model.StatusCodes.Unauthorized();
public static final StatusCode PAYMENT_REQUIRED = akka.http.model.StatusCodes.PaymentRequired();
public static final StatusCode FORBIDDEN = akka.http.model.StatusCodes.Forbidden();
public static final StatusCode NOT_FOUND = akka.http.model.StatusCodes.NotFound();
public static final StatusCode METHOD_NOT_ALLOWED = akka.http.model.StatusCodes.MethodNotAllowed();
public static final StatusCode NOT_ACCEPTABLE = akka.http.model.StatusCodes.NotAcceptable();
public static final StatusCode PROXY_AUTHENTICATION_REQUIRED = akka.http.model.StatusCodes.ProxyAuthenticationRequired();
public static final StatusCode REQUEST_TIMEOUT = akka.http.model.StatusCodes.RequestTimeout();
public static final StatusCode CONFLICT = akka.http.model.StatusCodes.Conflict();
public static final StatusCode GONE = akka.http.model.StatusCodes.Gone();
public static final StatusCode LENGTH_REQUIRED = akka.http.model.StatusCodes.LengthRequired();
public static final StatusCode PRECONDITION_FAILED = akka.http.model.StatusCodes.PreconditionFailed();
public static final StatusCode REQUEST_ENTITY_TOO_LARGE = akka.http.model.StatusCodes.RequestEntityTooLarge();
public static final StatusCode REQUEST_URI_TOO_LONG = akka.http.model.StatusCodes.RequestUriTooLong();
public static final StatusCode UNSUPPORTED_MEDIA_TYPE = akka.http.model.StatusCodes.UnsupportedMediaType();
public static final StatusCode REQUESTED_RANGE_NOT_SATISFIABLE = akka.http.model.StatusCodes.RequestedRangeNotSatisfiable();
public static final StatusCode EXPECTATION_FAILED = akka.http.model.StatusCodes.ExpectationFailed();
public static final StatusCode ENHANCE_YOUR_CALM = akka.http.model.StatusCodes.EnhanceYourCalm();
public static final StatusCode UNPROCESSABLE_ENTITY = akka.http.model.StatusCodes.UnprocessableEntity();
public static final StatusCode LOCKED = akka.http.model.StatusCodes.Locked();
public static final StatusCode FAILED_DEPENDENCY = akka.http.model.StatusCodes.FailedDependency();
public static final StatusCode UNORDERED_COLLECTION = akka.http.model.StatusCodes.UnorderedCollection();
public static final StatusCode UPGRADE_REQUIRED = akka.http.model.StatusCodes.UpgradeRequired();
public static final StatusCode PRECONDITION_REQUIRED = akka.http.model.StatusCodes.PreconditionRequired();
public static final StatusCode TOO_MANY_REQUESTS = akka.http.model.StatusCodes.TooManyRequests();
public static final StatusCode REQUEST_HEADER_FIELDS_TOO_LARGE = akka.http.model.StatusCodes.RequestHeaderFieldsTooLarge();
public static final StatusCode RETRY_WITH = akka.http.model.StatusCodes.RetryWith();
public static final StatusCode BLOCKED_BY_PARENTAL_CONTROLS = akka.http.model.StatusCodes.BlockedByParentalControls();
public static final StatusCode UNAVAILABLE_FOR_LEGAL_REASONS = akka.http.model.StatusCodes.UnavailableForLegalReasons();
public static final StatusCode INTERNAL_SERVER_ERROR = akka.http.model.StatusCodes.InternalServerError();
public static final StatusCode NOT_IMPLEMENTED = akka.http.model.StatusCodes.NotImplemented();
public static final StatusCode BAD_GATEWAY = akka.http.model.StatusCodes.BadGateway();
public static final StatusCode SERVICE_UNAVAILABLE = akka.http.model.StatusCodes.ServiceUnavailable();
public static final StatusCode GATEWAY_TIMEOUT = akka.http.model.StatusCodes.GatewayTimeout();
public static final StatusCode HTTPVERSION_NOT_SUPPORTED = akka.http.model.StatusCodes.HTTPVersionNotSupported();
public static final StatusCode VARIANT_ALSO_NEGOTIATES = akka.http.model.StatusCodes.VariantAlsoNegotiates();
public static final StatusCode INSUFFICIENT_STORAGE = akka.http.model.StatusCodes.InsufficientStorage();
public static final StatusCode LOOP_DETECTED = akka.http.model.StatusCodes.LoopDetected();
public static final StatusCode BANDWIDTH_LIMIT_EXCEEDED = akka.http.model.StatusCodes.BandwidthLimitExceeded();
public static final StatusCode NOT_EXTENDED = akka.http.model.StatusCodes.NotExtended();
public static final StatusCode NETWORK_AUTHENTICATION_REQUIRED = akka.http.model.StatusCodes.NetworkAuthenticationRequired();
public static final StatusCode NETWORK_READ_TIMEOUT = akka.http.model.StatusCodes.NetworkReadTimeout();
public static final StatusCode NETWORK_CONNECT_TIMEOUT = akka.http.model.StatusCodes.NetworkConnectTimeout();
/**
* Registers a custom status code.
*/
public static StatusCode registerCustom(int intValue, String reason, String defaultMessage, boolean isSuccess, boolean allowsEntity) {
return akka.http.model.StatusCodes.registerCustom(intValue, reason, defaultMessage, isSuccess, allowsEntity);
}
/**
* Registers a custom status code.
*/
public static StatusCode registerCustom(int intValue, String reason, String defaultMessage) {
return akka.http.model.StatusCodes.registerCustom(intValue, reason, defaultMessage);
}
/**
* Looks up a status-code by numeric code. Throws an exception if no such status-code is found.
*/
public static StatusCode get(int intValue) {
return akka.http.model.StatusCode.int2StatusCode(intValue);
}
/**
* Looks up a status-code by numeric code and returns Some(code). Returns None otherwise.
*/
public static Option<StatusCode> lookup(int intValue) {
return Util.<StatusCode, akka.http.model.StatusCode>lookupInRegistry(StatusCodes$.MODULE$, intValue);
}
}

View file

@ -0,0 +1,20 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import java.util.Map;
public abstract class TransferEncoding {
public abstract String name();
public abstract Map<String, String> getParams();
public static TransferEncoding createExtension(String name) {
return new akka.http.model.TransferEncodings.Extension(name, Util.emptyMap);
}
public static TransferEncoding createExtension(String name, Map<String, String> params) {
return new akka.http.model.TransferEncodings.Extension(name, Util.convertMapToScala(params));
}
}

View file

@ -0,0 +1,14 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
public final class TransferEncodings {
private TransferEncodings() {}
public static final TransferEncoding CHUNKED = akka.http.model.TransferEncodings.chunked$.MODULE$;
public static final TransferEncoding COMPRESS = akka.http.model.TransferEncodings.compress$.MODULE$;
public static final TransferEncoding DEFLATE = akka.http.model.TransferEncodings.deflate$.MODULE$;
public static final TransferEncoding GZIP = akka.http.model.TransferEncodings.gzip$.MODULE$;
}

View file

@ -0,0 +1,191 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.japi.Option;
import akka.parboiled2.ParserInput$;
import java.nio.charset.Charset;
import java.util.Map;
/**
* Represents a Uri. Use the `withX` methods to create modified copies of a given instance.
*/
public abstract class Uri {
/**
* Returns if this is an absolute Uri.
*/
public abstract boolean isAbsolute();
/**
* Returns if this is a relative Uri.
*/
public abstract boolean isRelative();
/**
* Returns if this is an empty Uri.
*/
public abstract boolean isEmpty();
/**
* Returns the scheme of this Uri.
*/
public abstract String scheme();
/**
* Returns the Host of this Uri.
*/
public abstract Host host();
/**
* Returns the port of this Uri.
*/
public abstract int port();
/**
* Returns the user-info of this Uri.
*/
public abstract String userInfo();
/**
* Returns a String representation of the path of this Uri.
*/
public abstract String path();
/**
* Returns the the path segments of this Uri as an Iterable.
*/
public abstract Iterable<String> pathSegments();
/**
* Returns a String representation of the query of this Uri.
*/
public abstract String queryString();
/**
* Looks up a query parameter of this Uri.
*/
public abstract Option<String> parameter(String key);
/**
* Returns if the query of this Uri contains a parameter with the given key.
*/
public abstract boolean containsParameter(String key);
/**
* Returns an Iterable of all query parameters of this Uri.
*/
public abstract Iterable<Parameter> parameters();
/**
* Returns a key/value map of the query parameters of this Uri. Use
* the `parameters()` method to returns all parameters if keys may occur
* multiple times.
*/
public abstract Map<String, String> parameterMap();
public static interface Parameter {
String key();
String value();
}
/**
* Returns the fragment part of this Uri.
*/
public abstract Option<String> fragment();
/**
* Returns a copy of this instance with a new scheme.
*/
public abstract Uri scheme(String scheme);
/**
* Returns a copy of this instance with a new Host.
*/
public abstract Uri host(Host host);
/**
* Returns a copy of this instance with a new host.
*/
public abstract Uri host(String host);
/**
* Returns a copy of this instance with a new port.
*/
public abstract Uri port(int port);
/**
* Returns a copy of this instance with new user-info.
*/
public abstract Uri userInfo(String userInfo);
/**
* Returns a copy of this instance with a new path.
*/
public abstract Uri path(String path);
/**
* Returns a copy of this instance with a path segment added at the end.
*/
public abstract Uri addPathSegment(String segment);
/**
* Returns a copy of this instance with a new query.
*/
public abstract Uri query(String query);
/**
* Returns a copy of this instance that is relative.
*/
public abstract Uri toRelative();
/**
* Returns a copy of this instance with a query parameter added.
*/
public abstract Uri addParameter(String key, String value);
/**
* Returns a copy of this instance with a new fragment.
*/
public abstract Uri fragment(String fragment);
/**
* Returns a copy of this instance with a new optional fragment.
*/
public abstract Uri fragment(Option<String> fragment);
public static final akka.http.model.Uri.ParsingMode STRICT = akka.http.model.Uri$ParsingMode$Strict$.MODULE$;
public static final akka.http.model.Uri.ParsingMode RELAXED = akka.http.model.Uri$ParsingMode$Relaxed$.MODULE$;
public static final akka.http.model.Uri.ParsingMode RELAXED_WITH_RAW_QUERY = akka.http.model.Uri$ParsingMode$RelaxedWithRawQuery$.MODULE$;
/**
* Creates a default Uri to be modified using the modification methods.
*/
public static Uri create() {
return Accessors$.MODULE$.Uri(akka.http.model.Uri.Empty$.MODULE$);
}
/**
* Returns a Uri created by parsing the given string representation.
*/
public static Uri create(String uri) {
return Accessors$.MODULE$.Uri(akka.http.model.Uri.apply(uri));
}
/**
* Returns a Uri created by parsing the given string representation and parsing-mode.
*/
public static Uri create(String uri, akka.http.model.Uri.ParsingMode parsingMode) {
return Accessors$.MODULE$.Uri(akka.http.model.Uri.apply(ParserInput$.MODULE$.apply(uri), parsingMode));
}
/**
* Returns a Uri created by parsing the given string representation, charset, and parsing-mode.
*/
public static Uri create(String uri, Charset charset, akka.http.model.Uri.ParsingMode parsingMode) {
return Accessors$.MODULE$.Uri(akka.http.model.Uri.apply(ParserInput$.MODULE$.apply(uri), charset, parsingMode));
}
}

View file

@ -0,0 +1,86 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi;
import akka.http.model.*;
import akka.http.util.ObjectRegistry;
import akka.japi.Option;
import org.reactivestreams.api.Producer;
import scala.None;
import scala.None$;
import scala.NotImplementedError;
import scala.collection.immutable.Map$;
import scala.collection.immutable.Seq;
import java.util.Arrays;
import java.util.Map;
/**
* Contains internal helper methods.
*/
public abstract class Util {
@SuppressWarnings("unchecked") // no support for covariance of option in Java
public static <U, T extends U> Option<U> convertOption(scala.Option<T> o) {
return (Option<U>)(Option) akka.japi.Option.fromScalaOption(o);
}
@SuppressWarnings("unchecked") // no support for covariance of Producer in Java
public static <U, T extends U> Producer<U> convertProducer(Producer<T> p) {
return (Producer<U>)(Producer) p;
}
@SuppressWarnings("unchecked")
public static <T, U extends T> Producer<U> upcastProducer(Producer<T> p) {
return (Producer<U>)(Producer) p;
}
@SuppressWarnings("unchecked")
public static scala.collection.immutable.Map<String, String> convertMapToScala(Map<String, String> map) {
return Map$.MODULE$.apply(scala.collection.JavaConverters.asScalaMapConverter(map).asScala().toSeq());
}
@SuppressWarnings("unchecked") // contains an upcast
public static <T, U extends T> scala.Option<U> convertOptionToScala(Option<T> o) {
return ((Option<U>) o).asScala();
}
public static final scala.collection.immutable.Map<String, String> emptyMap =
Map$.MODULE$.<String, String>empty();
public static final None$ noneValue = None$.MODULE$;
@SuppressWarnings("unchecked")
public static <T> scala.Option<T> scalaNone() {
return (scala.Option<T>) noneValue;
}
@SuppressWarnings("unchecked")
public static <T, U extends T> Seq<U> convertIterable(Iterable<T> els) {
return scala.collection.JavaConverters.asScalaIterableConverter((Iterable<U>)els).asScala().toVector();
}
@SuppressWarnings("unchecked")
public static <T, U extends T> Seq<U> convertArray(T[] els) {
return Util.<T, U>convertIterable(Arrays.asList(els));
}
public static akka.http.model.Uri convertUriToScala(Uri uri) {
return ((JavaUri) uri).uri();
}
public static <J, V extends J> akka.japi.Option<J> lookupInRegistry(ObjectRegistry<Object, V> registry, int key) {
return Util.<J, V>convertOption(registry.getForKey(key));
}
public static <J, V extends J> akka.japi.Option<J> lookupInRegistry(ObjectRegistry<String, V> registry, String key) {
return Util.<String, J, V>lookupInRegistry(registry, key);
}
public static <K, J, V extends J> akka.japi.Option<J> lookupInRegistry(ObjectRegistry<K, V> registry, K key) {
return Util.<J, V>convertOption(registry.getForKey(key));
}
/**
* Temporary replacement for akka.japi.Option.getOrElse until it gets released there.
*
* FIXME: remove in favor of a proper japi.Option.getOrElse
*/
public static <B, A extends B> B getOrElse(Option<A> option, B defaultValue) {
if (option.isDefined()) return option.get();
else return defaultValue;
}
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.MediaRange;
/**
* Model for the `Accept` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-5.3.2
*/
public abstract class Accept extends akka.http.model.HttpHeader {
public abstract Iterable<MediaRange> getMediaRanges();
public static Accept create(MediaRange... mediaRanges) {
return new akka.http.model.headers.Accept(akka.http.model.japi.Util.<MediaRange, akka.http.model.MediaRange>convertArray(mediaRanges));
}
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.HttpCharsetRange;
/**
* Model for the `Accept-Charset` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-5.3.3
*/
public abstract class AcceptCharset extends akka.http.model.HttpHeader {
public abstract Iterable<HttpCharsetRange> getCharsetRanges();
public static AcceptCharset create(HttpCharsetRange... charsetRanges) {
return new akka.http.model.headers.Accept$minusCharset(akka.http.model.japi.Util.<HttpCharsetRange, akka.http.model.HttpCharsetRange>convertArray(charsetRanges));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Accept-Encoding` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-5.3.4
*/
public abstract class AcceptEncoding extends akka.http.model.HttpHeader {
public abstract Iterable<HttpEncodingRange> getEncodings();
public static AcceptEncoding create(HttpEncodingRange... encodings) {
return new akka.http.model.headers.Accept$minusEncoding(akka.http.model.japi.Util.<HttpEncodingRange, akka.http.model.headers.HttpEncodingRange>convertArray(encodings));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Accept-Language` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-5.3.5
*/
public abstract class AcceptLanguage extends akka.http.model.HttpHeader {
public abstract Iterable<LanguageRange> getLanguages();
public static AcceptLanguage create(LanguageRange... languages) {
return new akka.http.model.headers.Accept$minusLanguage(akka.http.model.japi.Util.<LanguageRange, akka.http.model.headers.LanguageRange>convertArray(languages));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Accept-Ranges` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p5-range-26#section-2.3
*/
public abstract class AcceptRanges extends akka.http.model.HttpHeader {
public abstract Iterable<RangeUnit> getRangeUnits();
public static AcceptRanges create(RangeUnit... rangeUnits) {
return new akka.http.model.headers.Accept$minusRanges(akka.http.model.japi.Util.<RangeUnit, akka.http.model.headers.RangeUnit>convertArray(rangeUnits));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Access-Control-Allow-Credentials` header.
* Specification: http://www.w3.org/TR/cors/#access-control-allow-credentials-response-header
*/
public abstract class AccessControlAllowCredentials extends akka.http.model.HttpHeader {
public abstract boolean allow();
public static AccessControlAllowCredentials create(boolean allow) {
return new akka.http.model.headers.Access$minusControl$minusAllow$minusCredentials(allow);
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Access-Control-Allow-Headers` header.
* Specification: http://www.w3.org/TR/cors/#access-control-allow-headers-response-header
*/
public abstract class AccessControlAllowHeaders extends akka.http.model.HttpHeader {
public abstract Iterable<String> getHeaders();
public static AccessControlAllowHeaders create(String... headers) {
return new akka.http.model.headers.Access$minusControl$minusAllow$minusHeaders(akka.http.model.japi.Util.<String, String>convertArray(headers));
}
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.HttpMethod;
/**
* Model for the `Access-Control-Allow-Methods` header.
* Specification: http://www.w3.org/TR/cors/#access-control-allow-methods-response-header
*/
public abstract class AccessControlAllowMethods extends akka.http.model.HttpHeader {
public abstract Iterable<HttpMethod> getMethods();
public static AccessControlAllowMethods create(HttpMethod... methods) {
return new akka.http.model.headers.Access$minusControl$minusAllow$minusMethods(akka.http.model.japi.Util.<HttpMethod, akka.http.model.HttpMethod>convertArray(methods));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Access-Control-Allow-Origin` header.
* Specification: http://www.w3.org/TR/cors/#access-control-allow-origin-response-header
*/
public abstract class AccessControlAllowOrigin extends akka.http.model.HttpHeader {
public abstract HttpOriginRange range();
public static AccessControlAllowOrigin create(HttpOriginRange range) {
return new akka.http.model.headers.Access$minusControl$minusAllow$minusOrigin(((akka.http.model.headers.HttpOriginRange) range));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Access-Control-Expose-Headers` header.
* Specification: http://www.w3.org/TR/cors/#access-control-expose-headers-response-header
*/
public abstract class AccessControlExposeHeaders extends akka.http.model.HttpHeader {
public abstract Iterable<String> getHeaders();
public static AccessControlExposeHeaders create(String... headers) {
return new akka.http.model.headers.Access$minusControl$minusExpose$minusHeaders(akka.http.model.japi.Util.<String, String>convertArray(headers));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Access-Control-Max-Age` header.
* Specification: http://www.w3.org/TR/cors/#access-control-max-age-response-header
*/
public abstract class AccessControlMaxAge extends akka.http.model.HttpHeader {
public abstract long deltaSeconds();
public static AccessControlMaxAge create(long deltaSeconds) {
return new akka.http.model.headers.Access$minusControl$minusMax$minusAge(deltaSeconds);
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Access-Control-Request-Headers` header.
* Specification: http://www.w3.org/TR/cors/#access-control-request-headers-request-header
*/
public abstract class AccessControlRequestHeaders extends akka.http.model.HttpHeader {
public abstract Iterable<String> getHeaders();
public static AccessControlRequestHeaders create(String... headers) {
return new akka.http.model.headers.Access$minusControl$minusRequest$minusHeaders(akka.http.model.japi.Util.<String, String>convertArray(headers));
}
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.HttpMethod;
/**
* Model for the `Access-Control-Request-Method` header.
* Specification: http://www.w3.org/TR/cors/#access-control-request-method-request-header
*/
public abstract class AccessControlRequestMethod extends akka.http.model.HttpHeader {
public abstract HttpMethod method();
public static AccessControlRequestMethod create(HttpMethod method) {
return new akka.http.model.headers.Access$minusControl$minusRequest$minusMethod(((akka.http.model.HttpMethod) method));
}
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.HttpMethod;
/**
* Model for the `Allow` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-7.4.1
*/
public abstract class Allow extends akka.http.model.HttpHeader {
public abstract Iterable<HttpMethod> getMethods();
public static Allow create(HttpMethod... methods) {
return new akka.http.model.headers.Allow(akka.http.model.japi.Util.<HttpMethod, akka.http.model.HttpMethod>convertArray(methods));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Authorization` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p7-auth-26#section-4.2
*/
public abstract class Authorization extends akka.http.model.HttpHeader {
public abstract HttpCredentials credentials();
public static Authorization create(HttpCredentials credentials) {
return new akka.http.model.headers.Authorization(((akka.http.model.headers.HttpCredentials) credentials));
}
}

View file

@ -0,0 +1,10 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public abstract class BasicHttpCredentials extends akka.http.model.headers.HttpCredentials {
public abstract String username();
public abstract String password();
}

View file

@ -0,0 +1,29 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.headers.ByteRange$;
import akka.japi.Option;
public abstract class ByteRange {
public abstract boolean isSlice();
public abstract boolean isFromOffset();
public abstract boolean isSuffix();
public abstract Option<Long> getSliceFirst();
public abstract Option<Long> getSliceLast();
public abstract Option<Long> getOffset();
public abstract Option<Long> getSuffixLength();
public static ByteRange createSlice(long first, long last) {
return ByteRange$.MODULE$.apply(first, last);
}
public static ByteRange createFromOffset(long offset) {
return ByteRange$.MODULE$.fromOffset(offset);
}
public static ByteRange createSuffix(long length) {
return ByteRange$.MODULE$.suffix(length);
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Cache-Control` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p6-cache-26#section-5.2
*/
public abstract class CacheControl extends akka.http.model.HttpHeader {
public abstract Iterable<CacheDirective> getDirectives();
public static CacheControl create(CacheDirective... directives) {
return new akka.http.model.headers.Cache$minusControl(akka.http.model.japi.Util.<CacheDirective, akka.http.model.headers.CacheDirective>convertArray(directives));
}
}

View file

@ -0,0 +1,9 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public interface CacheDirective {
String value();
}

View file

@ -0,0 +1,40 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public final class CacheDirectives {
private CacheDirectives() {}
public static CacheDirective MAX_AGE(long deltaSeconds) {
return new akka.http.model.headers.CacheDirectives.max$minusage(deltaSeconds);
}
public static CacheDirective MAX_STALE() {
return new akka.http.model.headers.CacheDirectives.max$minusstale(akka.japi.Option.none().asScala());
}
public static CacheDirective MAX_STALE(long deltaSeconds) {
return new akka.http.model.headers.CacheDirectives.max$minusstale(akka.japi.Option.some((Object) deltaSeconds).asScala());
}
public static CacheDirective MIN_FRESH(long deltaSeconds) {
return new akka.http.model.headers.CacheDirectives.min$minusfresh(deltaSeconds);
}
public static final CacheDirective NO_CACHE = akka.http.model.headers.CacheDirectives.no$minuscache$.MODULE$;
public static final CacheDirective NO_STORE = akka.http.model.headers.CacheDirectives.no$minusstore$.MODULE$;
public static final CacheDirective NO_TRANSFORM = akka.http.model.headers.CacheDirectives.no$minustransform$.MODULE$;
public static final CacheDirective ONLY_IF_CACHED = akka.http.model.headers.CacheDirectives.only$minusif$minuscached$.MODULE$;
public static final CacheDirective MUST_REVALIDATE = akka.http.model.headers.CacheDirectives.must$minusrevalidate$.MODULE$;
public static CacheDirective NO_CACHE(String... fieldNames) {
return akka.http.model.headers.CacheDirectives.no$minuscache$.MODULE$.apply(fieldNames);
}
public static final CacheDirective PUBLIC = akka.http.model.headers.CacheDirectives.public$.MODULE$;
public static CacheDirective PRIVATE(String... fieldNames) {
return akka.http.model.headers.CacheDirectives.private$.MODULE$.apply(fieldNames);
}
public static final CacheDirective PROXY_REVALIDATE = akka.http.model.headers.CacheDirectives.proxy$minusrevalidate$.MODULE$;
public static CacheDirective S_MAXAGE(long deltaSeconds) {
return new akka.http.model.headers.CacheDirectives.s$minusmaxage(deltaSeconds);
}
}

View file

@ -0,0 +1,18 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Content-Disposition` header.
* Specification: http://tools.ietf.org/html/rfc6266
*/
public abstract class ContentDisposition extends akka.http.model.HttpHeader {
public abstract ContentDispositionType dispositionType();
public abstract java.util.Map<String, String> getParams();
public static ContentDisposition create(ContentDispositionType dispositionType, java.util.Map<String, String> params) {
return new akka.http.model.headers.Content$minusDisposition(((akka.http.model.headers.ContentDispositionType) dispositionType), akka.http.model.japi.Util.convertMapToScala(params));
}
}

View file

@ -0,0 +1,9 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public interface ContentDispositionType {
String name();
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public final class ContentDispositionTypes {
private ContentDispositionTypes() {}
public static final ContentDispositionType INLINE = akka.http.model.headers.ContentDispositionTypes.inline$.MODULE$;
public static final ContentDispositionType ATTACHMENT = akka.http.model.headers.ContentDispositionTypes.attachment$.MODULE$;
public static final ContentDispositionType FORM_DATA = akka.http.model.headers.ContentDispositionTypes.form$minusdata$.MODULE$;
public static ContentDispositionType Ext(String name) {
return new akka.http.model.headers.ContentDispositionTypes.Ext(name);
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Content-Encoding` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-3.1.2.2
*/
public abstract class ContentEncoding extends akka.http.model.HttpHeader {
public abstract Iterable<HttpEncoding> getEncodings();
public static ContentEncoding create(HttpEncoding... encodings) {
return new akka.http.model.headers.Content$minusEncoding(akka.http.model.japi.Util.<HttpEncoding, akka.http.model.headers.HttpEncoding>convertArray(encodings));
}
}

View file

@ -0,0 +1,18 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Content-Range` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p5-range-26#section-4.2
*/
public abstract class ContentRange extends akka.http.model.HttpHeader {
public abstract RangeUnit rangeUnit();
public abstract akka.http.model.japi.ContentRange contentRange();
public static ContentRange create(RangeUnit rangeUnit, akka.http.model.japi.ContentRange contentRange) {
return new akka.http.model.headers.Content$minusRange(((akka.http.model.headers.RangeUnit) rangeUnit), ((akka.http.model.ContentRange) contentRange));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Content-Type` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-3.1.1.5
*/
public abstract class ContentType extends akka.http.model.HttpHeader {
public abstract akka.http.model.japi.ContentType contentType();
public static ContentType create(akka.http.model.japi.ContentType contentType) {
return new akka.http.model.headers.Content$minusType(((akka.http.model.ContentType) contentType));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Cookie` header.
* Specification: https://tools.ietf.org/html/rfc6265#section-4.2
*/
public abstract class Cookie extends akka.http.model.HttpHeader {
public abstract Iterable<HttpCookie> getCookies();
public static Cookie create(HttpCookie... cookies) {
return new akka.http.model.headers.Cookie(akka.http.model.japi.Util.<HttpCookie, akka.http.model.headers.HttpCookie>convertArray(cookies));
}
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.DateTime;
/**
* Model for the `Date` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-7.1.1.2
*/
public abstract class Date extends akka.http.model.HttpHeader {
public abstract DateTime date();
public static Date create(DateTime date) {
return new akka.http.model.headers.Date(((akka.http.util.DateTime) date));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `ETag` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26#section-2.3
*/
public abstract class ETag extends akka.http.model.HttpHeader {
public abstract EntityTag etag();
public static ETag create(EntityTag etag) {
return new akka.http.model.headers.ETag(((akka.http.model.headers.EntityTag) etag));
}
}

View file

@ -0,0 +1,20 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public abstract class EntityTag {
public abstract String tag();
public abstract boolean weak();
public static EntityTag create(String tag, boolean weak) {
return new akka.http.model.headers.EntityTag(tag, weak);
}
public static boolean matchesRange(EntityTag eTag, EntityTagRange range, boolean weak) {
return akka.http.model.headers.EntityTag.matchesRange(eTag, range, weak);
}
public static boolean matches(EntityTag eTag, EntityTag other, boolean weak) {
return akka.http.model.headers.EntityTag.matches(eTag, other, weak);
}
}

View file

@ -0,0 +1,14 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.Util;
public abstract class EntityTagRange {
public static EntityTagRange create(EntityTag... tags) {
return akka.http.model.headers.EntityTagRange.apply(Util.<EntityTag, akka.http.model.headers.EntityTag>convertArray(tags));
}
public static final EntityTagRange ALL = akka.http.model.headers.EntityTagRange.$times$.MODULE$;
}

View file

@ -0,0 +1,10 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public abstract class Host extends akka.http.model.HttpHeader {
public abstract akka.http.model.japi.Host host();
public abstract int port();
}

View file

@ -0,0 +1,24 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.headers.HttpChallenge$;
import akka.http.model.japi.Util;
import java.util.Map;
public abstract class HttpChallenge {
public abstract String scheme();
public abstract String realm();
public abstract Map<String, String> getParams();
public static HttpChallenge create(String scheme, String realm) {
return new akka.http.model.headers.HttpChallenge(scheme, realm, Util.emptyMap);
}
public static HttpChallenge create(String scheme, String realm, Map<String, String> params) {
return new akka.http.model.headers.HttpChallenge(scheme, realm, Util.convertMapToScala(params));
}
}

View file

@ -0,0 +1,51 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.DateTime;
import akka.http.model.japi.Util;
import akka.japi.Option;
public abstract class HttpCookie {
public abstract String name();
public abstract String content();
public abstract Option<DateTime> getExpires();
public abstract Option<Long> getMaxAge();
public abstract Option<String> getDomain();
public abstract Option<String> getPath();
public abstract boolean secure();
public abstract boolean httpOnly();
public abstract Option<String> getExtension();
public static HttpCookie create(String name, String content) {
return new akka.http.model.headers.HttpCookie(
name, content,
Util.<akka.http.util.DateTime>scalaNone(), Util.scalaNone(), Util.<String>scalaNone(), Util.<String>scalaNone(),
false, false,
Util.<String>scalaNone());
}
@SuppressWarnings("unchecked")
public static HttpCookie create(
String name,
String content,
Option<DateTime> expires,
Option<Long> maxAge,
Option<String> domain,
Option<String> path,
boolean secure,
boolean httpOnly,
Option<String> extension) {
return new akka.http.model.headers.HttpCookie(
name, content,
Util.<DateTime, akka.http.util.DateTime>convertOptionToScala(expires),
((Option<Object>) (Option) maxAge).asScala(),
domain.asScala(),
path.asScala(),
secure,
httpOnly,
extension.asScala());
}
}

View file

@ -0,0 +1,29 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.Util;
import java.util.Map;
public abstract class HttpCredentials {
public abstract String scheme();
public abstract String token();
public abstract Map<String, String> getParams();
public static HttpCredentials create(String scheme, String token) {
return new akka.http.model.headers.GenericHttpCredentials(scheme, token, Util.emptyMap);
}
public static HttpCredentials create(String scheme, String token, Map<String, String> params) {
return new akka.http.model.headers.GenericHttpCredentials(scheme, token, Util.convertMapToScala(params));
}
public static BasicHttpCredentials createBasicHttpCredential(String username, String password) {
return new akka.http.model.headers.BasicHttpCredentials(username, password);
}
public static OAuth2BearerToken createOAuth2BearerToken(String token) {
return new akka.http.model.headers.OAuth2BearerToken(token);
}
}

View file

@ -0,0 +1,9 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public abstract class HttpEncoding {
public abstract String value();
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.headers.HttpEncodingRange$;
public abstract class HttpEncodingRange {
public abstract float qValue();
public abstract boolean matches(HttpEncoding encoding);
public abstract HttpEncodingRange withQValue(float qValue);
public static final HttpEncodingRange ALL = akka.http.model.headers.HttpEncodingRange.$times$.MODULE$;
public static HttpEncodingRange create(HttpEncoding encoding) {
return HttpEncodingRange$.MODULE$.apply((akka.http.model.headers.HttpEncoding) encoding);
}
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.headers.HttpOrigin$;
public abstract class HttpOrigin {
public abstract String scheme();
public abstract Host host();
public static HttpOrigin create(String scheme, Host host) {
return new akka.http.model.headers.HttpOrigin(scheme, (akka.http.model.headers.Host) host);
}
public static HttpOrigin parse(String originString) {
return HttpOrigin$.MODULE$.apply(originString);
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.headers.HttpOriginRange$;
import akka.http.model.japi.Util;
public abstract class HttpOriginRange {
public abstract boolean matches(HttpOrigin origin);
public static final HttpOriginRange ALL = akka.http.model.headers.HttpOriginRange.$times$.MODULE$;
public static HttpOriginRange create(HttpOrigin... origins) {
return HttpOriginRange$.MODULE$.apply(Util.<HttpOrigin, akka.http.model.headers.HttpOrigin>convertArray(origins));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `If-Match` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26#section-3.1
*/
public abstract class IfMatch extends akka.http.model.HttpHeader {
public abstract EntityTagRange m();
public static IfMatch create(EntityTagRange m) {
return new akka.http.model.headers.If$minusMatch(((akka.http.model.headers.EntityTagRange) m));
}
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.DateTime;
/**
* Model for the `If-Modified-Since` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26#section-3.3
*/
public abstract class IfModifiedSince extends akka.http.model.HttpHeader {
public abstract DateTime date();
public static IfModifiedSince create(DateTime date) {
return new akka.http.model.headers.If$minusModified$minusSince(((akka.http.util.DateTime) date));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `If-None-Match` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26#section-3.2
*/
public abstract class IfNoneMatch extends akka.http.model.HttpHeader {
public abstract EntityTagRange m();
public static IfNoneMatch create(EntityTagRange m) {
return new akka.http.model.headers.If$minusNone$minusMatch(((akka.http.model.headers.EntityTagRange) m));
}
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.DateTime;
/**
* Model for the `If-Unmodified-Since` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26#section-3.4
*/
public abstract class IfUnmodifiedSince extends akka.http.model.HttpHeader {
public abstract DateTime date();
public static IfUnmodifiedSince create(DateTime date) {
return new akka.http.model.headers.If$minusUnmodified$minusSince(((akka.http.util.DateTime) date));
}
}

View file

@ -0,0 +1,14 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.headers.Language$;
import akka.http.model.japi.Util;
public abstract class Language implements LanguageRange {
public static Language create(String primaryTag, String... subTags) {
return Language$.MODULE$.apply(primaryTag, Util.<String, String>convertArray(subTags));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public interface LanguageRange {
public abstract String primaryTag();
public abstract float qValue();
public abstract Iterable<String> getSubTags();
public abstract boolean matches(Language language);
public abstract LanguageRange withQValue(float qValue);
public static final LanguageRange ALL = akka.http.model.headers.LanguageRange.$times$.MODULE$;
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.DateTime;
/**
* Model for the `Last-Modified` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p4-conditional-26#section-2.2
*/
public abstract class LastModified extends akka.http.model.HttpHeader {
public abstract DateTime date();
public static LastModified create(DateTime date) {
return new akka.http.model.headers.Last$minusModified(((akka.http.util.DateTime) date));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Link` header.
* Specification: http://tools.ietf.org/html/rfc5988#section-5
*/
public abstract class Link extends akka.http.model.HttpHeader {
public abstract Iterable<LinkValue> getValues();
public static Link create(LinkValue... values) {
return new akka.http.model.headers.Link(akka.http.model.japi.Util.<LinkValue, akka.http.model.headers.LinkValue>convertArray(values));
}
}

View file

@ -0,0 +1,14 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.MediaType;
import akka.http.model.japi.Uri;
import akka.http.model.japi.Util;
public abstract class LinkParam {
public abstract String key();
public abstract Object value();
}

View file

@ -0,0 +1,43 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.MediaType;
import akka.http.model.japi.Uri;
import akka.http.model.japi.Util;
public final class LinkParams {
private LinkParams() {}
public static final LinkParam next = akka.http.model.headers.LinkParams.next();
public static final LinkParam prev = akka.http.model.headers.LinkParams.prev();
public static final LinkParam first = akka.http.model.headers.LinkParams.first();
public static final LinkParam last = akka.http.model.headers.LinkParams.last();
public static LinkParam rel(String value) {
return new akka.http.model.headers.LinkParams.rel(value);
}
public static LinkParam anchor(Uri uri) {
return new akka.http.model.headers.LinkParams.anchor(Util.convertUriToScala(uri));
}
public static LinkParam rev(String value) {
return new akka.http.model.headers.LinkParams.rev(value);
}
public static LinkParam hreflang(Language language) {
return new akka.http.model.headers.LinkParams.hreflang((akka.http.model.headers.Language) language);
}
public static LinkParam media(String desc) {
return new akka.http.model.headers.LinkParams.media(desc);
}
public static LinkParam title(String title) {
return new akka.http.model.headers.LinkParams.title(title);
}
public static LinkParam title_All(String title) {
return new akka.http.model.headers.LinkParams.title$times(title);
}
public static LinkParam type(MediaType type) {
return new akka.http.model.headers.LinkParams.type((akka.http.model.MediaType) type);
}
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.Uri;
import akka.http.model.japi.Util;
public abstract class LinkValue {
public abstract Uri getUri();
public abstract Iterable<LinkParam> getParams();
public static LinkValue create(Uri uri, LinkParam... params) {
return new akka.http.model.headers.LinkValue(
Util.convertUriToScala(uri),
Util.<LinkParam, akka.http.model.headers.LinkParam>convertArray(params));
}
}

View file

@ -0,0 +1,19 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
import akka.http.model.japi.Uri;
/**
* Model for the `Location` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-7.1.2
*/
public abstract class Location extends akka.http.model.HttpHeader {
public abstract Uri getUri();
public static Location create(Uri uri) {
return new akka.http.model.headers.Location(akka.http.model.japi.Util.convertUriToScala(uri));
}
}

View file

@ -0,0 +1,9 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public abstract class OAuth2BearerToken extends akka.http.model.headers.HttpCredentials {
public abstract String token();
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Origin` header.
* Specification: http://tools.ietf.org/html/rfc6454#section-7
*/
public abstract class Origin extends akka.http.model.HttpHeader {
public abstract Iterable<HttpOrigin> getOrigins();
public static Origin create(HttpOrigin... origins) {
return new akka.http.model.headers.Origin(akka.http.model.japi.Util.<HttpOrigin, akka.http.model.headers.HttpOrigin>convertArray(origins));
}
}

View file

@ -0,0 +1,18 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public abstract class ProductVersion {
public abstract String product();
public abstract String version();
public abstract String comment();
public static ProductVersion create(String product, String version, String comment) {
return new akka.http.model.headers.ProductVersion(product, version, comment);
}
public static ProductVersion create(String product, String version) {
return create(product, version, "");
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Proxy-Authenticate` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p7-auth-26#section-4.3
*/
public abstract class ProxyAuthenticate extends akka.http.model.HttpHeader {
public abstract Iterable<HttpChallenge> getChallenges();
public static ProxyAuthenticate create(HttpChallenge... challenges) {
return new akka.http.model.headers.Proxy$minusAuthenticate(akka.http.model.japi.Util.<HttpChallenge, akka.http.model.headers.HttpChallenge>convertArray(challenges));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Proxy-Authorization` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p7-auth-26#section-4.4
*/
public abstract class ProxyAuthorization extends akka.http.model.HttpHeader {
public abstract HttpCredentials credentials();
public static ProxyAuthorization create(HttpCredentials credentials) {
return new akka.http.model.headers.Proxy$minusAuthorization(((akka.http.model.headers.HttpCredentials) credentials));
}
}

View file

@ -0,0 +1,18 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Range` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p5-range-26#section-3.1
*/
public abstract class Range extends akka.http.model.HttpHeader {
public abstract RangeUnit rangeUnit();
public abstract Iterable<ByteRange> getRanges();
public static Range create(RangeUnit rangeUnit, ByteRange... ranges) {
return new akka.http.model.headers.Range(((akka.http.model.headers.RangeUnit) rangeUnit), akka.http.model.japi.Util.<ByteRange, akka.http.model.headers.ByteRange>convertArray(ranges));
}
}

View file

@ -0,0 +1,13 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public abstract class RangeUnit {
public abstract String name();
public static RangeUnit create(String name) {
return new akka.http.model.headers.RangeUnits.Other(name);
}
}

View file

@ -0,0 +1,11 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public final class RangeUnits {
private RangeUnits() {}
public static final RangeUnit BYTES = akka.http.model.headers.RangeUnits.Bytes$.MODULE$;
}

View file

@ -0,0 +1,10 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
public abstract class RawHeader extends akka.http.model.HttpHeader {
public abstract String name();
public abstract String value();
}

View file

@ -0,0 +1,18 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Raw-Request-URI` header.
* Custom header we use for transporting the raw request URI either to the application (server-side)
* or to the request rendering stage (client-side).
*/
public abstract class RawRequestURI extends akka.http.model.HttpHeader {
public abstract String uri();
public static RawRequestURI create(String uri) {
return new akka.http.model.headers.Raw$minusRequest$minusURI(uri);
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Remote-Address` header.
* Custom header we use for optionally transporting the peer's IP in an HTTP header.
*/
public abstract class RemoteAddress extends akka.http.model.HttpHeader {
public abstract akka.http.model.japi.RemoteAddress address();
public static RemoteAddress create(akka.http.model.japi.RemoteAddress address) {
return new akka.http.model.headers.Remote$minusAddress(((akka.http.model.RemoteAddress) address));
}
}

View file

@ -0,0 +1,17 @@
/**
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.model.japi.headers;
/**
* Model for the `Server` header.
* Specification: http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-7.4.2
*/
public abstract class Server extends akka.http.model.HttpHeader {
public abstract Iterable<ProductVersion> getProducts();
public static Server create(ProductVersion... products) {
return new akka.http.model.headers.Server(akka.http.model.japi.Util.<ProductVersion, akka.http.model.headers.ProductVersion>convertArray(products));
}
}

Some files were not shown because too many files have changed in this diff Show more