01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.terracotta.session;
06:
07: import java.io.IOException;
08:
09: import javax.servlet.RequestDispatcher;
10: import javax.servlet.ServletException;
11: import javax.servlet.ServletRequest;
12: import javax.servlet.ServletResponse;
13:
14: public class TerracottaDispatcher implements RequestDispatcher {
15:
16: private RequestDispatcher originalDispatcher;
17:
18: public TerracottaDispatcher(RequestDispatcher originalDispatcher) {
19: this .originalDispatcher = originalDispatcher;
20: }
21:
22: public void forward(ServletRequest servletrequest,
23: ServletResponse servletresponse) throws ServletException,
24: IOException {
25:
26: // Add our special forward attribute. WL 8.1 predates the official servlet attributes from Servlet 2.4 spec,
27: // so we will key off this attribute in SessionRequest to determine whether the request is a forward
28: servletrequest.setAttribute(
29: SessionRequest.SESSION_FORWARD_ATTRIBUTE_NAME,
30: Boolean.TRUE);
31:
32: originalDispatcher.forward(servletrequest, servletresponse);
33: }
34:
35: public void include(ServletRequest servletrequest,
36: ServletResponse servletresponse) throws ServletException,
37: IOException {
38:
39: originalDispatcher.include(servletrequest, servletresponse);
40: }
41:
42: }
|