1 18 package org.apache.beehive.netui.pageflow; 19 20 import org.apache.beehive.netui.util.Bundle; 21 22 import javax.servlet.http.HttpServletResponse ; 23 import java.io.IOException ; 24 25 26 32 public class UnfulfilledRolesException 33 extends PageFlowException 34 implements ResponseErrorCodeSender 35 { 36 private String [] _roleNames; 37 private String _rolesList; 38 39 40 45 public UnfulfilledRolesException( String [] roleNames, String rolesList, String actionName, FlowController fc ) 46 { 47 super( actionName, fc ); 48 _roleNames = roleNames; 49 _rolesList = rolesList; 50 } 51 52 57 public String [] getRoleNames() 58 { 59 return _roleNames; 60 } 61 62 63 protected Object [] getMessageArgs() 64 { 65 return new Object []{ getActionName(), getFlowControllerURI(), _rolesList }; 66 } 67 68 public String [] getMessageParts() 69 { 70 return new String [] 71 { 72 "Action ", " on Page Flow ", " requires the user to be in one of the following roles: ", "." 73 }; 74 } 75 76 public void sendResponseErrorCode( HttpServletResponse response ) throws IOException 77 { 78 String msg = Bundle.getString( "PageFlow_UnfulfilledRolesException_ResponseMessage", getActionName() ); 79 response.sendError( HttpServletResponse.SC_BAD_REQUEST, msg ); 80 } 81 82 86 public boolean causeMayBeSessionExpiration() 87 { 88 return true; 89 } 90 } 91 | Popular Tags |