1 23 package com.sun.enterprise.deployment; 24 25 import com.sun.enterprise.deployment.web.WebResourceCollection; 26 import java.util.*; 27 28 35 36 37 public class WebResourceCollectionImpl extends Descriptor 38 implements WebResourceCollection 39 { 40 private Set urlPatterns; 41 private Set httpMethods; 42 43 47 public Enumeration getUrlPatterns() { 48 return (new Vector(this.getUrlPatternsSet())).elements(); 49 } 50 51 55 public void addUrlPattern(String urlPattern) { 56 this.getUrlPatternsSet().add(urlPattern); 57 } 58 59 63 public void removeUrlPattern(String urlPattern) { 64 this.getUrlPatternsSet().remove(urlPattern); 65 } 66 67 72 public void setUrlPatterns(Set urlPatterns) { 73 this.urlPatterns = urlPatterns; 74 } 75 76 private Set getHttpMethodsSet() { 77 if (this.httpMethods == null) { 78 this.httpMethods = new HashSet(); 79 } 80 return this.httpMethods; 81 } 82 83 87 public Enumeration getHttpMethods() { 88 return (new Vector(this.getHttpMethodsSet())).elements(); 89 } 90 94 97 public String [] getHttpMethodsAsArray(){ 98 if(httpMethods == null){ 99 return (String []) null; 100 } 101 String [] array = (String [])httpMethods.toArray(new String [0]); 102 return array; 103 } 104 108 public void setHttpMethods(Set httpMethods) { 109 this.httpMethods = httpMethods; 110 } 111 112 117 public void addHttpMethod(String httpMethod) { 118 this.getHttpMethodsSet().add(httpMethod); 119 } 120 121 125 public void removeHttpMethod(String httpMethod) { 126 this.getHttpMethodsSet().remove(httpMethod); 127 } 128 129 132 public void print(StringBuffer toStringBuffer) { 133 toStringBuffer.append("WebresourceCollection: "); 134 toStringBuffer.append(" urlPatterns: ").append(this.urlPatterns); 135 toStringBuffer.append(" httpMethods ").append(this.httpMethods); 136 } 137 138 private Set getUrlPatternsSet() { 139 if (this.urlPatterns == null) { 140 this.urlPatterns = new HashSet(); 141 } 142 return this.urlPatterns; 143 } 144 145 } 146 147 | Popular Tags |