public class SpincastResponseRequestContextAddon<R extends IRequestContext<?>> extends Object implements IResponseRequestContextAddon<R>
| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
IS_RESPONSE_CHARACTERS_BASED_BY_DEFAULT |
protected org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
SpincastResponseRequestContextAddon(R requestContext,
IServer server,
IJsonManager jsonManager,
IXmlManager xmlManager,
ISpincastConfig spincastConfig,
ISpincastUtils spincastUtils,
IETagFactory etagFactory) |
| Modifier and Type | Method and Description |
|---|---|
IResponseRequestContextAddon<R> |
addHeaderValue(String name,
String value) |
IResponseRequestContextAddon<R> |
addHeaderValues(String name,
List<String> values) |
void |
end() |
void |
flush() |
void |
flush(boolean end) |
protected ByteArrayOutputStream |
getBuffer() |
String |
getCharactersCharsetName() |
String |
getContentType() |
protected IETagFactory |
getEtagFactory() |
protected Object |
getExchange() |
protected Map<String,List<IFieldMessage>> |
getFieldsConfirms() |
protected Map<String,List<IFieldMessage>> |
getFieldsErrors() |
protected Map<String,List<IFieldMessage>> |
getFieldsWarnings() |
protected List<String> |
getGlobalConfirms() |
protected List<String> |
getGlobalErrors() |
protected List<String> |
getGlobalWarnings() |
GZIPOutputStream |
getGzipBuffer() |
GzipOption |
getGzipOption() |
List<String> |
getHeader(String name) |
String |
getHeaderFirst(String name) |
Map<String,List<String>> |
getHeaders() |
protected IJsonManager |
getJsonManager() |
protected ByteArrayOutputStream |
getOut() |
protected R |
getRequestContext() |
protected IServer |
getServer() |
protected ISpincastConfig |
getSpincastConfig() |
protected ISpincastUtils |
getSpincastUtils() |
int |
getStatusCode() |
byte[] |
getUnsentBytes() |
String |
getUnsentCharacters() |
String |
getUnsentCharacters(String encoding) |
protected IXmlManager |
getXmlManager() |
boolean |
isClosed() |
boolean |
isHeadersSent() |
protected boolean |
isRequestSizeValidated() |
protected boolean |
isResponseCharactersBased()
Try to determine is the response is characters based or not.
|
protected boolean |
isShouldGzip() |
void |
redirect(String newUrl,
boolean permanently) |
void |
redirect(String newUrl,
int specific3xxCode) |
IResponseRequestContextAddon<R> |
removeHeader(String name) |
IResponseRequestContextAddon<R> |
resetBuffer() |
IResponseRequestContextAddon<R> |
resetEverything() |
protected void |
send(byte[] bytes,
String contentType,
boolean flush) |
void |
sendBytes(byte[] bytes) |
void |
sendBytes(byte[] bytes,
String contentType) |
void |
sendBytes(byte[] bytes,
String contentType,
boolean flush)
Send some bytes + flush if specified.
|
void |
sendCharacters(String content) |
void |
sendCharacters(String content,
String contentType) |
void |
sendCharacters(String content,
String contentType,
boolean flush) |
void |
sendHtml(String html) |
void |
sendHtml(String string,
boolean flush) |
void |
sendJson(String jsonString) |
void |
sendJson(String jsonString,
boolean flush) |
void |
sendJsonObj(Object obj) |
void |
sendJsonObj(Object obj,
boolean flush) |
void |
sendParse(String content,
String contentType,
IJsonObject model) |
void |
sendParse(String content,
String contentType,
IJsonObject model,
boolean flush) |
void |
sendParse(String content,
String contentType,
Map<String,Object> params) |
void |
sendParse(String content,
String contentType,
Map<String,Object> params,
boolean flush) |
void |
sendParseHtml(String html,
IJsonObject model) |
void |
sendParseHtml(String html,
IJsonObject model,
boolean flush) |
void |
sendParseHtml(String html,
Map<String,Object> params) |
void |
sendParseHtml(String html,
Map<String,Object> params,
boolean flush) |
void |
sendPlainText(String string) |
void |
sendPlainText(String string,
boolean flush) |
void |
sendTemplate(String templatePath,
boolean isClasspathPath,
String contentType,
IJsonObject model) |
void |
sendTemplate(String templatePath,
boolean isClasspathPath,
String contentType,
IJsonObject model,
boolean flush) |
void |
sendTemplate(String templatePath,
boolean isClasspathPath,
String contentType,
Map<String,Object> params) |
void |
sendTemplate(String templatePath,
boolean isClasspathPath,
String contentType,
Map<String,Object> params,
boolean flush) |
void |
sendTemplate(String templatePath,
String contentType,
IJsonObject model) |
void |
sendTemplate(String templatePath,
String contentType,
IJsonObject model,
boolean flush) |
void |
sendTemplate(String templatePath,
String contentType,
Map<String,Object> params) |
void |
sendTemplate(String templatePath,
String contentType,
Map<String,Object> params,
boolean flush) |
void |
sendTemplateHtml(String templatePath,
boolean isClasspathPath,
IJsonObject model) |
void |
sendTemplateHtml(String templatePath,
boolean isClasspathPath,
IJsonObject model,
boolean flush) |
void |
sendTemplateHtml(String templatePath,
boolean isClasspathPath,
Map<String,Object> params) |
void |
sendTemplateHtml(String templatePath,
boolean isClasspathPath,
Map<String,Object> params,
boolean flush) |
void |
sendTemplateHtml(String templatePath,
IJsonObject model) |
void |
sendTemplateHtml(String templatePath,
IJsonObject model,
boolean flush) |
void |
sendTemplateHtml(String templatePath,
Map<String,Object> params) |
void |
sendTemplateHtml(String templatePath,
Map<String,Object> params,
boolean flush) |
void |
sendXml(String xml) |
void |
sendXml(String xml,
boolean flush) |
void |
sendXmlObj(Object obj) |
void |
sendXmlObj(Object obj,
boolean flush) |
IResponseRequestContextAddon<R> |
setCacheSeconds(int cacheSeconds) |
IResponseRequestContextAddon<R> |
setCacheSeconds(int cacheSeconds,
boolean isPrivateCache) |
IResponseRequestContextAddon<R> |
setCharactersCharsetName(String charactersCharsetName) |
IResponseRequestContextAddon<R> |
setContentType(String responseContentType) |
IResponseRequestContextAddon<R> |
setGzipOption(GzipOption gzipOption) |
IResponseRequestContextAddon<R> |
setHeader(String name,
List<String> values) |
IResponseRequestContextAddon<R> |
setHeader(String name,
String value) |
protected void |
setIsShouldGzip(boolean isShouldGzip) |
protected void |
setRequestSizeValidated(boolean requestSizeValidated) |
IResponseRequestContextAddon<R> |
setStatusCode(int responseStatusCode) |
protected final org.slf4j.Logger logger
protected static final boolean IS_RESPONSE_CHARACTERS_BASED_BY_DEFAULT
@Inject public SpincastResponseRequestContextAddon(R requestContext, IServer server, IJsonManager jsonManager, IXmlManager xmlManager, ISpincastConfig spincastConfig, ISpincastUtils spincastUtils, IETagFactory etagFactory)
protected R getRequestContext()
protected IServer getServer()
protected Object getExchange()
protected IJsonManager getJsonManager()
protected IXmlManager getXmlManager()
protected ISpincastConfig getSpincastConfig()
protected ISpincastUtils getSpincastUtils()
protected IETagFactory getEtagFactory()
protected ByteArrayOutputStream getBuffer()
protected ByteArrayOutputStream getOut()
protected Map<String,List<IFieldMessage>> getFieldsErrors()
protected Map<String,List<IFieldMessage>> getFieldsConfirms()
protected Map<String,List<IFieldMessage>> getFieldsWarnings()
public GZIPOutputStream getGzipBuffer()
protected boolean isRequestSizeValidated()
protected void setRequestSizeValidated(boolean requestSizeValidated)
public IResponseRequestContextAddon<R> setGzipOption(GzipOption gzipOption)
setGzipOption in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public GzipOption getGzipOption()
getGzipOption in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public int getStatusCode()
getStatusCode in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public IResponseRequestContextAddon<R> setStatusCode(int responseStatusCode)
setStatusCode in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public String getContentType()
getContentType in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public IResponseRequestContextAddon<R> setContentType(String responseContentType)
setContentType in interface IResponseRequestContextAddon<R extends IRequestContext<?>>protected boolean isResponseCharactersBased()
public boolean isClosed()
isClosed in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void redirect(String newUrl, boolean permanently)
redirect in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void redirect(String newUrl, int specific3xxCode)
redirect in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendBytes(byte[] bytes)
sendBytes in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendBytes(byte[] bytes,
String contentType)
sendBytes in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendBytes(byte[] bytes,
String contentType,
boolean flush)
sendBytes in interface IResponseRequestContextAddon<R extends IRequestContext<?>>protected void send(byte[] bytes,
String contentType,
boolean flush)
public void sendCharacters(String content)
sendCharacters in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendCharacters(String content, String contentType)
sendCharacters in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendCharacters(String content, String contentType, boolean flush)
sendCharacters in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public String getCharactersCharsetName()
getCharactersCharsetName in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public IResponseRequestContextAddon<R> setCharactersCharsetName(String charactersCharsetName)
setCharactersCharsetName in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendPlainText(String string)
sendPlainText in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendPlainText(String string, boolean flush)
sendPlainText in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendHtml(String html)
sendHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendHtml(String string, boolean flush)
sendHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendParseHtml(String html, Map<String,Object> params)
sendParseHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendParseHtml(String html, Map<String,Object> params, boolean flush)
sendParseHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendParseHtml(String html, IJsonObject model)
sendParseHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendParseHtml(String html, IJsonObject model, boolean flush)
sendParseHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplateHtml(String templatePath, IJsonObject model)
sendTemplateHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplateHtml(String templatePath, IJsonObject model, boolean flush)
sendTemplateHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplateHtml(String templatePath, boolean isClasspathPath, IJsonObject model)
sendTemplateHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplateHtml(String templatePath, boolean isClasspathPath, IJsonObject model, boolean flush)
sendTemplateHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendParse(String content, String contentType, Map<String,Object> params)
sendParse in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendParse(String content, String contentType, Map<String,Object> params, boolean flush)
sendParse in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendParse(String content, String contentType, IJsonObject model)
sendParse in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendParse(String content, String contentType, IJsonObject model, boolean flush)
sendParse in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplateHtml(String templatePath, Map<String,Object> params)
sendTemplateHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplateHtml(String templatePath, boolean isClasspathPath, Map<String,Object> params)
sendTemplateHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplateHtml(String templatePath, Map<String,Object> params, boolean flush)
sendTemplateHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplateHtml(String templatePath, boolean isClasspathPath, Map<String,Object> params, boolean flush)
sendTemplateHtml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplate(String templatePath, String contentType, Map<String,Object> params)
sendTemplate in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplate(String templatePath, boolean isClasspathPath, String contentType, Map<String,Object> params)
sendTemplate in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplate(String templatePath, String contentType, Map<String,Object> params, boolean flush)
sendTemplate in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplate(String templatePath, boolean isClasspathPath, String contentType, Map<String,Object> params, boolean flush)
sendTemplate in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplate(String templatePath, String contentType, IJsonObject model)
sendTemplate in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplate(String templatePath, String contentType, IJsonObject model, boolean flush)
sendTemplate in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplate(String templatePath, boolean isClasspathPath, String contentType, IJsonObject model)
sendTemplate in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendTemplate(String templatePath, boolean isClasspathPath, String contentType, IJsonObject model, boolean flush)
sendTemplate in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendJson(String jsonString)
sendJson in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendJson(String jsonString, boolean flush)
sendJson in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendJsonObj(Object obj)
sendJsonObj in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendJsonObj(Object obj, boolean flush)
sendJsonObj in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendXml(String xml)
sendXml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendXml(String xml, boolean flush)
sendXml in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendXmlObj(Object obj)
sendXmlObj in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void sendXmlObj(Object obj, boolean flush)
sendXmlObj in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public IResponseRequestContextAddon<R> resetBuffer()
resetBuffer in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public IResponseRequestContextAddon<R> resetEverything()
resetEverything in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public byte[] getUnsentBytes()
getUnsentBytes in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public String getUnsentCharacters()
getUnsentCharacters in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public String getUnsentCharacters(String encoding)
getUnsentCharacters in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public IResponseRequestContextAddon<R> removeHeader(String name)
removeHeader in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public IResponseRequestContextAddon<R> setHeader(String name, String value)
setHeader in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public IResponseRequestContextAddon<R> setHeader(String name, List<String> values)
setHeader in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public IResponseRequestContextAddon<R> addHeaderValue(String name, String value)
addHeaderValue in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public IResponseRequestContextAddon<R> addHeaderValues(String name, List<String> values)
addHeaderValues in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public Map<String,List<String>> getHeaders()
getHeaders in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public List<String> getHeader(String name)
getHeader in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public String getHeaderFirst(String name)
getHeaderFirst in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public boolean isHeadersSent()
isHeadersSent in interface IResponseRequestContextAddon<R extends IRequestContext<?>>protected void setIsShouldGzip(boolean isShouldGzip)
protected boolean isShouldGzip()
public void end()
end in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void flush()
flush in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public void flush(boolean end)
flush in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public IResponseRequestContextAddon<R> setCacheSeconds(int cacheSeconds)
setCacheSeconds in interface IResponseRequestContextAddon<R extends IRequestContext<?>>public IResponseRequestContextAddon<R> setCacheSeconds(int cacheSeconds, boolean isPrivateCache)
setCacheSeconds in interface IResponseRequestContextAddon<R extends IRequestContext<?>>Copyright © 2016. All rights reserved.