You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by am...@apache.org on 2004/03/09 22:45:02 UTC

cvs commit: jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/users GroupForm.java UserForm.java

amyroh      2004/03/09 13:45:02

  Modified:    webapps/admin/WEB-INF/classes/org/apache/webapp/admin/users
                        GroupForm.java UserForm.java
  Log:
  Fix 24085 - Display group and role list when validation fails.
  
  Revision  Changes    Path
  1.4       +26 -3     jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/users/GroupForm.java
  
  Index: GroupForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/users/GroupForm.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- GroupForm.java	27 Feb 2004 14:59:05 -0000	1.3
  +++ GroupForm.java	9 Mar 2004 21:45:02 -0000	1.4
  @@ -16,12 +16,14 @@
   
   package org.apache.webapp.admin.users;
   
  -
  +import java.net.URLDecoder;
  +import javax.management.MBeanServer;
   import javax.servlet.http.HttpServletRequest;
   import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionMapping;
  +import org.apache.webapp.admin.ApplicationServlet;
   
   
   /**
  @@ -37,6 +39,11 @@
   
       // ----------------------------------------------------- Instance Variables
   
  +   /**
  +     * The MBeanServer we will be interacting with.
  +     */
  +    private MBeanServer mserver = null;
  +    
   
       // ------------------------------------------------------------- Properties
   
  @@ -117,7 +124,23 @@
        */
       public ActionErrors validate(ActionMapping mapping,
       HttpServletRequest request) {
  -
  +        
  +        try {
  +            // Look up the components we will be using as needed
  +            if (mserver == null) {
  +                mserver = ((ApplicationServlet) getServlet()).getServer();
  +            }
  +         
  +            // Set up beans containing all possible groups and roles
  +            String databaseName =
  +                URLDecoder.decode(request.getParameter("databaseName"));
  +            request.setAttribute("rolesForm",
  +                                 UserUtils.getRolesForm(mserver,
  +                                                        databaseName));
  +        } catch (Exception e) {
  +            // do nothing since the form returns validation error
  +        }
  +        
           ActionErrors errors = new ActionErrors();
   
           String submit = request.getParameter("submit");
  
  
  
  1.4       +28 -3     jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/users/UserForm.java
  
  Index: UserForm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/users/UserForm.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UserForm.java	27 Feb 2004 14:59:05 -0000	1.3
  +++ UserForm.java	9 Mar 2004 21:45:02 -0000	1.4
  @@ -17,11 +17,14 @@
   package org.apache.webapp.admin.users;
   
   
  +import java.net.URLDecoder;
  +import javax.management.MBeanServer;
   import javax.servlet.http.HttpServletRequest;
   import org.apache.struts.action.ActionError;
   import org.apache.struts.action.ActionErrors;
   import org.apache.struts.action.ActionForm;
   import org.apache.struts.action.ActionMapping;
  +import org.apache.webapp.admin.ApplicationServlet;
   
   
   /**
  @@ -37,10 +40,13 @@
   
       // ----------------------------------------------------- Instance Variables
   
  +   /**
  +     * The MBeanServer we will be interacting with.
  +     */
  +    private MBeanServer mserver = null;
   
       // ------------------------------------------------------------- Properties
   
  -
       /**
        * The full name of the associated user.
        */
  @@ -149,7 +155,26 @@
        */
       public ActionErrors validate(ActionMapping mapping,
       HttpServletRequest request) {
  -
  +        
  +        try {
  +            // Look up the components we will be using as needed
  +            if (mserver == null) {
  +                mserver = ((ApplicationServlet) getServlet()).getServer();
  +            }
  +         
  +            // Set up beans containing all possible groups and roles
  +            String databaseName =
  +                URLDecoder.decode(request.getParameter("databaseName"));
  +            request.setAttribute("groupsForm",
  +                                 UserUtils.getGroupsForm(mserver,
  +                                                         databaseName));
  +            request.setAttribute("rolesForm",
  +                                 UserUtils.getRolesForm(mserver,
  +                                                        databaseName));
  +        } catch (Exception e) {
  +            // do nothing since the form returns validation error
  +        }
  +        
           ActionErrors errors = new ActionErrors();
   
           String submit = request.getParameter("submit");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org