Revision: 16519
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 7, 2009 01:01 by stoyan
Initial Code
<%@page session="false"%> <%@page import="java.net.*,java.io.*" %> <% try { String reqUrl = request.getQueryString(); URL url = new URL(reqUrl); HttpURLConnection con = (HttpURLConnection)url.openConnection(); con.setDoOutput(true); con.setRequestMethod(request.getMethod()); int clength = request.getContentLength(); if(clength > 0) { con.setDoInput(true); byte[] idata = new byte[clength]; request.getInputStream().read(idata, 0, clength); con.getOutputStream().write(idata, 0, clength); } response.setContentType(con.getContentType()); BufferedReader rd = new BufferedReader(new InputStreamReader(con.getInputStream())); String line; while ((line = rd.readLine()) != null) { out.println(line); } rd.close(); } catch(Exception e) { response.setStatus(500); } %>
Initial URL
Initial Description
*save as proxy.jsp and put it in your servlet container *consider using other methods to circumvent XSS: JSONP, dojox.io.xhrWindowNamePlugin, etc.
Initial Title
JSP proxy for JavaScript applications
Initial Tags
javascript, java
Initial Language
Java