Class OAuthServerRequest

  • All Implemented Interfaces:
    OAuth1Request

    public class OAuthServerRequest
    extends java.lang.Object
    implements OAuth1Request
    Wraps a Jersey ContainerRequestContext object, implementing the OAuth signature library OAuth1Request interface.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private javax.ws.rs.container.ContainerRequestContext context  
      private static java.util.List<java.lang.String> EMPTY_LIST  
      private static java.util.Set<java.lang.String> EMPTY_SET  
      private Value<javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String>> formParams  
    • Constructor Summary

      Constructors 
      Constructor Description
      OAuthServerRequest​(javax.ws.rs.container.ContainerRequestContext context)
      Create a new instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addHeaderValue​(java.lang.String name, java.lang.String value)
      Adds a header with the given name and value.
      java.util.List<java.lang.String> getHeaderValues​(java.lang.String name)
      Returns the value(s) of the specified request header.
      java.util.Set<java.lang.String> getParameterNames()
      Returns an Set of String objects containing the names of the parameters contained in the request.
      java.util.List<java.lang.String> getParameterValues​(java.lang.String name)
      Returns an List of String objects containing the values of the specified request parameter, or null if the parameter does not exist.
      java.lang.String getRequestMethod()
      Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
      java.net.URL getRequestURL()
      Returns the URL of the request, including protocol, server name, optional port number, and server path.
      private static java.util.Set<java.lang.String> keys​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> mvm)  
      private static java.util.List<java.lang.String> values​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> mvm, java.lang.String key)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • context

        private final javax.ws.rs.container.ContainerRequestContext context
      • EMPTY_SET

        private static java.util.Set<java.lang.String> EMPTY_SET
      • EMPTY_LIST

        private static java.util.List<java.lang.String> EMPTY_LIST
      • formParams

        private final Value<javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String>> formParams
    • Constructor Detail

      • OAuthServerRequest

        public OAuthServerRequest​(javax.ws.rs.container.ContainerRequestContext context)
        Create a new instance.
        Parameters:
        context - Container request context.
    • Method Detail

      • getRequestMethod

        public java.lang.String getRequestMethod()
        Description copied from interface: OAuth1Request
        Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
        Specified by:
        getRequestMethod in interface OAuth1Request
        Returns:
        the name of the method with which this request was made.
      • getRequestURL

        public java.net.URL getRequestURL()
        Description copied from interface: OAuth1Request
        Returns the URL of the request, including protocol, server name, optional port number, and server path.
        Specified by:
        getRequestURL in interface OAuth1Request
        Returns:
        the request URL.
      • keys

        private static java.util.Set<java.lang.String> keys​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> mvm)
      • values

        private static java.util.List<java.lang.String> values​(javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> mvm,
                                                               java.lang.String key)
      • getParameterNames

        public java.util.Set<java.lang.String> getParameterNames()
        Description copied from interface: OAuth1Request
        Returns an Set of String objects containing the names of the parameters contained in the request.
        Specified by:
        getParameterNames in interface OAuth1Request
        Returns:
        the names of the parameters.
      • getParameterValues

        public java.util.List<java.lang.String> getParameterValues​(java.lang.String name)
        Description copied from interface: OAuth1Request
        Returns an List of String objects containing the values of the specified request parameter, or null if the parameter does not exist. For HTTP requests, parameters are contained in the query string and/or posted form data.
        Specified by:
        getParameterValues in interface OAuth1Request
        Parameters:
        name - the name of the parameter.
        Returns:
        the values of the parameter.
      • getHeaderValues

        public java.util.List<java.lang.String> getHeaderValues​(java.lang.String name)
        Description copied from interface: OAuth1Request
        Returns the value(s) of the specified request header. If the request did not include a header of the specified name, this method returns null.
        Specified by:
        getHeaderValues in interface OAuth1Request
        Parameters:
        name - the header name.
        Returns:
        the value(s) of the requested header, or null if none exist.
      • addHeaderValue

        public void addHeaderValue​(java.lang.String name,
                                   java.lang.String value)
                            throws java.lang.IllegalStateException
        Description copied from interface: OAuth1Request
        Adds a header with the given name and value.
        Specified by:
        addHeaderValue in interface OAuth1Request
        Parameters:
        name - the name of the header.
        value - the header value.
        Throws:
        java.lang.IllegalStateException - if this method cannot be implemented.