Package play.mvc
Class Http.Headers
- Object
-
- play.mvc.Http.Headers
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Http.Headers
addHeader(String name, String value)
Deprecated.Deprecated as of 2.8.0.Http.Headers
addHeader(String name, List<String> values)
Deprecated.Deprecated as of 2.8.0.Http.Headers
adding(String name, String value)
Add a new header with the given value.Http.Headers
adding(String name, List<String> values)
Add a new header with the given values.Map<String,List<String>>
asMap()
play.api.mvc.Headers
asScala()
boolean
contains(String headerName)
Checks if the given header is present.Optional<String>
get(String name)
Gets the header value.List<String>
getAll(String name)
Get all the values associated with the header name.Http.Headers
remove(String name)
Deprecated.Deprecated as of 2.8.0.Http.Headers
removing(String name)
Remove a header.Map<String,List<String>>
toMap()
Deprecated.Deprecated as of 2.8.0.
-
-
-
Method Detail
-
toMap
@Deprecated public Map<String,List<String>> toMap()
Deprecated.Deprecated as of 2.8.0. UseasMap()
instead.- Returns:
- all the headers as a map.
-
contains
public boolean contains(String headerName)
Checks if the given header is present.- Parameters:
headerName
- The name of the header (case-insensitive)- Returns:
true
if the request did contain the header.
-
get
public Optional<String> get(String name)
Gets the header value. If more than one value is associated with this header, then returns the first one.- Parameters:
name
- the header name- Returns:
- the first header value or empty if no value available.
-
getAll
public List<String> getAll(String name)
Get all the values associated with the header name.- Parameters:
name
- the header name.- Returns:
- the list of values associates with the header of empty.
-
asScala
public play.api.mvc.Headers asScala()
- Returns:
- the scala version of this headers.
-
addHeader
@Deprecated public Http.Headers addHeader(String name, String value)
Deprecated.Deprecated as of 2.8.0. Useadding(String, String)
instead.Add a new header with the given value.- Parameters:
name
- the header namevalue
- the header value- Returns:
- this with the new header added
-
adding
public Http.Headers adding(String name, String value)
Add a new header with the given value.- Parameters:
name
- the header namevalue
- the header value- Returns:
- a new Header instance with the new header added
-
addHeader
@Deprecated public Http.Headers addHeader(String name, List<String> values)
Deprecated.Deprecated as of 2.8.0. Useadding(String, List)
instead.Add a new header with the given values.- Parameters:
name
- the header namevalues
- the header values- Returns:
- this with the new header added
-
adding
public Http.Headers adding(String name, List<String> values)
Add a new header with the given values.- Parameters:
name
- the header namevalues
- the header values- Returns:
- a new Header instance with the new header added
-
remove
@Deprecated public Http.Headers remove(String name)
Deprecated.Deprecated as of 2.8.0. Useremoving(String)
instead.Remove a header.- Parameters:
name
- the header name.- Returns:
- this without the removed header.
-
removing
public Http.Headers removing(String name)
Remove a header.- Parameters:
name
- the header name.- Returns:
- a new Header instance without the removed header.
-
-