org.resthub.web.springmvc.router
Class HTTPRequestAdapter

java.lang.Object
  extended by org.resthub.web.springmvc.router.HTTPRequestAdapter

public class HTTPRequestAdapter
extends Object

Adapter class for HTTP class defined in Play! Framework Maps HTTPServletRequest to HTTP.Request and HTTP.Header

Author:
Brian Clozel
See Also:
Router

Nested Class Summary
 class HTTPRequestAdapter.Header
           
 
Field Summary
 String action
          Full action (ex: Application.index)
 String actionMethod
          Action method name
 Map<String,Object> args
          Free space to store your request specific data
 String contentType
          Request content-type
 String controller
          Controller to invoke
 Class controllerClass
          The invoked controller class
static ThreadLocal<HTTPRequestAdapter> current
          Bind to thread
 Date date
          When the request has been received
 String domain
          Server domain
 String format
          Format (html,xml,json,text)
 Map<String,HTTPRequestAdapter.Header> headers
          HTTP Headers
 String host
          Server host
 Method invokedMethod
          The really invoker Java methid
 String method
          HTTP method
 String path
          Request path
 Integer port
          HTTP port
 String querystring
          QueryString
 String remoteAddress
          Client address
 Map<String,String> routeArgs
          Additinal HTTP params extracted from route
 Boolean secure
          is HTTPS ?
 String url
          Full url
 
Constructor Summary
HTTPRequestAdapter(javax.servlet.http.HttpServletRequest _request)
           
 
Method Summary
 String getBase()
          Get the request base (ex: http://localhost:9000
 String getContentType()
           
 String getQueryString()
           
 boolean isSecure()
           
static HTTPRequestAdapter parseRequest(javax.servlet.http.HttpServletRequest httpServletRequest)
           
 void resolveFormat()
          Automatically resolve request format from the Accept header (in this order : html > xml > json > text)
 void setContentType(String contentType)
           
 void setFormat(String _format)
           
 void setQueryString(String queryString)
           
 void setSecure(boolean secure)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

host

public String host
Server host


path

public String path
Request path


querystring

public String querystring
QueryString


url

public String url
Full url


method

public String method
HTTP method


domain

public String domain
Server domain


remoteAddress

public String remoteAddress
Client address


contentType

public String contentType
Request content-type


controller

public String controller
Controller to invoke


actionMethod

public String actionMethod
Action method name


port

public Integer port
HTTP port


headers

public Map<String,HTTPRequestAdapter.Header> headers
HTTP Headers


routeArgs

public Map<String,String> routeArgs
Additinal 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 transient Method invokedMethod
The really invoker Java methid


controllerClass

public transient Class controllerClass
The invoked controller class


args

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


date

public Date date
When the request has been received


secure

public Boolean secure
is HTTPS ?


current

public static ThreadLocal<HTTPRequestAdapter> current
Bind to thread

Constructor Detail

HTTPRequestAdapter

public HTTPRequestAdapter(javax.servlet.http.HttpServletRequest _request)
Method Detail

setFormat

public void setFormat(String _format)

isSecure

public boolean isSecure()

setSecure

public void setSecure(boolean secure)

getContentType

public String getContentType()

setContentType

public void setContentType(String contentType)

getQueryString

public String getQueryString()

setQueryString

public void setQueryString(String queryString)

getBase

public String getBase()
Get the request base (ex: http://localhost:9000

Returns:
the request base of the url (protocol, host and port)

parseRequest

public static HTTPRequestAdapter parseRequest(javax.servlet.http.HttpServletRequest httpServletRequest)
                                       throws Exception
Throws:
Exception

resolveFormat

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



Copyright © 2010-2012. All Rights Reserved.