/ Published in: Java
*save as proxy.jsp and put it in your servlet container
*consider using other methods to circumvent XSS: JSONP, dojox.io.xhrWindowNamePlugin, etc.
*consider using other methods to circumvent XSS: JSONP, dojox.io.xhrWindowNamePlugin, etc.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<%@page session="false"%> <%@page import="java.net.*,java.io.*" %> <% try { 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()); String line; while ((line = rd.readLine()) != null) { out.println(line); } rd.close(); response.setStatus(500); } %>