public class HttpServerUtil extends Object
| Constructor and Description |
|---|
HttpServerUtil() |
| Modifier and Type | Method and Description |
|---|---|
static List<HeaderElement> |
getHeaderElements(javax.servlet.http.HttpServletRequest request,
String headerName)
Gets the elements of the request header with the specified name.
|
static String |
getMIMEType(String contentType)
Extracts the MIME type from the specified content type string.
|
static String |
getPostDataParameter(Map<String,Object> formData,
String name)
Gets the trimmed value of a request parameter as a String.
|
static boolean |
isEmpty(String string) |
static boolean |
isFalse(String string) |
static boolean |
isTrue(String string) |
static HeaderElement |
matchAcceptHeader(String mimeTypeSpec,
List<HeaderElement> acceptElements)
Tries to match the specified MIME type spec against the list of Accept header elements, returning the applicable
header element if available.
|
static String |
selectPreferredMIMEType(Iterator<String> mimeTypes,
javax.servlet.http.HttpServletRequest request)
Selects from a set of MIME types, the MIME type that has the highest quality score when matched with the Accept
headers in the supplied request.
|
static List<String> |
splitHeaderString(String s,
char splitChar)
Splits the supplied string into sub parts using the specified splitChar as a separator, ignoring occurrences of
this character inside quoted strings.
|
public static String getMIMEType(String contentType)
contentType - A content type string, e.g. application/xml; charset=utf-8 .public static String selectPreferredMIMEType(Iterator<String> mimeTypes, javax.servlet.http.HttpServletRequest request)
mimeTypes - The set of available MIME types.request - The request to match the MIME types against.public static List<HeaderElement> getHeaderElements(javax.servlet.http.HttpServletRequest request, String headerName)
request - The request to get the header from.headerName - The name of the header to get the elements of.HeaderElement objects.public static List<String> splitHeaderString(String s, char splitChar)
s - The header string to split into sub parts.splitChar - The character to use as separator.public static HeaderElement matchAcceptHeader(String mimeTypeSpec, List<HeaderElement> acceptElements)
mimeTypeSpec - The MIME type to determine the quality for, e.g. "text/plain" or "application/xml;
charset=utf-8".acceptElements - A List of HeaderElement objects.public static String getPostDataParameter(Map<String,Object> formData, String name)
public static boolean isEmpty(String string)
public static boolean isTrue(String string)
public static boolean isFalse(String string)
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.