158 private transient String ssp; // scheme specific part
159 private transient String path;
160 private transient List<String> methods;
161 private transient List<String> requestHeaders;
162 private transient Authority authority;
163
164 // serialized field
165 private String actions;
166
167 /**
168 * Creates a new URLPermission from a url string and which permits the given
169 * request methods and user-settable request headers.
170 * The name of the permission is the url string it was created with. Only the scheme,
171 * authority and path components of the url are used internally. Any fragment or query
172 * components are ignored. The permissions action string is as specified above.
173 *
174 * @param url the url string
175 *
176 * @param actions the actions string
177 *
178 * @exception IllegalArgumentException if url is invalid or if actions contains white-space.
179 */
180 public URLPermission(String url, String actions) {
181 super(normalize(url));
182 init(actions);
183 }
184
185 /**
186 * Remove any query or fragment from url string
187 */
188 private static String normalize(String url) {
189 int index = url.indexOf('?');
190 if (index >= 0) {
191 url = url.substring(0, index);
192 } else {
193 index = url.indexOf('#');
194 if (index >= 0) {
195 url = url.substring(0, index);
196 }
197 }
198 return url;
|
158 private transient String ssp; // scheme specific part
159 private transient String path;
160 private transient List<String> methods;
161 private transient List<String> requestHeaders;
162 private transient Authority authority;
163
164 // serialized field
165 private String actions;
166
167 /**
168 * Creates a new URLPermission from a url string and which permits the given
169 * request methods and user-settable request headers.
170 * The name of the permission is the url string it was created with. Only the scheme,
171 * authority and path components of the url are used internally. Any fragment or query
172 * components are ignored. The permissions action string is as specified above.
173 *
174 * @param url the url string
175 *
176 * @param actions the actions string
177 *
178 * @throws IllegalArgumentException if url is invalid or if actions contains white-space.
179 */
180 public URLPermission(String url, String actions) {
181 super(normalize(url));
182 init(actions);
183 }
184
185 /**
186 * Remove any query or fragment from url string
187 */
188 private static String normalize(String url) {
189 int index = url.indexOf('?');
190 if (index >= 0) {
191 url = url.substring(0, index);
192 } else {
193 index = url.indexOf('#');
194 if (index >= 0) {
195 url = url.substring(0, index);
196 }
197 }
198 return url;
|