Package de.xima.fc.web.common.respond
Class ServletResponder
- java.lang.Object
-
- de.xima.fc.web.common.respond.ServletResponder
-
- Direct Known Subclasses:
FormResponder
public class ServletResponder extends Object
-
-
Constructor Summary
Constructors Constructor Description ServletResponder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addDispositionHeader(javax.servlet.http.HttpServletResponse resp, String fileName, String encoding, boolean inline)
static String
buildTemplateHTML(IExtendedFormRequestContext ctx, String msg)
static String
buildTemplateHTML(Locale locale, String msg)
static void
redirect(javax.servlet.http.HttpServletResponse response, String url)
static void
respond(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, IServletResponse responseData, Locale locale)
static void
respondContent(javax.servlet.http.HttpServletResponse resp, EMime mime, String cont)
Setzt die Response-Header 'Content-Type' und 'Content-Length' und schreibt die übergebenen Daten in den Response.static void
respondContent(javax.servlet.http.HttpServletResponse resp, EMime mime, String cont, String encoding)
static void
respondFile(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, byte[] data, String fileName, boolean inline)
static void
respondFile(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, byte[] data, String fileName, boolean inline, String contentType)
static void
respondFile(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, byte[] data, String baseName, String encoding, boolean inline, EMime mime)
static void
respondFile(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, byte[] data, String fileName, String encoding, boolean inline, String contentType)
static void
respondFile(javax.servlet.http.HttpServletResponse resp, File file, boolean inline)
static void
respondFile(javax.servlet.http.HttpServletResponse resp, File file, String fileName, boolean inline)
static void
respondFile(javax.servlet.http.HttpServletResponse resp, File file, String fileName, String encoding, boolean inline)
protected static void
respondHTML(javax.servlet.http.HttpServletResponse response, IServletResponse responseData)
static void
respondHTML(javax.servlet.http.HttpServletResponse response, String html)
static void
respondJavaScript(javax.servlet.http.HttpServletResponse response, String script)
static void
respondJSON(javax.servlet.http.HttpServletResponse resp, com.alibaba.fastjson.JSONArray json)
static void
respondJSON(javax.servlet.http.HttpServletResponse resp, com.alibaba.fastjson.JSONObject json)
protected static void
respondJSON(javax.servlet.http.HttpServletResponse response, IServletResponse responseData)
static void
respondJSON(javax.servlet.http.HttpServletResponse resp, String json)
static void
respondJSONError(javax.servlet.http.HttpServletResponse resp, String msg, int sc)
static void
respondJSONMessage(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, String string, boolean success)
static void
respondPlainText(javax.servlet.http.HttpServletResponse response, String text)
static void
respondStream(javax.servlet.http.HttpServletResponse resp, InputStream is, String fileName, boolean inline)
static void
respondStream(javax.servlet.http.HttpServletResponse resp, InputStream is, String fileName, String encoding, boolean inline)
protected static void
respondTemplate(javax.servlet.http.HttpServletResponse response, IServletResponse responseData, Locale locale)
protected static void
respondXML(javax.servlet.http.HttpServletResponse response, IServletResponse responseData)
static void
respondXML(javax.servlet.http.HttpServletResponse response, String xml)
static void
writeHeader(javax.servlet.http.HttpServletResponse response, IServletResponse responseData)
static void
writeSessionParameters(javax.servlet.http.HttpServletRequest request, IServletResponse responseData)
static void
writeStatusCode(javax.servlet.http.HttpServletResponse response, IServletResponse responseData)
-
-
-
Method Detail
-
respondContent
public static void respondContent(javax.servlet.http.HttpServletResponse resp, EMime mime, String cont)
Setzt die Response-Header 'Content-Type' und 'Content-Length' und schreibt die übergebenen Daten in den Response. Das zu verwendende Character-Set wird über die KonstanteCmnConst.DFLT_ENCODING
ermittelt.- Parameters:
resp
- - Responsemime
- - Inhaltstypcont
- - zu schreibende Daten
-
respondContent
public static void respondContent(javax.servlet.http.HttpServletResponse resp, EMime mime, String cont, String encoding)
-
respondFile
public static void respondFile(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, byte[] data, String fileName, boolean inline)
-
respondFile
public static void respondFile(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, byte[] data, String fileName, boolean inline, String contentType)
-
respondFile
public static void respondFile(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, byte[] data, String baseName, String encoding, boolean inline, EMime mime)
-
respondFile
public static void respondFile(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, byte[] data, String fileName, String encoding, boolean inline, String contentType)
-
respondFile
public static void respondFile(javax.servlet.http.HttpServletResponse resp, File file, boolean inline)
-
respondFile
public static void respondFile(javax.servlet.http.HttpServletResponse resp, File file, String fileName, boolean inline)
-
respondFile
public static void respondFile(javax.servlet.http.HttpServletResponse resp, File file, String fileName, String encoding, boolean inline)
-
respondStream
public static void respondStream(javax.servlet.http.HttpServletResponse resp, InputStream is, String fileName, boolean inline)
-
respondStream
public static void respondStream(javax.servlet.http.HttpServletResponse resp, InputStream is, String fileName, String encoding, boolean inline)
-
addDispositionHeader
public static void addDispositionHeader(javax.servlet.http.HttpServletResponse resp, String fileName, String encoding, boolean inline) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
redirect
public static void redirect(javax.servlet.http.HttpServletResponse response, String url) throws IOException
- Throws:
IOException
-
buildTemplateHTML
public static String buildTemplateHTML(IExtendedFormRequestContext ctx, String msg)
-
respond
public static void respond(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, IServletResponse responseData, Locale locale) throws IOException
- Throws:
IOException
-
writeSessionParameters
public static void writeSessionParameters(javax.servlet.http.HttpServletRequest request, IServletResponse responseData)
-
writeHeader
public static void writeHeader(javax.servlet.http.HttpServletResponse response, IServletResponse responseData)
-
writeStatusCode
public static void writeStatusCode(javax.servlet.http.HttpServletResponse response, IServletResponse responseData)
-
respondHTML
protected static void respondHTML(javax.servlet.http.HttpServletResponse response, IServletResponse responseData)
-
respondTemplate
protected static void respondTemplate(javax.servlet.http.HttpServletResponse response, IServletResponse responseData, Locale locale)
-
respondJSON
protected static void respondJSON(javax.servlet.http.HttpServletResponse response, IServletResponse responseData)
-
respondXML
protected static void respondXML(javax.servlet.http.HttpServletResponse response, IServletResponse responseData)
-
respondHTML
public static void respondHTML(javax.servlet.http.HttpServletResponse response, String html)
-
respondPlainText
public static void respondPlainText(javax.servlet.http.HttpServletResponse response, String text)
-
respondJavaScript
public static void respondJavaScript(javax.servlet.http.HttpServletResponse response, String script)
-
respondJSON
public static void respondJSON(javax.servlet.http.HttpServletResponse resp, com.alibaba.fastjson.JSONObject json)
-
respondJSON
public static void respondJSON(javax.servlet.http.HttpServletResponse resp, com.alibaba.fastjson.JSONArray json)
-
respondJSON
public static void respondJSON(javax.servlet.http.HttpServletResponse resp, String json)
-
respondXML
public static void respondXML(javax.servlet.http.HttpServletResponse response, String xml)
-
respondJSONMessage
public static void respondJSONMessage(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, String string, boolean success)
-
respondJSONError
public static void respondJSONError(javax.servlet.http.HttpServletResponse resp, String msg, int sc)
-
-