Package org.araneaframework.servlet.util

Examples of org.araneaframework.servlet.util.AtomicResponseHelper


    entries.put(ContinuationManagerContext.class, this);       
    return new StandardEnvironment(super.getChildEnvironment(), entries);
  }
 
  protected void action(Path path, InputData input, OutputData output) throws Exception {
    AtomicResponseHelper arUtil = new AtomicResponseHelper();
    arUtil.wrapOutput((ServletOverridableOutputData)output);
   
    try {
      if (isContinuationRunning()) {
        log.debug("Routing request through standard continuation.");
        continuation._getService().action(path, input, output);
      }
     
      if (!isContinuationRunning()) {
        arUtil.rollback();
       
        Path scope = output.getScope();            
       
        try {                         
          try {
            log.debug("Routing request through the continuation.");
            childService._getService().action(path, input, output);
          }
          finally {
            output.restoreScope(scope);
          }
        }
        catch (Exception e) {        
          if (continuation == null)
            throw e;

          arUtil.rollback();
         
          continuation._getService().action(null, input, output);
        }
      }
    }
    finally {     
      arUtil.commit();
    }
  }
View Full Code Here


    res = new MockHttpServletResponse();
    res.setContentType("text/html; charset=UTF-8");
   
    output = new StandardServletOutputData(new MockHttpServletRequest(), res);
   
    atomic = new AtomicResponseHelper();
    atomic.wrapOutput(output);
  }
View Full Code Here

  public void setExceptionHandlerFactory(ExceptionHandlerFactory factory) {
    this.factory = factory;
  }
 
  protected void action(Path path, InputData input, OutputData output) throws Exception {
    AtomicResponseHelper arUtil = new AtomicResponseHelper();
    arUtil.wrapOutput((ServletOverridableOutputData)output);
   
    try {
      childService._getService().action(path, input, output);
    }
    catch (Throwable e) {              
      if (ExceptionUtils.getRootCause(e) != null)
        log.error("Critical exception occured: ", ExceptionUtils.getRootCause(e));
      else
        log.error("Critical exception occured: ", e);
     
      if (e instanceof Error &&
          !(e instanceof StackOverflowError))
        throw (Error) e;     
     
      arUtil.rollback();
     
      Service service = factory.buildExceptionHandler(e, getEnvironment());
      service._getComponent().init(getEnvironment());
      try {
        log.debug("Routing request to the continuation.");
        service._getService().action(null, input, output);
      }
      finally {
        service._getComponent().destroy();
      }
    }

    arUtil.commit();
  }
View Full Code Here

TOP

Related Classes of org.araneaframework.servlet.util.AtomicResponseHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.