Class 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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String getContentFileName()
      Get the name of any uploaded file that is part of this request.
      InputStream getContentParameter()
      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.
      String getParameter​(String name)  
      String[] getParameterValues​(String name)  
      Resource getResource​(String name)
      Returns a Resource corresponding to the value of the given parameter name.
      Map<String,​String> getSingleParameterMap()
      Gets a map of the all parameters with values, also caching them in this WorkbenchRequest.
      String getTypeParameter()
      Gets the value of the 'type' parameter.
      IRI getURI​(String name)
      Gets the URI referred to by the parameter value.
      URL getUrl​(String name)
      Gets the URL referred to by the parameter value.
      Value getValue​(String name)
      Gets the Value 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 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 Detail

      • WorkbenchRequest

        public WorkbenchRequest​(Repository repository,
                                javax.servlet.http.HttpServletRequest request,
                                Map<String,​String> defaults)
                         throws RepositoryException,
                                IOException,
                                org.apache.commons.fileupload.FileUploadException
        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
        org.apache.commons.fileupload.FileUploadException - if there is an issue retrieving the parameter map
    • Method Detail

      • 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
      • 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
      • 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