Package play.mvc

Class Http.Request

java.lang.Object
play.mvc.Http.Request
Enclosing class:
Http

public static class Http.Request extends Object
  • Field Details

    • host

      public String host
    • path

      public String path
    • querystring

      public String querystring
    • url

      public 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 String method
    • domain

      public String domain
    • remoteAddress

      public String remoteAddress
    • contentType

      public String contentType
    • encoding

      public 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 String controller
    • actionMethod

      public String actionMethod
    • port

      public Integer port
    • headers

      public Map<String,Http.Header> headers
    • cookies

      public Map<String,Http.Cookie> cookies
    • body

      public transient InputStream body
    • routeArgs

      public Map<String,String> routeArgs
      Additional HTTP params extracted from route
    • format

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

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

      public Method invokedMethod
    • controllerClass

      public Class<? extends PlayController> controllerClass
    • controllerInstance

      public PlayController controllerInstance
    • args

      public final Map<String,Object> args
      Free space to store your request specific data
    • date

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

      public String user
      HTTP Basic User
    • password

      public String password
      HTTP Basic Password
    • isLoopback

      public boolean isLoopback
      Request comes from loopback interface
    • params

      @Nonnull public final Scope.Params params
    • cachedIsSecure

      public Boolean cachedIsSecure
  • Constructor Details

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

    • createRequest

      public static Http.Request createRequest(String _remoteAddress, String _method, String _path, String _querystring, String _contentType, InputStream _body, String _url, String _host, boolean _isLoopback, int _port, String _domain, Map<String,Http.Header> _headers, Map<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 String getUserAgent()
    • getBase

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

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

      public List<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(String etag, long last)
    • setCookie

      public void setCookie(String key, String value)
    • setHeader

      public void setHeader(String key, String value)
    • getActionAnnotation

      public <T extends Annotation> T getActionAnnotation(Class<T> annotationClass)