DirectResult extends StrutsResultSupport { @Override protected void doExecute(String finalLocation,ActionInvocation invocation) throws Exception { HttpServletResponse response = (HttpServletResponse) invocation.getInvocationContext().get(HTTP_RESPONSE); HttpServletRequest request = (HttpServletRequest) invocation.getInvocationContext().get(HTTP_REQUEST); String resultCodeAsLocation = invocation.getResultCode(); if(resultCodeAsLocation == null) { return; } resultCodeAsLocation = TextParseUtil.translateVariables(resultCodeAsLocation,invocation.getStack()); if(resultCodeAsLocation.startsWith("!")) { doRedirect(invocation,request, response, resultCodeAsLocation.substring(1)); return; } if(resultCodeAsLocation.startsWith(REDIRECT_PREFIX)) { doRedirect(invocation,request, response, resultCodeAsLocation.substring(REDIRECT_PREFIX.length())); return; } if(resultCodeAsLocation.startsWith(FORWARD_PREFIX)) { doDispatcher(response, request, resultCodeAsLocation.substring(FORWARD_PREFIX.length())); return; } doDispatcher(response, request, resultCodeAsLocation); } DirectResult();  DirectResult(String location); void setPrependServletContext(boolean prependServletContext);  }
@Test public void test() throws Exception { DirectResult r = new DirectResult(); MockActionInvocation invocation = new MockActionInvocation(); invocation.setInvocationContext(new ActionContext(new HashMap())); r.doExecute("abc.jsp", invocation); }