1 20 package org.apache.cactus.server; 21 22 import java.io.IOException ; 23 24 import javax.servlet.RequestDispatcher ; 25 import javax.servlet.ServletException ; 26 import javax.servlet.ServletRequest ; 27 import javax.servlet.ServletResponse ; 28 29 36 public class RequestDispatcherWrapper implements RequestDispatcher 37 { 38 41 private RequestDispatcher originalDispatcher; 42 43 46 public RequestDispatcherWrapper(RequestDispatcher theOriginalDispatcher) 47 { 48 this.originalDispatcher = theOriginalDispatcher; 49 } 50 51 61 public void forward(ServletRequest theRequest, ServletResponse theResponse) 62 throws IOException , ServletException 63 { 64 if (HttpServletRequestWrapper.class.isAssignableFrom( 66 theRequest.getClass())) 67 { 68 HttpServletRequestWrapper request = 69 (HttpServletRequestWrapper) theRequest; 70 71 this.originalDispatcher.forward(request.getOriginalRequest(), 72 theResponse); 73 } 74 else 75 { 76 this.originalDispatcher.forward(theRequest, theResponse); 77 } 78 } 79 80 90 public void include(ServletRequest theRequest, ServletResponse theResponse) 91 throws IOException , ServletException 92 { 93 if (HttpServletRequestWrapper.class.isAssignableFrom( 95 theRequest.getClass())) 96 { 97 HttpServletRequestWrapper request = 98 (HttpServletRequestWrapper) theRequest; 99 100 this.originalDispatcher.include(request.getOriginalRequest(), 101 theResponse); 102 } 103 else 104 { 105 this.originalDispatcher.include(theRequest, theResponse); 106 } 107 } 108 } 109 | Popular Tags |