<%@ 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());
}
%>
Extjs-examples-app-feedviewer中的通过feed-proxy.php改写的feed-proxy.jsp
最新推荐文章于 2024-09-08 12:41:07 发布