public class RestletUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ATTRIBUTE_HEADERS
the attribute key for the HTTP headers in a restlet request
|
static List<String> |
FORMAT_RFC_822_Z
Common date formats (RFC 822).
|
Modifier and Type | Method and Description |
---|---|
static String |
getHttpHeader(org.restlet.data.Message msg,
String headerName)
Returns the HTTP header with the given name from the given msg.
|
static String |
getHttpHeader(org.restlet.data.Message msg,
String headerName,
String defaultValue)
Returns the HTTP header with the given name from the given msg.
|
static String |
getHttpHeader(org.restlet.data.Request request,
String headerName)
Returns the HTTP header with the given name from the given request.
|
static String |
getHttpHeader(org.restlet.data.Request request,
String headerName,
String defaultValue)
Returns the HTTP header with the given name from the given request.
|
static String |
getHttpHeader(org.restlet.util.Series<org.restlet.data.Parameter> headers,
String headerName)
Returns the HTTP header with the given name from the given header list.
|
static String |
getHttpHeader(org.restlet.util.Series<org.restlet.data.Parameter> headers,
String headerName,
String defaultValue)
Returns the HTTP header with the given name from the given header list.
|
static org.restlet.util.Series<org.restlet.data.Parameter> |
getHttpHeaders(org.restlet.data.Message msg)
Returns the HTTP headers from the given msg.
|
static org.restlet.util.Series<org.restlet.data.Parameter> |
getHttpHeaders(org.restlet.data.Request request)
Returns the HTTP headers from the given request.
|
static org.restlet.util.Series<org.restlet.data.Parameter> |
getHttpHeadersForUpdate(org.restlet.data.Message msg)
Returns the HTTP headers from the given message, adding a new headers collection if none is found.
|
static org.restlet.util.Series<org.restlet.data.Parameter> |
getHttpHeadersForUpdate(org.restlet.data.Request request)
Returns the HTTP headers from the given request, adding a new headers collection if none is found.
|
static void |
setHttpHeader(org.restlet.data.Message msg,
String headerName,
String value)
Sets the HTTP header with the given name to the given value in the given message.
|
static void |
setHttpHeader(org.restlet.data.Request request,
String headerName,
String value)
Sets the HTTP header with the given name to the given value in the given request.
|
static void |
setHttpHeader(org.restlet.util.Series<org.restlet.data.Parameter> headers,
String headerName,
String value)
Sets the HTTP header with the given name to the given value in the given header list (and removes any other
header with the same name).
|
public static final String ATTRIBUTE_HEADERS
public static org.restlet.util.Series<org.restlet.data.Parameter> getHttpHeaders(org.restlet.data.Request request)
request
- the restlet requestnull
public static org.restlet.util.Series<org.restlet.data.Parameter> getHttpHeaders(org.restlet.data.Message msg)
msg
- the restlet message (e.g. a Request or Response)null
public static org.restlet.util.Series<org.restlet.data.Parameter> getHttpHeadersForUpdate(org.restlet.data.Request request)
request
- the restlet requestnull
public static org.restlet.util.Series<org.restlet.data.Parameter> getHttpHeadersForUpdate(org.restlet.data.Message msg)
msg
- the restlet messagenull
public static String getHttpHeader(org.restlet.data.Request request, String headerName)
request
- restlet requestheaderName
- the name of the desired headernull
otherwisepublic static String getHttpHeader(org.restlet.data.Request request, String headerName, String defaultValue)
request
- restlet requestheaderName
- the name of the desired headerdefaultValue
- the defaultValue if the header value is blankpublic static String getHttpHeader(org.restlet.data.Message msg, String headerName)
msg
- restlet message (e.g. a Request or Response)headerName
- the name of the desired headernull
otherwisepublic static String getHttpHeader(org.restlet.data.Message msg, String headerName, String defaultValue)
msg
- restlet message (e.g. a Request or Response)headerName
- the name of the desired headerdefaultValue
- the defaultValue if the header value is blankpublic static String getHttpHeader(org.restlet.util.Series<org.restlet.data.Parameter> headers, String headerName)
headers
- restlet header list (may be null
)headerName
- the name of the desired headernull
otherwisepublic static String getHttpHeader(org.restlet.util.Series<org.restlet.data.Parameter> headers, String headerName, String defaultValue)
headers
- restlet header list (may be null
)headerName
- the name of the desired headerdefaultValue
- the defaultValue if the header value is blankpublic static void setHttpHeader(org.restlet.data.Request request, String headerName, String value)
request
- restlet requestheaderName
- the name of the header to modifyvalue
- the new header valuepublic static void setHttpHeader(org.restlet.data.Message msg, String headerName, String value)
msg
- restlet messageheaderName
- the name of the header to modifyvalue
- the new header valuepublic static void setHttpHeader(org.restlet.util.Series<org.restlet.data.Parameter> headers, String headerName, String value)
headers
- restlet header list (may not be null
)headerName
- the name of the header to modifyvalue
- the new header value