public class RequestContext
extends java.lang.Object
RouteHandler
instances.Constructor and Description |
---|
RequestContext(javax.servlet.http.HttpServletRequest request,
java.lang.String path) |
Modifier and Type | Method and Description |
---|---|
GatewayContext |
getGatewayContext() |
HttpMethod |
getMethod()
Returns the HttpMethod of the request
|
java.lang.String |
getParameter(java.lang.String name)
Fetch a named parameter.
|
java.lang.String |
getPath()
Returns the URL path that that matched the route.
|
javax.servlet.http.HttpServletRequest |
getRequest()
The underlying web request
|
void |
putParameter(java.lang.String name,
java.lang.String value) |
java.lang.String |
readBody() |
public RequestContext(javax.servlet.http.HttpServletRequest request, java.lang.String path)
public GatewayContext getGatewayContext()
public javax.servlet.http.HttpServletRequest getRequest()
public java.lang.String getPath()
public HttpMethod getMethod()
public java.lang.String readBody() throws java.io.IOException
java.io.IOException
public java.lang.String getParameter(java.lang.String name)
Fetch a named parameter. First this will match any parameters that were part of the route's named parameters. For example, if your route was /widgets/:id you may call getParameter("id") and it will return the value from the request URL that matched the :id parameter.
If it does not match a route parameter, it will delegate to the internal HttpServletRequest's parameter map, which comes from the URL's query string or post parameters.
name
- public void putParameter(java.lang.String name, java.lang.String value)