package com.acme.tag; import javax.servlet.jsp.tagext.SimpleTagSupport; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; /** * @author Magnus Rydin * Date: 2005-feb-15 * Time: 12:42:10 */ public class RemoteIncludeTag extends SimpleTagSupport { private String location; /* private int cacheTimeout; */ public void setLocation(String location) { this.location=location; } /* public void setTimeout(int timeout) { this.cacheTimeout=timeout; } */ public void doTag() throws JspException, IOException { URL resource = new URL(location); BufferedReader in = new BufferedReader(new InputStreamReader(resource.openStream())); String inputLine; JspWriter out = this.getJspContext().getOut(); while ((inputLine = in.readLine()) != null) out.print(inputLine); in.close(); } }