Constructor and Description |
---|
RestCall(RestContext context,
HttpServletRequest req,
HttpServletResponse res)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addPathVars(Map<String,String> vars)
Adds resolved
|
RestCall |
context(RestContext context)
Overrides the context object on this call.
|
RestCall |
debug(boolean b)
Enables or disabled debug mode on this call.
|
RestCall |
exception(Throwable e)
Identifies that an exception occurred during this call.
|
RestCall |
finish()
Called at the end of a call to finish any remaining tasks such as flushing buffers and logging the response.
|
RestContext |
getContext()
Returns the context that created this call.
|
Method |
getJavaMethod()
Returns the Java method of this call.
|
String |
getMethod()
Returns the HTTP method name.
|
Object |
getOutput()
Shortcut for calling
|
String |
getPathInfo()
Shortcut for calling
|
String |
getPathInfoUndecoded()
Same as
getPathInfo() but doesn't decode encoded characters. |
Map<String,String> |
getPathVars()
Returns resolved
|
HttpServletRequest |
getRequest()
Returns the HTTP servlet request of this REST call.
|
HttpServletResponse |
getResponse()
Returns the HTTP servlet response of this REST call.
|
RestMethodContext |
getRestMethodContext()
Returns the method context of this call.
|
RestRequest |
getRestRequest()
Returns the REST request of this REST call.
|
RestResponse |
getRestResponse()
Returns the REST response of this REST call.
|
String |
getServletPath()
Shortcut for calling
|
int |
getStatus()
Shortcut for calling
|
UrlPathInfo |
getUrlPathInfo()
Returns the request path info as a
UrlPathInfo bean. |
UrlPathPatternMatch |
getUrlPathPatternMatch()
Returns the URL path pattern match on this call.
|
boolean |
hasOutput()
Shortcut for calling
|
boolean |
isDebug()
Shortcut for calling
|
RestCall |
logger(RestCallLogger logger)
Sets the logger to use when logging this call.
|
RestCall |
loggerConfig(RestCallLoggerConfig config)
Sets the logging configuration to use when logging this call.
|
RestCall |
output(Object output)
Sets the output object to serialize as the response of this call.
|
RestCall |
request(HttpServletRequest req)
Overrides the request object on the REST call.
|
RestCall |
response(HttpServletResponse res)
Overrides the response object on the REST call.
|
RestCall |
responseMeta(ResponseBeanMeta meta)
Sets metadata about the response.
|
RestCall |
restMethodContext(RestMethodContext value)
Sets the method context on this call.
|
RestCall |
restRequest(RestRequest rreq)
Set the
RestRequest object on this REST call. |
RestCall |
restResponse(RestResponse rres)
Set the
RestResponse object on this REST call. |
RestCall |
status(int code)
Sets the HTTP status on this call.
|
RestCall |
urlPathPatternMatch(UrlPathPatternMatch urlPathPatternMatch)
Sets the URL path pattern match on this call.
|
public RestCall(RestContext context, HttpServletRequest req, HttpServletResponse res)
context
- The REST context object.req
- The incoming HTTP servlet request object.res
- The incoming HTTP servlet response object.public RestCall request(HttpServletRequest req)
req
- The new HTTP servlet request.public RestCall response(HttpServletResponse res)
res
- The new HTTP servlet response.public RestCall context(RestContext context)
context
- The context that's creating this call.public RestCall restMethodContext(RestMethodContext value)
value
- The new value.public RestCall restRequest(RestRequest rreq)
RestRequest
object on this REST call.rreq
- The RestRequest
object on this REST call.public RestCall restResponse(RestResponse rres)
RestResponse
object on this REST call.rres
- The RestResponse
object on this REST call.public HttpServletRequest getRequest()
public HttpServletResponse getResponse()
public RestRequest getRestRequest()
public RestResponse getRestResponse()
public RestMethodContext getRestMethodContext()
public Method getJavaMethod()
public void addPathVars(Map<String,String> vars)
vars
- The variables to add to this call.public Map<String,String> getPathVars()
public RestCall logger(RestCallLogger logger)
logger
- The logger to use when logging this call.public RestCall loggerConfig(RestCallLoggerConfig config)
config
- The logging configuration to use when logging this call.public RestCall debug(boolean b) throws IOException
b
- The debug flag value.IOException
- Occurs if request body could not be cached into memory.public RestCall status(int code)
code
- The status code.public RestCall exception(Throwable e)
e
- The thrown exception.public RestCall responseMeta(ResponseBeanMeta meta)
meta
- The metadata about the response.public RestCall output(Object output)
output
- The response output POJO.public RestCall urlPathPatternMatch(UrlPathPatternMatch urlPathPatternMatch)
urlPathPatternMatch
- The match pattern.public UrlPathPatternMatch getUrlPathPatternMatch()
public RestCall finish()
public String getServletPath()
public UrlPathInfo getUrlPathInfo()
UrlPathInfo
bean.UrlPathInfo
bean.public String getPathInfo()
public String getPathInfoUndecoded()
getPathInfo()
but doesn't decode encoded characters.public String getMethod()
public int getStatus()
public boolean hasOutput()
public Object getOutput()
public boolean isDebug()
public RestContext getContext()
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.