1 20 21 package com.methodhead.transfer; 22 23 import org.apache.struts.action.Action; 24 import org.apache.struts.action.ActionMapping; 25 import org.apache.struts.action.ActionForm; 26 import org.apache.struts.action.DynaActionForm; 27 import org.apache.struts.action.ActionForward; 28 29 import javax.servlet.http.HttpServletRequest ; 30 import javax.servlet.http.HttpServletResponse ; 31 32 import com.methodhead.auth.AuthUtil; 33 import com.methodhead.auth.AuthUser; 34 import com.methodhead.auth.AuthAction; 35 import com.methodhead.util.OperationContext; 36 import com.methodhead.util.StrutsUtil; 37 38 public class AboutAction 39 extends 40 AuthAction { 41 42 44 46 48 50 protected ActionForward doAbout( 51 OperationContext op, 52 TransferPolicy policy ) { 53 54 String msg = policy.isAboutAuthorized( op ); 58 if ( msg != null ) { 59 StrutsUtil.addMessage( op.request, msg, null, null, null ); 60 return op.mapping.findForward( "accessDenied" ); 61 } 62 63 return op.mapping.findForward( "form" ); 64 } 65 66 public ActionForward doExecute( 67 ActionMapping mapping, 68 ActionForm form, 69 HttpServletRequest request, 70 HttpServletResponse response ) 71 throws 72 Exception { 73 74 DynaActionForm dynaForm = ( DynaActionForm )form; 78 TransferPolicy policy = ( TransferPolicy )StrutsUtil.getPolicy( mapping ); 79 AuthUser user = AuthUtil.getUser( request ); 80 81 OperationContext op = 82 new OperationContext( mapping, dynaForm, request, response, user ); 83 84 if ( mapping.getPath().equals( "/about" ) ) { 88 return doAbout( op, policy ); 89 } 90 91 throw 92 new Exception ( "Unexpected mapping path \"" + mapping.getPath() + "\"" ); 93 } 94 95 97 } 99 | Popular Tags |