public class ExtDirectResponseBuilder extends Object
ServletResponse.getOutputStream() with
buildAndWrite().| Constructor and Description |
|---|
ExtDirectResponseBuilder(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Creates a builder that builds and writes the response of a FORM_POST method.
|
| Modifier and Type | Method and Description |
|---|---|
ExtDirectResponseBuilder |
addErrors(org.springframework.validation.BindingResult bindingResult)
Adds an "errors" property in the response if there are any errors in the
bindingResult.
|
ExtDirectResponseBuilder |
addErrors(Locale locale,
org.springframework.context.MessageSource messageSource,
org.springframework.validation.BindingResult bindingResult)
Adds an "errors" property in the response if there are any errors in the
bindingResult.
|
ExtDirectResponseBuilder |
addResultProperty(String key,
Object value)
Add additional property to the response.
|
void |
buildAndWrite()
Builds and writes the response into the OutputStream of
HttpServletResponse
. |
static ExtDirectResponseBuilder |
create(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Creates a builder instance.
|
ExtDirectResponseBuilder |
setException(Exception exception)
Creates an "exception" response.
|
void |
setJsonView(Class<?> jsonView)
Sets a specific JSON View (filter) that Jackson uses to serialize the response.
|
ExtDirectResponseBuilder |
setSuccess(boolean flag)
Sets success flag to the provided parameter.
|
ExtDirectResponseBuilder |
successful()
Sets success flag to true.
|
ExtDirectResponseBuilder |
unsuccessful()
Sets success flag to false.
|
public ExtDirectResponseBuilder(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
successful() and
unsuccessful() methods.request - the current http servlet request objectresponse - the current http servlet response objectpublic static ExtDirectResponseBuilder create(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request - the current http servlet request objectresponse - the current http servlet response objectExtDirectResponseBuilder(HttpServletRequest, HttpServletResponse)public ExtDirectResponseBuilder setException(Exception exception)
BaseResponse.setType(String)
with a value of "exception". Calls BaseResponse.setMessage(String) and
BaseResponse.setWhere(String) according to the Configuration.
This is a method primarily used for implementations of
HandlerExceptionResolver.exception - the exception that was thrown.public ExtDirectResponseBuilder addErrors(org.springframework.validation.BindingResult bindingResult)
bindingResult - public ExtDirectResponseBuilder addErrors(Locale locale, org.springframework.context.MessageSource messageSource, org.springframework.validation.BindingResult bindingResult)
locale - messageSource - bindingResult - public ExtDirectResponseBuilder addResultProperty(String key, Object value)
key - the key of the propertyvalue - the value of this propertypublic ExtDirectResponseBuilder successful()
public ExtDirectResponseBuilder unsuccessful()
public ExtDirectResponseBuilder setSuccess(boolean flag)
flag - the new success valuepublic void setJsonView(Class<?> jsonView)
jsonView - public void buildAndWrite()
HttpServletResponse
. This methods has to be called at the end of a FORM_POST method.Copyright © 2010–2017. All rights reserved.