本文整理了Java中org.apache.catalina.connector.Response.getReporter
方法的一些代码示例,展示了Response.getReporter
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getReporter
方法的具体详情如下:
包路径:org.apache.catalina.connector.Response
类名称:Response
方法名:getReporter
[英]Return a PrintWriter that can be used to render error messages, regardless of whether a stream or writer has already been acquired.
[中]返回可用于呈现错误消息的PrintWriter,无论是否已获取流或写入程序。
代码示例来源:origin: com.tomitribe.tribestream/tribestream-container
private void reportJson(final Request request, final Response response, final String report, final String message) {
final JsonObjectBuilder builder = Json.createObjectBuilder();
if (report != null && report.length() > 0) {
builder.add("error", report);
}
if (message != null && message.length() > 0) {
builder.add("error_description", message);
}
final JsonObject error = builder.build();
final StringWriter sw = new StringWriter();
Json.createWriter(sw).writeObject(error);
final String out = sw.toString();
try {
response.getReporter().print(out);
} catch (final IOException e) {
LOGGER.warning(ValveCodes.ERROR_REPORT, "An error occurred while generating JSON response for error.", e);
}
}
代码示例来源:origin: com.tomitribe.tribestream/tribestream-container
private void reportXml(final Request request, final Response response, final String report, final String message) {
response.setContentType(MediaType.APPLICATION_XML);
try {
final Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
final Element rootElement = document.createElement("error");
document.appendChild(rootElement);
if (report != null && report.length() > 0) {
final Element error = document.createElement("error");
final Text text = document.createTextNode(report);
error.appendChild(text);
rootElement.appendChild(error);
}
if (message != null && message.length() > 0) {
final Element error = document.createElement("error_description");
final Text text = document.createTextNode(message);
error.appendChild(text);
rootElement.appendChild(error);
}
DOMImplementationLS domImplementation = (DOMImplementationLS) document.getImplementation();
LSSerializer lsSerializer = domImplementation.createLSSerializer();
response.getReporter().print(lsSerializer.writeToString(document));
} catch (ParserConfigurationException | IOException e) {
LOGGER.warning(ValveCodes.ERROR_REPORT, "An error occurred while generating XML response for error.", e);
}
}
代码示例来源:origin: jboss.web/jbossweb
container.getLogger().debug("status.setContentType", t);
Writer writer = response.getReporter();
if (writer != null) {
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
container.getLogger().debug("status.setContentType", t);
Writer writer = response.getReporter();
if (writer != null) {
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
container.getLogger().debug("status.setContentType", t);
Writer writer = response.getReporter();
if (writer != null) {
代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina
Writer writer = response.getReporter();
if (writer != null) {
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
container.getLogger().debug("status.setContentType", t);
Writer writer = response.getReporter();
if (writer != null) {
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina
Writer writer = response.getReporter();
if (writer != null) {
代码示例来源:origin: tomcat/catalina
container.getLogger().debug("status.setContentType", t);
Writer writer = response.getReporter();
if (writer != null) {
代码示例来源:origin: codefollower/Tomcat-Research
Writer writer = response.getReporter();
if (writer != null) {
代码示例来源:origin: fujitsu-pio/io
Writer writer = response.getReporter();
if (writer != null) {
writer.write(errorPage);
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
Writer writer = response.getReporter();
if (writer != null) {
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
Writer writer = response.getReporter();
if (writer != null) {
代码示例来源:origin: org.jboss.web/jbossweb
container.getLogger().debug("status.setContentType", t);
Writer writer = response.getReporter();
if (writer != null) {
代码示例来源:origin: org.apache.tomee/tomee-catalina
final Writer writer = response.getReporter();
if (writer != null) {
writer.write("<html>\n" +
内容来源于网络,如有侵权,请联系作者删除!