1 16 17 package org.apache.webapp.admin.realm; 18 19 import javax.servlet.http.HttpServletRequest ; 20 import org.apache.struts.action.ActionError; 21 import org.apache.struts.action.ActionErrors; 22 import org.apache.struts.action.ActionForm; 23 import org.apache.struts.action.ActionMapping; 24 import java.net.InetAddress ; 25 import java.util.List ; 26 27 import org.apache.webapp.admin.ApplicationServlet; 28 import org.apache.webapp.admin.LabelValueBean; 29 30 36 37 public final class UserDatabaseRealmForm extends RealmForm { 38 39 41 44 private String resource = null; 45 46 48 49 52 public String getResource() { 53 54 return this.resource; 55 56 } 57 58 61 public void setResource(String resource) { 62 63 this.resource = resource; 64 65 } 66 67 69 75 public void reset(ActionMapping mapping, HttpServletRequest request) { 76 77 super.reset(mapping, request); 78 this.resource = null; 79 80 } 81 82 85 public String toString() { 86 87 StringBuffer sb = new StringBuffer ("UserDatabaseRealmForm[adminAction="); 88 sb.append(getAdminAction()); 89 sb.append(",resource="); 90 sb.append(getResource()); 91 sb.append("',objectName='"); 92 sb.append(getObjectName()); 93 sb.append("',realmType="); 94 sb.append(getRealmType()); 95 sb.append("]"); 96 return (sb.toString()); 97 98 } 99 100 110 111 public ActionErrors validate(ActionMapping mapping, 112 HttpServletRequest request) { 113 114 ActionErrors errors = new ActionErrors(); 115 116 String submit = request.getParameter("submit"); 117 118 if ((resource == null) || (resource.length() < 1)) { 121 errors.add("resource", 122 new ActionError("error.resource.required")); 123 } 124 return errors; 126 } 127 } 128 | Popular Tags |