1 28 29 package com.caucho.server.dispatch; 30 31 import javax.servlet.FilterChain ; 32 import javax.servlet.RequestDispatcher ; 33 import javax.servlet.ServletException ; 34 import javax.servlet.ServletRequest ; 35 import javax.servlet.ServletResponse ; 36 import javax.servlet.http.HttpServletRequest ; 37 import java.io.IOException ; 38 39 42 public class ForwardFilterChain implements FilterChain { 43 private String _url; 45 private RequestDispatcher _disp; 46 47 52 public ForwardFilterChain(String url) 53 { 54 _url = url; 55 } 56 57 62 public ForwardFilterChain(RequestDispatcher disp) 63 { 64 _disp = disp; 65 } 66 67 73 public void doFilter(ServletRequest request, 74 ServletResponse response) 75 throws ServletException , IOException 76 { 77 if (_disp != null) 78 _disp.forward(request, response); 79 else { 80 HttpServletRequest req = (HttpServletRequest ) request; 81 82 RequestDispatcher disp = req.getRequestDispatcher(_url); 83 84 disp.forward(request, response); 85 } 86 } 87 88 public String toString() 89 { 90 if (_disp != null) 91 return "ForwardFilterChain[" + _disp + "]"; 92 else 93 return "ForwardFilterChain[" + _url + "]"; 94 } 95 } 96 | Popular Tags |