Class WebRequest
- All Implemented Interfaces:
javax.servlet.http.HttpServletRequest,javax.servlet.ServletRequest
WebRequest is used instead of HttpServletRequest inside JWt's request handling,
and also in WResource.handleRequest(WebRequest request, WebResponse response).
It handles files being POST'ed, and treats parameters in the URL or within the
request body in the same way.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceProgress listener interface.static enumEnumeration for a WebSocket read event (not yet implemented).static enumThe type of response that this request will need. -
Field Summary
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH -
Constructor Summary
ConstructorsConstructorDescriptionWebRequest(Map<String, String[]> parameters, Map<String, List<eu.webtoolkit.jwt.servlet.UploadedFile>> files) Creates a mock WebRequest given list of parameters and a list of POST'ed files.WebRequest(javax.servlet.http.HttpServletRequest request, WebRequest.ProgressListener progressListener, Configuration configuration) Creates a WebRequest by wrapping an HttpServletRequest -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcomputePathInfo(javax.servlet.http.HttpServletRequest request, Configuration configuration) static StringcomputePathInfo(javax.servlet.http.HttpServletRequest request, String scriptName, Configuration configuration) static StringcomputeScriptName(javax.servlet.http.HttpServletRequest request, Configuration configuration) getHeaderValue(String header) Returns a header value.getHostName(Configuration conf) getParameter(String name) Returns the parameter value for a parameter's name.Returns the parameter map.String[]getParameterValues(String name) Returns the parameter values for a parameter.Returns the internal path information.Returns the request method.Returns the script name.Returns the list of uploaded files.getUrlScheme(Configuration conf) Accesses to specific header fields (calls getHeaderValue()).booleanReturns whether this request is a WebSocket message.booleanReturns whether this request is a WebSocket request.protected voidreadParameters(byte[] buf) Read and store query parametersMethods inherited from class javax.servlet.http.HttpServletRequestWrapper
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgradeMethods inherited from class javax.servlet.ServletRequestWrapper
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterNames, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsyncMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.servlet.ServletRequest
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterNames, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
-
Constructor Details
-
WebRequest
public WebRequest(javax.servlet.http.HttpServletRequest request, WebRequest.ProgressListener progressListener, Configuration configuration) Creates a WebRequest by wrapping an HttpServletRequest- Parameters:
request- The request to be wrapped.progressListener- a progress listener implementationconfiguration-
-
WebRequest
public WebRequest(Map<String, String[]> parameters, Map<String, List<eu.webtoolkit.jwt.servlet.UploadedFile>> files) Creates a mock WebRequest given list of parameters and a list of POST'ed files.- Parameters:
parameters- a list of request parametersfiles- a list of POST'ed files
-
-
Method Details
-
computeScriptName
public static String computeScriptName(javax.servlet.http.HttpServletRequest request, Configuration configuration) -
computePathInfo
public static String computePathInfo(javax.servlet.http.HttpServletRequest request, Configuration configuration) -
computePathInfo
public static String computePathInfo(javax.servlet.http.HttpServletRequest request, String scriptName, Configuration configuration) -
getRequestMethod
Returns the request method. -
getScriptName
Returns the script name.This returns in principle
HttpServletRequestWrapper.getContextPath()+HttpServletRequestWrapper.getServletPath(), but with workaround code for corner cases and container workarounds.- Returns:
- the url at which the application is deployed
-
getHeaderValue
Returns a header value.Returns the corresponding header value, using
HttpServletRequestWrapper.getHeader(String)ornullif the header value is not present- Parameters:
header- the header name- Returns:
- the header value, or
null.
-
getUserAgent
Accesses to specific header fields (calls getHeaderValue()). -
getPathInfo
Returns the internal path information.Returns the
HttpServletRequestWrapper.getPathInfo()or the empty string if there is no internal path in the request. This method also uses workarounds for corner cases for some servlet containers.- Specified by:
getPathInfoin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getPathInfoin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- the internal path information, or an empty string if there is no internal path.
-
readParameters
protected void readParameters(byte[] buf) Read and store query parameters- Parameters:
buf- UTF-8 encoded byte array with the URI query part
-
getUploadedFiles
Returns the list of uploaded files.- Returns:
- the list of uploaded files.
-
getParameterMap
Returns the parameter map.The parameter map includes both the parameters from the query string, as well as parameters posted in the body.
- Specified by:
getParameterMapin interfacejavax.servlet.ServletRequest- Overrides:
getParameterMapin classjavax.servlet.ServletRequestWrapper
-
getParameterValues
Returns the parameter values for a parameter.Returns an array of parameters values given for a particular parameter. When no parameter value was assigned to the parameter, an empty array is returned.
- Specified by:
getParameterValuesin interfacejavax.servlet.ServletRequest- Overrides:
getParameterValuesin classjavax.servlet.ServletRequestWrapper- See Also:
-
getParameter
Returns the parameter value for a parameter's name.- Specified by:
getParameterin interfacejavax.servlet.ServletRequest- Overrides:
getParameterin classjavax.servlet.ServletRequestWrapper- See Also:
-
isWebSocketRequest
public boolean isWebSocketRequest()Returns whether this request is a WebSocket request. This is an internal JWt method. -
isWebSocketMessage
public boolean isWebSocketMessage()Returns whether this request is a WebSocket message. This is an internal JWt method. -
getClientAddress
-
getHostName
-
getUrlScheme
-