List of usage examples for org.apache.commons.chain.web.servlet ServletWebContext ServletWebContext
public ServletWebContext()
Construct an uninitialized ServletWebContext instance.
From source file:org.apache.struts.chain.commands.generic.TestWrappingLookupCommand.java
public void testWrapContextSubclass() throws Exception { WrappingLookupCommand command = new WrappingLookupCommand(); command.setWrapperClassName(ServletActionContext.class.getName()); Context testContext = new ServletWebContext(); Context wrapped = command.getContext(testContext); assertNotNull(wrapped);//from w w w.j a va2 s. c o m assertTrue(wrapped instanceof ServletActionContext); }
From source file:org.apache.struts.chain.legacy.ComposableRequestProcessor.java
/** * <p>Process an <code>HttpServletRequest</code> and create the * corresponding <code>HttpServletResponse</code>.</p> * * @param request The servlet request we are processing * @param response The servlet response we are creating * * @exception IOException if an input/output error occurs * @exception ServletException if a processing exception occurs *//* ww w .j ava2 s.c o m*/ public void process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Wrap the request in the case of a multipart request request = processMultipart(request); // Create and populate a Context for this request ServletWebContext context = new ServletWebContext(); context.initialize(getServletContext(), request, response); context.put(Constants.ACTION_SERVLET_KEY, this.servlet); context.put(Constants.MODULE_CONFIG_KEY, this.moduleConfig); // Create and execute the command. try { if (log.isDebugEnabled()) { log.debug("Using processing chain for this request"); } command.execute(context); } catch (Exception e) { // Execute the exception processing chain?? throw new ServletException(e); } // Release the context. context.release(); }