1 import java.io.*; 2 import java.net.*; 3 import javax.servlet.*; 4 import javax.servlet.http.*; 5 import org.faceless.report.*; 6 import org.xml.sax.*; 7 8 48 public class SampleServlet extends PDFProxyServlet 49 { 50 public String getProxyURL(HttpServletRequest req, HttpServletResponse res) 51 throws ServletException, IOException 52 { 53 String dest = req.getPathInfo(); 54 if (req.getQueryString()!=null) dest += "?"+req.getQueryString(); 55 URL thisurl = new URL(HttpUtils.getRequestURL(req).toString()); 56 57 try { 58 if (dest==null) throw new MalformedURLException(); 59 URL url = new URL(thisurl, res.encodeURL(dest)); 60 System.err.println("PDF REPORT: Proxying request to "+url); 61 return url.toString(); 62 } catch (MalformedURLException e) { 63 res.sendError(404, "Illegal URL \""+dest+"\""); 64 return null; 65 } 66 } 67 } 68 | Popular Tags |