构造器和说明 |
---|
RouteContext() |
RouteContext(Request request,
Response response) |
限定符和类型 | 方法和说明 |
---|---|
void |
abort() |
String |
address()
Get client ip address
|
RouteContext |
attribute(String key,
Object value)
Setting Request Attribute
|
RouteContext |
badRequest()
Set current response http code 400
|
Body |
body()
Get current response body
|
RouteContext |
body(Body body)
Send body to client
|
String |
bodyToString()
Get current request body as string
|
String |
contentType()
Get current request contentType. e.g: "text/html; charset=utf-8"
|
RouteContext |
contentType(String contentType)
Setting Response ContentType
|
String |
cookie(String name)
Get String Cookie Value
|
RouteContext |
cookie(String name,
String value)
Add Cookie
|
RouteContext |
cookie(String name,
String value,
int maxAge)
Setting Cookie
|
Integer |
fromInt(String paramName)
Returns a request parameter for a Int type
|
Integer |
fromInt(String paramName,
Integer defaultValue)
Returns a request parameter for a Int type
|
Long |
fromLong(String paramName)
Returns a request parameter for a Long type
|
Long |
fromLong(String paramName,
Long defaultValue)
Returns a request parameter for a Long type
|
String |
fromString(String paramName)
Get a request parameter
|
String |
fromString(String paramName,
String defaultValue)
Get a request parameter, if NULL is returned to defaultValue
|
String |
header(String headerName)
Get header information
|
RouteContext |
header(String name,
String value)
Set current response header
|
Map<String,String> |
headers()
Get current request headers.
|
RouteContext |
html(String html)
Render by html
|
void |
initRoute(Route route) |
void |
injectParameters() |
boolean |
isAbort() |
boolean |
isIE()
Gets the current request is the head of the IE browser
|
RouteContext |
json(Object bean)
Render by json
|
RouteContext |
json(String json)
Render by json
|
boolean |
keepAlive()
Get current request is KeepAlive, HTTP1.1 is true.
|
String |
method()
Get current request http method. e.g: GET
|
boolean |
next() |
Map<String,List<String>> |
parameters()
Get current request query parameters
|
Integer |
pathInt(String paramName)
Return a URL parameter for a Int type
|
Long |
pathLong(String paramName)
Return a URL parameter for a Long type
|
String |
pathString(String paramName)
Get a URL parameter
|
void |
redirect(String newUri)
Redirect to newUri
|
String |
remoteAddress()
Get client remote address. e.g: 102.331.234.11:38227
|
RouteContext |
render(ModelAndView modelAndView)
Render view And Setting Data, can be modified after WebHook
|
RouteContext |
render(String view)
Render view, can be modified after WebHook
|
Request |
request()
Get request instance
|
Response |
response()
Get response instance
|
Route |
route()
Get current request route instance
|
Method |
routeAction()
Get current request route method
|
Object[] |
routeParameters()
Get current route method parameters
|
Object |
routeTarget()
Get current request route target instance
|
Session |
session()
Get current request session, if null then create
|
RouteContext |
status(int statusCode)
Setting Response Status
|
Class<?> |
targetType()
Get current request route target type
|
RouteContext |
text(String text)
Render by text
|
String |
uri()
Get request uri
|
String |
userAgent()
Get request user-agent
|
public String method()
public String uri()
public boolean keepAlive()
public Session session()
public boolean isIE()
public String header(String headerName)
headerName
- Parameter namepublic RouteContext attribute(String key, Object value)
key
- attribute namevalue
- attribute Valuepublic String fromString(String paramName)
paramName
- Parameter namepublic String fromString(String paramName, String defaultValue)
paramName
- parameter namedefaultValue
- default String valuepublic Integer fromInt(String paramName)
paramName
- Parameter namepublic Integer fromInt(String paramName, Integer defaultValue)
paramName
- Parameter namedefaultValue
- default int valuepublic Long fromLong(String paramName)
paramName
- Parameter namepublic Long fromLong(String paramName, Long defaultValue)
paramName
- Parameter namedefaultValue
- default long valuepublic String pathString(String paramName)
paramName
- Parameter namepublic Integer pathInt(String paramName)
paramName
- Parameter namepublic Long pathLong(String paramName)
paramName
- Parameter namepublic String userAgent()
public String address()
public String remoteAddress()
public String cookie(String name)
name
- cookie namepublic Map<String,String> headers()
public Map<String,List<String>> parameters()
public String contentType()
public String bodyToString()
public RouteContext contentType(String contentType)
contentType
- content typepublic RouteContext status(int statusCode)
statusCode
- status codepublic RouteContext header(String name, String value)
name
- Header Namevalue
- Header Valuepublic RouteContext badRequest()
public RouteContext render(String view)
view
- view pagepublic RouteContext render(ModelAndView modelAndView)
modelAndView
- ModelAndView objectpublic RouteContext text(String text)
text
- text contentpublic RouteContext json(String json)
json
- json contentpublic RouteContext json(Object bean)
bean
- bean instancepublic RouteContext html(String html)
html
- html contentpublic RouteContext body(Body body)
body
- Body
public RouteContext cookie(String name, String value)
name
- Cookie Namevalue
- Cookie Valuepublic RouteContext cookie(String name, String value, int maxAge)
name
- Cookie Namevalue
- Cookie ValuemaxAge
- Period of validitypublic void redirect(String newUri)
newUri
- new urlpublic boolean next()
public Class<?> targetType()
public Object routeTarget()
public Method routeAction()
public Object[] routeParameters()
public void abort()
public boolean isAbort()
public void initRoute(Route route)
public void injectParameters()
Copyright © 2018. All rights reserved.