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

    Constructors
    Constructor
    Description
    WorkbenchRequest(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 Type
    Method
    Description
    Get 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
    getInt(String name)
    Get the integer value associated with the given parameter name.
     
     
    Returns a Resource corresponding to the value of the given parameter name.
    Gets a map of the all parameters with values, also caching them in this WorkbenchRequest.
    Gets the value of the 'type' parameter.
    getURI(String name)
    Gets the URI referred to by the parameter value.
    getUrl(String name)
    Gets the URL referred to by the parameter value.
    Gets the Value referred to by the parameter value.
    boolean
    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.ServletException
      Wrap a request with an object aware of the current repository and application defaults.
      Parameters:
      repository - currently connected repository
      request - current request
      defaults - application default parameter values
      Throws:
      RepositoryException - if there is an issue retrieving the parameter map
      IOException - if there is an issue retrieving the parameter map
      javax.servlet.ServletException - if there is an issue retrieving the parameter map
  • Method Details

    • getContentParameter

      public InputStream 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

      public String 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

      public int getInt(String name) throws BadRequestException
      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

      public String getParameter(String name)
      Specified by:
      getParameter in interface javax.servlet.ServletRequest
      Overrides:
      getParameter in class javax.servlet.ServletRequestWrapper
    • getParameterValues

      public String[] getParameterValues(String name)
      Specified by:
      getParameterValues in interface javax.servlet.ServletRequest
      Overrides:
      getParameterValues in class javax.servlet.ServletRequestWrapper
    • isParameterPresent

      public boolean isParameterPresent(String name)
      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

      public Resource getResource(String name) throws BadRequestException, RepositoryException
      Returns a Resource 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 value
      RepositoryException
    • getSingleParameterMap

      public Map<String,String> getSingleParameterMap()
      Gets a map of the all parameters with values, also caching them in this WorkbenchRequest.
      Returns:
      a map of all parameters with values
    • getTypeParameter

      public String getTypeParameter()
      Gets the value of the 'type' parameter.
      Returns:
      the value of the 'type' parameter
    • getURI

      public IRI getURI(String name) throws BadRequestException, RepositoryException
      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 URI
      RepositoryException - if the name space prefix is not resolvable
    • getUrl

      public URL getUrl(String name) throws BadRequestException
      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

      public Value getValue(String name) throws BadRequestException, RepositoryException
      Gets the Value 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 URI
      RepositoryException - if any name space prefix is not resolvable