Class HttpHeader
- java.lang.Object
-
- akka.http.javadsl.model.HttpHeader
-
- akka.http.scaladsl.model.HttpHeader
-
- All Implemented Interfaces:
Renderable
,ToStringRenderable
- Direct Known Subclasses:
Accept
,AcceptCharset
,AcceptEncoding
,AcceptLanguage
,AcceptRanges
,AccessControlAllowCredentials
,AccessControlAllowHeaders
,AccessControlAllowMethods
,AccessControlAllowOrigin
,AccessControlExposeHeaders
,AccessControlMaxAge
,AccessControlRequestHeaders
,AccessControlRequestMethod
,Age
,Allow
,Authorization
,CacheControl
,Connection
,ContentDisposition
,ContentEncoding
,ContentLength
,ContentLocation
,ContentRange
,ContentType
,Cookie
,CustomHeader
,Date
,EmptyHeader$
,ETag
,Expect
,Expires
,Host
,If$minusRange
,IfMatch
,IfModifiedSince
,IfNoneMatch
,IfUnmodifiedSince
,LastEventId
,LastModified
,Link
,Location
,Origin
,ProxyAuthenticate
,ProxyAuthorization
,Range
,RawHeader
,RawRequestURI
,Referer
,RemoteAddress
,RetryAfter
,Sec$minusWebSocket$minusAccept
,Sec$minusWebSocket$minusExtensions
,Sec$minusWebSocket$minusKey
,Sec$minusWebSocket$minusVersion
,SecWebSocketProtocol
,Server
,SetCookie
,StrictTransportSecurity
,TE
,TimeoutAccess
,TlsSessionInfo
,TransferEncoding
,Upgrade
,UserAgent
,WWWAuthenticate
,XForwardedFor
,XForwardedHost
,XForwardedProto
,XRealIp
public abstract class HttpHeader extends HttpHeader implements ToStringRenderable
The model of an HTTP header. In its most basic form headers are simple name-value pairs. Header names are compared in a case-insensitive way.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
HttpHeader.ParsingResult
static class
HttpHeader.ParsingResult$
-
Constructor Summary
Constructors Constructor Description HttpHeader()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <T extends HttpHeader>
akka.util.OptionVal<T>fastFind(java.lang.Class<T> clazz, scala.collection.immutable.Seq<HttpHeader> headers)
INTERNAL APIboolean
is(java.lang.String nameInLowerCase)
Returns true if and only if nameInLowerCase.equals(lowercaseName()).boolean
isNot(java.lang.String nameInLowerCase)
Returns !abstract java.lang.String
lowercaseName()
Returns the lower-cased name of the header.abstract java.lang.String
name()
Returns the name of the header.static HttpHeader.ParsingResult
parse(java.lang.String name, java.lang.String value, HeaderParser.Settings settings)
Attempts to parse the given header name and value string into a header model instance.static scala.Option<scala.Tuple2<java.lang.String,java.lang.String>>
unapply(HttpHeader header)
Extract name and value from a header.java.lang.String
unsafeToString()
abstract java.lang.String
value()
Returns the String representation of the value of the header.-
Methods inherited from class akka.http.javadsl.model.HttpHeader
parse, renderInRequests, renderInResponses
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.http.impl.util.Renderable
render
-
Methods inherited from interface akka.http.impl.util.ToStringRenderable
toString
-
-
-
-
Method Detail
-
unapply
public static scala.Option<scala.Tuple2<java.lang.String,java.lang.String>> unapply(HttpHeader header)
Extract name and value from a header. CAUTION: The name must be matched in *all-lowercase*!.- Parameters:
header
- (undocumented)- Returns:
- (undocumented)
-
parse
public static HttpHeader.ParsingResult parse(java.lang.String name, java.lang.String value, HeaderParser.Settings settings)
Attempts to parse the given header name and value string into a header model instance.This process has several possible outcomes:
1. The header name corresponds to a properly modelled header and a) the value is valid for this header type. In this case the method returns a
ParsingResult.Ok
with the respective header instance and no errors. b) the value consists of a number elements, some of which valid and some invalid, and the header type supports partial value parsing. In this case the method returns aParsingResult.Ok
with the respective header instance holding the valid value elements and anErrorInfo
for each invalid value. c) the value has invalid elements and the header type doesn't support partial value parsing. In this case the method returns aParsingResult.Ok
with aRawHeader
instance and a singleErrorInfo
for the value parsing problem.2. The header name does not correspond to a properly modelled header but the header name and the value are both syntactically legal according to the basic header requirements from the HTTP specification. (http://tools.ietf.org/html/rfc7230#section-3.2) In this case the method returns a
ParsingResult.Ok
with aRawHeader
instance and no errors.3. The header name or value are illegal according to the basic requirements for HTTP headers (http://tools.ietf.org/html/rfc7230#section-3.2). In this case the method returns a
ParsingResult.Error
.- Parameters:
name
- (undocumented)value
- (undocumented)settings
- (undocumented)- Returns:
- (undocumented)
-
fastFind
public static <T extends HttpHeader> akka.util.OptionVal<T> fastFind(java.lang.Class<T> clazz, scala.collection.immutable.Seq<HttpHeader> headers)
INTERNAL API
-
name
public abstract java.lang.String name()
Description copied from class:HttpHeader
Returns the name of the header.- Specified by:
name
in classHttpHeader
-
value
public abstract java.lang.String value()
Description copied from class:HttpHeader
Returns the String representation of the value of the header.- Specified by:
value
in classHttpHeader
-
lowercaseName
public abstract java.lang.String lowercaseName()
Description copied from class:HttpHeader
Returns the lower-cased name of the header.- Specified by:
lowercaseName
in classHttpHeader
-
is
public boolean is(java.lang.String nameInLowerCase)
Description copied from class:HttpHeader
Returns true if and only if nameInLowerCase.equals(lowercaseName()).- Specified by:
is
in classHttpHeader
-
isNot
public boolean isNot(java.lang.String nameInLowerCase)
Description copied from class:HttpHeader
Returns !is(nameInLowerCase).- Specified by:
isNot
in classHttpHeader
-
unsafeToString
public java.lang.String unsafeToString()
-
-