public void execute(ActionInvocation invocation) throws Exception { LatestVersionSource source = (LatestVersionSource) invocation.getAction(); double latestVersion = source.getLatestVersion(); HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType("text/xml"); OutputStream out = response.getOutputStream(); out.write(String.valueOf(latestVersion).getBytes()); out.close(); }
public String intercept(ActionInvocation actionInvocation) throws Exception { DisplayPropertyHandler handler = displayPropertyManager.getDisplayPropertyHandler(); Action action = (Action) actionInvocation.getAction(); Map contextMap = actionInvocation.getInvocationContext().getContextMap(); try { Ognl.setValue(KEY_DISPLAY_PROPERTY_HANDLER, contextMap, action, handler); } catch (NoSuchPropertyException e) { } return actionInvocation.invoke(); }
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()); } }