public abstract class ServletUtil extends Object
RequestHeaderUtil
Modifier and Type | Field and Description |
---|---|
static String |
ERROR_REQUEST_STATUS_CODE_ATTRIBUTE |
static String |
FORWARD_QUERY_STRING_ATTRIBUTE |
static String |
FORWARD_REQUEST_URI_ATTRIBUTE |
static String |
INCLUDE_CONTEXT_PATH_ATTRIBUTE |
static String |
INCLUDE_REQUEST_URI_ATTRIBUTE |
Constructor and Description |
---|
ServletUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
getContextPath(javax.servlet.http.HttpServletRequest request) |
static String |
getContextRelativePath(javax.servlet.http.HttpServletRequest request)
Returns the current path relative to the context path, the current path is the path used in the latest forward or
include dispatch.
|
static DispatcherType |
getDispatcherType(javax.servlet.http.HttpServletRequest request)
Returns the dispatcher type of the request, the dispatcher type is defined to be identical to the semantics of
filter mappings in web.xml.
|
static String |
getOriginalRequestURI(javax.servlet.http.HttpServletRequest request)
Returns the original request uri.
|
static String |
getOriginalRequestURLIncludingQueryString(javax.servlet.http.HttpServletRequest request)
Returns the original request url.
|
static String |
getRequestUri(javax.servlet.http.HttpServletRequest request)
Returns the request uri for the request.
|
static <T extends javax.servlet.ServletRequest> |
getWrappedRequest(javax.servlet.ServletRequest request,
Class<T> clazz)
Finds a request wrapper object inside the chain of request wrappers.
|
static LinkedHashMap<String,String> |
initParametersToMap(javax.servlet.FilterConfig config)
Returns the init parameters for a
FilterConfig object as a Map, preserving the order in which they are exposed
by the FilterConfig object. |
static LinkedHashMap<String,String> |
initParametersToMap(javax.servlet.ServletConfig config)
Returns the init parameters for a
ServletConfig object as a Map, preserving the order in which they are exposed
by the ServletConfig object. |
static boolean |
isError(javax.servlet.http.HttpServletRequest request)
Returns true if the request is rendering an error page, either due to a call to sendError() or an exception
being thrown in a filter or a servlet that reached the container.
|
static boolean |
isForward(javax.servlet.http.HttpServletRequest request)
Returns true if the request is currently processing a forward operation.
|
static boolean |
isInclude(javax.servlet.http.HttpServletRequest request)
Returns true if the request is currently processing an include operation.
|
static boolean |
isMultipart(javax.servlet.http.HttpServletRequest request)
Returns true if the request has a content type that indicates that is a multipart request.
|
static String |
stripPathParameters(String uri)
Strips path parameters from a URI.
|
public static final String FORWARD_REQUEST_URI_ATTRIBUTE
public static final String FORWARD_QUERY_STRING_ATTRIBUTE
public static final String INCLUDE_REQUEST_URI_ATTRIBUTE
public static final String INCLUDE_CONTEXT_PATH_ATTRIBUTE
public static final String ERROR_REQUEST_STATUS_CODE_ATTRIBUTE
public static LinkedHashMap<String,String> initParametersToMap(javax.servlet.ServletConfig config)
ServletConfig
object as a Map, preserving the order in which they are exposed
by the ServletConfig
object.public static LinkedHashMap<String,String> initParametersToMap(javax.servlet.FilterConfig config)
FilterConfig
object as a Map, preserving the order in which they are exposed
by the FilterConfig
object.public static <T extends javax.servlet.ServletRequest> T getWrappedRequest(javax.servlet.ServletRequest request, Class<T> clazz)
public static boolean isMultipart(javax.servlet.http.HttpServletRequest request)
public static boolean isForward(javax.servlet.http.HttpServletRequest request)
public static boolean isInclude(javax.servlet.http.HttpServletRequest request)
public static boolean isError(javax.servlet.http.HttpServletRequest request)
public static DispatcherType getDispatcherType(javax.servlet.http.HttpServletRequest request)
public static String getOriginalRequestURI(javax.servlet.http.HttpServletRequest request)
public static String getOriginalRequestURLIncludingQueryString(javax.servlet.http.HttpServletRequest request)
public static String getRequestUri(javax.servlet.http.HttpServletRequest request)
public static String stripPathParameters(String uri)
JSESSIONID
path parameter.public static String getContextRelativePath(javax.servlet.http.HttpServletRequest request)
public static String getContextPath(javax.servlet.http.HttpServletRequest request)
Copyright © 2003–2018 Magnolia International Ltd.. All rights reserved.