コード例 #1
0
ファイル: XmlResult.java プロジェクト: mscheidnes/wforms
 public void execute(ActionInvocation invocation) throws Exception {
   XmlProducer producer = (XmlProducer) invocation.getAction();
   XmlRenderable xmlRenderable = producer.getXmlRenderable();
   Element element = xmlRenderable.asXml();
   Document document = new Document(element);
   String xmlString = XmlUtility.asString(document);
   HttpServletResponse response = ServletActionContext.getResponse();
   response.setContentType("text/xml");
   try {
     OutputStream out = response.getOutputStream();
     BufferedOutputStream bufferedOut = new BufferedOutputStream(out);
     bufferedOut.write(xmlString.getBytes());
     bufferedOut.close();
   } catch (IOException e) {
     logger.warning("Failed to write result XML response to browser: " + e.toString());
   }
 }
コード例 #2
0
 public void store(BrowserResult result) {
   String xml = XmlUtility.asString(result.asXml());
   FileUtility.write(logFileForId(result.getId(), result.getBrowser()), xml);
 }