Package play.mvc

Class Http.Request

  • Enclosing class:
    Http

    public static class Http.Request
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.String action
      Full action (ex: Application.index)
      java.lang.String actionMethod  
      java.util.Map<java.lang.String,​java.lang.Object> args
      Free space to store your request specific data
      java.io.InputStream body  
      java.lang.Boolean cachedIsSecure  
      java.lang.String contentType  
      java.lang.String controller  
      java.lang.Class<? extends PlayController> controllerClass  
      PlayController controllerInstance  
      java.util.Map<java.lang.String,​Http.Cookie> cookies  
      java.util.Date date
      When the request has been received
      java.lang.String domain  
      java.nio.charset.Charset encoding
      This is the encoding used to decode this request.
      java.lang.String format
      Format (html,xml,json,text)
      java.util.Map<java.lang.String,​Http.Header> headers  
      java.lang.String host  
      java.lang.reflect.Method invokedMethod  
      boolean isLoopback
      Request comes from loopback interface
      java.lang.String method  
      Scope.Params params  
      java.lang.String password
      HTTP Basic Password
      java.lang.String path  
      java.lang.Integer port  
      java.lang.String querystring  
      java.lang.String remoteAddress  
      java.util.Map<java.lang.String,​java.lang.String> routeArgs
      Additional HTTP params extracted from route
      java.lang.String url
      URL path (excluding scheme, host and port), starting with '/'
      Example:
      With this full URL http://localhost:9000/path0/path1?foo=bar
      => url will be /path0/path1?foo=bar
      java.lang.String user
      HTTP Basic User
    • Constructor Summary

      Constructors 
      Constructor Description
      Request()
      Deprecated.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.String> acceptLanguage()
      Return the languages requested by the browser, ordered by preference (preferred first).
      protected void authorizationInit()  
      static Http.Request createRequest​(java.lang.String _remoteAddress, java.lang.String _method, java.lang.String _path, java.lang.String _querystring, java.lang.String _contentType, java.io.InputStream _body, java.lang.String _url, java.lang.String _host, boolean _isLoopback, int _port, java.lang.String _domain, java.util.Map<java.lang.String,​Http.Header> _headers, java.util.Map<java.lang.String,​Http.Cookie> _cookies)  
      static Http.Request current()
      Deprecated.
      <T extends java.lang.annotation.Annotation>
      T
      getActionAnnotation​(java.lang.Class<T> annotationClass)  
      java.lang.String getBase()
      Get the request base (e.g.: http://localhost:9000)
      java.lang.String getUserAgent()  
      boolean isAjax()
      This request was sent by an Ajax framework.
      boolean isModified​(java.lang.String etag, long last)  
      boolean isSecure()  
      static void removeCurrent()  
      void resolveFormat()
      Automatically resolve request format from the Accept header (in this order: html > xml > json > text)
      void setCookie​(java.lang.String key, java.lang.String value)  
      static void setCurrent​(Http.Request request)
      Deprecated.
      void setHeader​(java.lang.String key, java.lang.String value)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • host

        public java.lang.String host
      • path

        public java.lang.String path
      • querystring

        public java.lang.String querystring
      • url

        public java.lang.String url
        URL path (excluding scheme, host and port), starting with '/'
        Example:
        With this full URL http://localhost:9000/path0/path1?foo=bar
        => url will be /path0/path1?foo=bar
      • method

        public java.lang.String method
      • domain

        public java.lang.String domain
      • remoteAddress

        public java.lang.String remoteAddress
      • contentType

        public java.lang.String contentType
      • encoding

        public java.nio.charset.Charset encoding
        This is the encoding used to decode this request. If encoding-info is not found in request, then Play.defaultWebEncoding is used
      • controller

        public java.lang.String controller
      • actionMethod

        public java.lang.String actionMethod
      • port

        public java.lang.Integer port
      • headers

        public java.util.Map<java.lang.String,​Http.Header> headers
      • cookies

        public java.util.Map<java.lang.String,​Http.Cookie> cookies
      • body

        public transient java.io.InputStream body
      • routeArgs

        public java.util.Map<java.lang.String,​java.lang.String> routeArgs
        Additional HTTP params extracted from route
      • format

        public java.lang.String format
        Format (html,xml,json,text)
      • action

        public java.lang.String action
        Full action (ex: Application.index)
      • invokedMethod

        public java.lang.reflect.Method invokedMethod
      • controllerClass

        public java.lang.Class<? extends PlayController> controllerClass
      • args

        public final java.util.Map<java.lang.String,​java.lang.Object> args
        Free space to store your request specific data
      • date

        public final java.util.Date date
        When the request has been received
      • user

        public java.lang.String user
        HTTP Basic User
      • password

        public java.lang.String password
        HTTP Basic Password
      • isLoopback

        public boolean isLoopback
        Request comes from loopback interface
      • cachedIsSecure

        public java.lang.Boolean cachedIsSecure
    • Constructor Detail

      • Request

        @Deprecated
        public Request()
        Deprecated.
        Deprecate the default constructor to encourage the use of createRequest() when creating new requests. Cannot hide it with protected because we have to be backward compatible with modules - ie PlayGrizzlyAdapter.java
    • Method Detail

      • createRequest

        public static Http.Request createRequest​(java.lang.String _remoteAddress,
                                                 java.lang.String _method,
                                                 java.lang.String _path,
                                                 java.lang.String _querystring,
                                                 java.lang.String _contentType,
                                                 java.io.InputStream _body,
                                                 java.lang.String _url,
                                                 java.lang.String _host,
                                                 boolean _isLoopback,
                                                 int _port,
                                                 java.lang.String _domain,
                                                 java.util.Map<java.lang.String,​Http.Header> _headers,
                                                 java.util.Map<java.lang.String,​Http.Cookie> _cookies)
      • isSecure

        public boolean isSecure()
      • authorizationInit

        protected void authorizationInit()
      • resolveFormat

        public void resolveFormat()
        Automatically resolve request format from the Accept header (in this order: html > xml > json > text)
      • current

        @Deprecated
        public static Http.Request current()
        Deprecated.
        Retrieve the current request
        Returns:
        the current request
      • setCurrent

        @Deprecated
        public static void setCurrent​(Http.Request request)
        Deprecated.
      • removeCurrent

        public static void removeCurrent()
      • isAjax

        public boolean isAjax()
        This request was sent by an Ajax framework. (rely on the X-Requested-With header).
        Returns:
        True is the request is an Ajax, false otherwise
      • getUserAgent

        @Nullable
        public java.lang.String getUserAgent()
      • getBase

        @Nonnull
        public java.lang.String getBase()
        Get the request base (e.g.: http://localhost:9000)
        Returns:
        the request base of the url (protocol, host and port)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • acceptLanguage

        public java.util.List<java.lang.String> acceptLanguage()
        Return the languages requested by the browser, ordered by preference (preferred first). If no Accept-Language header is present, an empty list is returned.
        Returns:
        Language codes in order of preference, e.g. "en-us,en-gb,en,de".
      • isModified

        public boolean isModified​(java.lang.String etag,
                                  long last)
      • setCookie

        public void setCookie​(java.lang.String key,
                              java.lang.String value)
      • setHeader

        public void setHeader​(java.lang.String key,
                              java.lang.String value)
      • getActionAnnotation

        public <T extends java.lang.annotation.Annotation> T getActionAnnotation​(java.lang.Class<T> annotationClass)