KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > equinox > http > servlet > internal > RequestDispatcherAdaptor


1 /*******************************************************************************
2  * Copyright (c) 2005-2007 Cognos Incorporated, IBM Corporation and others
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * Cognos Incorporated - initial API and implementation
10  * IBM Corporation - bug fixes and enhancements
11  *******************************************************************************/

12 package org.eclipse.equinox.http.servlet.internal;
13
14 import java.io.IOException JavaDoc;
15 import javax.servlet.*;
16
17 //This class unwraps the request so it can be processed by the underlying servlet container.
18
public class RequestDispatcherAdaptor implements RequestDispatcher {
19
20     private RequestDispatcher requestDispatcher;
21
22     public RequestDispatcherAdaptor(RequestDispatcher requestDispatcher) {
23         this.requestDispatcher = requestDispatcher;
24     }
25
26     public void forward(ServletRequest req, ServletResponse resp) throws ServletException, IOException JavaDoc {
27         if (req instanceof HttpServletRequestAdaptor)
28             req = ((HttpServletRequestAdaptor) req).getRequest();
29
30         requestDispatcher.forward(req, resp);
31     }
32
33     public void include(ServletRequest req, ServletResponse resp) throws ServletException, IOException JavaDoc {
34         if (req instanceof HttpServletRequestAdaptor)
35             req = ((HttpServletRequestAdaptor) req).getRequest();
36
37         requestDispatcher.include(req, resp);
38     }
39 }
40
Popular Tags