Package org.apache.wicket.request
Class HttpHeaderCollection
- java.lang.Object
-
- org.apache.wicket.request.HttpHeaderCollection
-
public class HttpHeaderCollection extends Object
A multivalue map of headers names and header values suitable for processing http request and response headers.- Since:
- 1.5
- Author:
- Peter Ertl
-
-
Constructor Summary
Constructors Constructor Description HttpHeaderCollection()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDateHeader(String name, Instant time)
add date header valuevoid
addHeader(String name, String value)
add header valuevoid
clear()
clear all headersboolean
containsHeader(String name)
check if header is definedint
getCount()
get number of headersInstant
getDateHeader(String name)
Gets the header identified with the name as a TimeString
getHeader(String name)
Gets the header identified with the name as a String.Set<String>
getHeaderNames()
returns names of headersString[]
getHeaderValues(String name)
get header values (dates will be converted into strings)boolean
isEmpty()
Check if collection is emptyvoid
removeHeader(String name)
remove header values for header namevoid
setDateHeader(String name, Instant time)
add date header valuevoid
setHeader(String name, String value)
set header value (and remove previous values)
-
-
-
Constructor Detail
-
HttpHeaderCollection
public HttpHeaderCollection()
Constructor.
-
-
Method Detail
-
setHeader
public void setHeader(String name, String value)
set header value (and remove previous values)- Parameters:
name
- header namevalue
- header value
-
addHeader
public void addHeader(String name, String value)
add header value- Parameters:
name
- header namevalue
- header value
-
addDateHeader
public void addDateHeader(String name, Instant time)
add date header value- Parameters:
name
- header nametime
- timestamp
-
setDateHeader
public void setDateHeader(String name, Instant time)
add date header value- Parameters:
name
- header nametime
- timestamp
-
removeHeader
public void removeHeader(String name)
remove header values for header name- Parameters:
name
- header name
-
containsHeader
public boolean containsHeader(String name)
check if header is defined- Parameters:
name
- header name- Returns:
true
if header has one or more values
-
getHeaderNames
public Set<String> getHeaderNames()
returns names of headers- Returns:
- set of header names
-
getHeaderValues
public String[] getHeaderValues(String name)
get header values (dates will be converted into strings)- Parameters:
name
- header name- Returns:
- array of header values or empty array if not found
-
getHeader
public String getHeader(String name)
Gets the header identified with the name as a String.- Parameters:
name
-- Returns:
null
when the header was not found
-
getDateHeader
public Instant getDateHeader(String name)
Gets the header identified with the name as a Time- Parameters:
name
-- Returns:
null
when the header was not found
-
isEmpty
public boolean isEmpty()
Check if collection is empty- Returns:
true
if collection is empty,false
otherwise
-
getCount
public int getCount()
get number of headers- Returns:
- count
-
clear
public void clear()
clear all headers
-
-