Exemplo n.º 1
0
  public final String intercept(ActionInvocation actionInvocation) throws Exception {
    actionInvocation.addPreResultListener(this);

    executePreResultListener = true;

    try {
      return actionInvocation.invoke();
    } catch (Exception e) {
      executePreResultListener = false;
      throw e;
    }
  }
  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 {
   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();
 }
Exemplo n.º 4
0
 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());
   }
 }
 /*
  * ���� Javadoc��
  *
  * @see
  * com.opensymphony.xwork.interceptor.Interceptor#intercept(com.opensymphony
  * .xwork.ActionInvocation)
  */
 public String intercept(ActionInvocation invocation) throws Exception {
   // ActionContext.get
   // HttpServletRequest request = (HttpServletRequest)
   // ActionContext.getContext().get(HTTP_REQUEST);
   // HttpServletResponse response = (HttpServletRequest)
   // ActionContext.getContext().get(HTTP_RESPONSE);
   // response.addCookie(new Cookie());
   // Enumeration enum = request.get;
   String result = null;
   if (checkLogin != null && checkLogin.checkLogin()) {
     result = invocation.invoke();
     ResultConfig resultConf = new ResultConfig();
     resultConf.setName("SUCCESS");
   } else {
     result = LOGIN_ERROR;
   }
   return result;
 }