当前位置: 首页 > 工具软件 > php-proxy-app > 使用案例 >

Extjs-examples-app-feedviewer中的通过feed-proxy.php改写的feed-proxy.jsp

壤驷华辉
2023-12-01
<%@ 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());
	}
%>


 类似资料: