1 16 package org.apache.webapp.balancer.rules; 17 18 import org.apache.webapp.balancer.Rule; 19 20 import javax.servlet.http.HttpServletRequest ; 21 22 23 30 public abstract class BaseRule implements Rule { 31 34 private String name; 35 36 40 private String redirectUrl; 41 42 47 public void setName(String theName) { 48 if (theName == null) { 49 throw new IllegalArgumentException ("The name cannot be null."); 50 } else { 51 name = theName; 52 } 53 } 54 55 60 protected String getName() { 61 return name; 62 } 63 64 67 public String getRedirectUrl() { 68 return redirectUrl; 69 } 70 71 76 public void setRedirectUrl(String theRedirectUrl) { 77 if (theRedirectUrl == null) { 78 throw new IllegalArgumentException ("redirectUrl may not be null."); 79 } else { 80 redirectUrl = theRedirectUrl; 81 } 82 } 83 84 87 public abstract boolean matches(HttpServletRequest request); 88 89 94 public String toString() { 95 StringBuffer buffer = new StringBuffer (); 96 97 buffer.append("["); 98 buffer.append(getClass().getName()); 99 buffer.append(": "); 100 101 buffer.append("Redirect URL: "); 102 buffer.append(getRedirectUrl()); 103 104 buffer.append("]"); 105 106 return buffer.toString(); 107 } 108 } 109 110 111 | Popular Tags |