this.loadBody(writer, request);
writer.flush();
return;
}
WebSession webSession = request.getSession(false);
XMLOutputFactory factory = XMLOutputFactory.newInstance();
XMLStreamWriter writer = factory.createXMLStreamWriter(os);
writer.writeStartDocument();
writer.writeStartElement("sc-web");
writer.writeStartElement("head");
// write url path
String url = request.getURL();
if (url != null) {
int qPos = url.indexOf("?");
if (qPos >= 0) {
url = url.substring(0, qPos);
}
// check if ajax content call
String id = request.getParameter("id");
if (id != null) {
url = Constants.SLASH + id;
}
writer.writeStartElement("meta");
writer.writeAttribute("path", url);
writer.writeEndElement(); // close meta tag
}
// write query string
writer.writeStartElement("meta");
writer.writeAttribute("creation", DateTimeUtility.getCurrentTimeZoneMillis());
writer.writeEndElement(); // close meta tag
// write sc version
writer.writeStartElement("meta");
writer.writeAttribute("scversion", SCVersion.CURRENT.toString());
writer.writeEndElement(); // close meta tag
WebConfiguration webConfiguration = WebContext.getWebConfiguration();
// write web color schema
writer.writeStartElement("meta");
writer.writeAttribute("colorscheme", webConfiguration.getColorScheme());
writer.writeEndElement(); // close meta tag
// write sc header prefix
writer.writeStartElement("meta");
writer.writeAttribute("headerprefix", webConfiguration.getPageHeaderPrefix());
writer.writeEndElement(); // close meta tag
// write sc status
writer.writeStartElement("meta");
writer.writeAttribute("scstatus", "success");
writer.writeEndElement(); // close meta tag
// write scconfigfile
writer.writeStartElement("meta");
writer.writeAttribute("scconfigfile", SystemInfo.getConfigFileName());
writer.writeEndElement(); // close meta tag
// write current ip host
String hostName = InetAddress.getLocalHost().getHostName();
writer.writeStartElement("meta");
writer.writeAttribute("hostname", hostName);
writer.writeEndElement(); // close meta tag
if (webSession != null) {
writer.writeStartElement("meta");
writer.writeAttribute("jsessionid", webSession.getId());
writer.writeEndElement(); // close meta tag
writer.writeStartElement("meta");
writer.writeAttribute("urlencoded", ";sid=" + webSession.getId());
writer.writeEndElement(); // close meta tag
}
for (Entry<String, String> entry : this.metaMap.entrySet()) {
writer.writeStartElement("meta");
writer.writeAttribute(entry.getKey(), entry.getValue());