<%@ page language="java"
import="java.util.*,java.net.URL,java.io.*" pageEncoding="UTF-8"%>
<%
String feed = request.getParameter("feed");
if(feed != "" && feed.indexOf("http") == 0)
{
response.setContentType("text/xml");//设置响应的格式,一定要text/xml的,否则返回值中没有responseXML
URL url = new URL(feed);
InputStreamReader reader = new InputStreamReader(url.openStream());
BufferedReader breader = new BufferedReader(reader);
StringBuilder builder = new StringBuilder();
String line;
// For every line in the file, append it to the string builder
while((line = breader.readLine()) != null)
{
builder.append(line);
}
response.getWriter().write(builder.toString());
}
%>