Package org.eclipse.rdf4j.workbench.util
Class WorkbenchRequest
java.lang.Object
javax.servlet.ServletRequestWrapper
javax.servlet.http.HttpServletRequestWrapper
org.eclipse.rdf4j.workbench.util.WorkbenchRequest
- All Implemented Interfaces:
javax.servlet.http.HttpServletRequest
,javax.servlet.ServletRequest
public class WorkbenchRequest
extends javax.servlet.http.HttpServletRequestWrapper
Request wrapper used by
TransformationServlet
.-
Field Summary
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
-
Constructor Summary
ConstructorDescriptionWorkbenchRequest
(Repository repository, javax.servlet.http.HttpServletRequest request, Map<String, String> defaults) Wrap a request with an object aware of the current repository and application defaults. -
Method Summary
Modifier and TypeMethodDescriptionGet the name of any uploaded file that is part of this request.Get the content of any uploaded file that is part of this request.int
Get the integer value associated with the given parameter name.getParameter
(String name) String[]
getParameterValues
(String name) getResource
(String name) Returns aResource
corresponding to the value of the given parameter name.Gets a map of the all parameters with values, also caching them in thisWorkbenchRequest
.Gets the value of the 'type' parameter.Gets the URI referred to by the parameter value.Gets the URL referred to by the parameter value.Gets theValue
referred to by the parameter value.boolean
isParameterPresent
(String name) Returns whether a non-null, non-empty value is available for the given parameter name.Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole, login, logout, upgrade
Methods inherited from class javax.servlet.ServletRequestWrapper
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterMap, getParameterNames, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsync
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.servlet.ServletRequest
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterMap, getParameterNames, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
-
Constructor Details
-
WorkbenchRequest
public WorkbenchRequest(Repository repository, javax.servlet.http.HttpServletRequest request, Map<String, String> defaults) throws RepositoryException, IOException, javax.servlet.ServletExceptionWrap a request with an object aware of the current repository and application defaults.- Parameters:
repository
- currently connected repositoryrequest
- current requestdefaults
- application default parameter values- Throws:
RepositoryException
- if there is an issue retrieving the parameter mapIOException
- if there is an issue retrieving the parameter mapjavax.servlet.ServletException
- if there is an issue retrieving the parameter map
-
-
Method Details
-
getContentParameter
Get the content of any uploaded file that is part of this request.- Returns:
- the uploaded file contents, or null if not applicable
-
getContentFileName
Get the name of any uploaded file that is part of this request.- Returns:
- the uploaded file name, or null if not applicable
-
getInt
Get the integer value associated with the given parameter name. Internally uses getParameter(String), so looks in this order: 1. the query parameters that were parsed at construction, using the last value if multiple exist. 2. Request cookies. 3. The defaults.- Returns:
- the value of the parameter, or zero if it is not present
- Throws:
BadRequestException
- if the parameter is present but does not parse as an integer
-
getParameter
- Specified by:
getParameter
in interfacejavax.servlet.ServletRequest
- Overrides:
getParameter
in classjavax.servlet.ServletRequestWrapper
-
getParameterValues
- Specified by:
getParameterValues
in interfacejavax.servlet.ServletRequest
- Overrides:
getParameterValues
in classjavax.servlet.ServletRequestWrapper
-
isParameterPresent
Returns whether a non-null, non-empty value is available for the given parameter name.- Parameters:
name
- parameter name to check- Returns:
- true if a non-null, non-empty value exists, false otherwise
-
getResource
Returns aResource
corresponding to the value of the given parameter name.- Parameters:
name
- of parameter to retrieve resource from- Returns:
- value corresponding to the given parameter name
- Throws:
BadRequestException
- if a problem occurs parsing the parameter valueRepositoryException
-
getSingleParameterMap
Gets a map of the all parameters with values, also caching them in thisWorkbenchRequest
.- Returns:
- a map of all parameters with values
-
getTypeParameter
Gets the value of the 'type' parameter.- Returns:
- the value of the 'type' parameter
-
getURI
Gets the URI referred to by the parameter value.- Parameters:
name
- of the parameter to check- Returns:
- the URI, or null if the parameter has no value, is only whitespace, or equals "null"
- Throws:
BadRequestException
- if the value doesn't parse as a URIRepositoryException
- if the name space prefix is not resolvable
-
getUrl
Gets the URL referred to by the parameter value.- Parameters:
name
- of the parameter to check- Returns:
- the URL
- Throws:
BadRequestException
- if the value doesn't parse as a URL
-
getValue
Gets theValue
referred to by the parameter value.- Parameters:
name
- of the parameter to check- Returns:
- the value, or null if the parameter has no value, is only whitespace, or equals "null"
- Throws:
BadRequestException
- if the value doesn't parse as a URIRepositoryException
- if any name space prefix is not resolvable
-