View Javadoc
1   /*
2    *  This file is part of the Wayback archival access software
3    *   (http://archive-access.sourceforge.net/projects/wayback/).
4    *
5    *  Licensed to the Internet Archive (IA) by one or more individual 
6    *  contributors. 
7    *
8    *  The IA licenses this file to You under the Apache License, Version 2.0
9    *  (the "License"); you may not use this file except in compliance with
10   *  the License.  You may obtain a copy of the License at
11   *
12   *      http://www.apache.org/licenses/LICENSE-2.0
13   *
14   *  Unless required by applicable law or agreed to in writing, software
15   *  distributed under the License is distributed on an "AS IS" BASIS,
16   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   *  See the License for the specific language governing permissions and
18   *  limitations under the License.
19   */
20  package org.archive.wayback.util.webapp;
21  
22  /**
23   * A simple composition of the RequestHandler which an HttpServletRequest was
24   * mapped to, and the path prefix which indicated the RequestHandler. This 
25   * allows computing the portion of the original request path within the 
26   * RequestHandler.
27   * 
28   * @author brad
29   *
30   */
31  public class RequestHandlerContext {
32  
33  	private RequestHandler handler = null;
34  	private String pathPrefix = null;
35  	
36  	/**
37  	 * Constructor
38  	 * @param handler the RequestHandler to which the incoming request was 
39  	 * mapped
40  	 * @param pathPrefix the leading portion of the original request path that
41  	 * indicated the RequestHandler
42  	 */
43  	public RequestHandlerContext(RequestHandler handler, String pathPrefix) {
44  		this.handler = handler;
45  		this.pathPrefix = pathPrefix;
46  	}
47  	/**
48  	 * @return the RequestHandler to which the incoming request was mapped.
49  	 */
50  	public RequestHandler getRequestHandler() {
51  		return handler;
52  	}
53  	/**
54  	 * @return the leading portion of the original request path that
55  	 * indicated the RequestHandler
56  	 */
57  	public String getPathPrefix() {
58  		return pathPrefix;
59  	}
60  }