コード例 #1
0
 /** @return true if the request was served. */
 private boolean proxyRemoteUrl(
     HttpServletRequest req, HttpServletResponse resp, final URL mappedURL, boolean failEarlyOn404)
     throws IOException, ServletException, UnknownHostException {
   ProxyServlet proxy = new RemoteURLProxyServlet(mappedURL, failEarlyOn404);
   proxy.init(getServletConfig());
   try {
     traceRequest(req);
     try {
       proxy.service(req, resp);
     } catch (NotFoundException ex) {
       // This exception is only thrown in the "fail early on 404" case, in which case
       // no output was written and we didn't serve the request.
       return false;
     }
   } finally {
     proxy.destroy();
   }
   // We served this request
   return true;
 }
コード例 #2
0
 @Override
 public void init(ServletConfig config) throws ServletException {
   super.init(config);
 }