FileDocCategorySizeDatePackage
RedirectSupport.javaAPI DocGlassfish v2 API4995Sat May 05 19:17:52 BST 2007org.apache.taglibs.standard.tag.common.core

RedirectSupport

public abstract class RedirectSupport extends javax.servlet.jsp.tagext.BodyTagSupport implements ParamParent

Support for tag handlers for <redirect>, JSTL 1.0's tag for redirecting to a new URL (with optional query parameters).

author
Shawn Bayern

Fields Summary
protected String
url
protected String
context
private String
var
private int
scope
private ParamSupport.ParamManager
params
Constructors Summary
public RedirectSupport()

	super();
	init();
    
Methods Summary
public voidaddParameter(java.lang.String name, java.lang.String value)

	params.addParameter(name, value);
    
public intdoEndTag()

	String result;				// the eventual result

	// add (already encoded) parameters
        String baseUrl = UrlSupport.resolveUrl(url, context, pageContext);
        result = params.aggregateParams(baseUrl);

        // if the URL is relative, rewrite it with 'redirect' encoding rules
        HttpServletResponse response =
            ((HttpServletResponse) pageContext.getResponse());
        if (!ImportSupport.isAbsoluteUrl(result))
            result = response.encodeRedirectURL(result);

	// redirect!
	try {
	    response.sendRedirect(result);
	} catch (java.io.IOException ex) {
	    throw new JspTagException(ex.toString(), ex);
	}

	return SKIP_PAGE;
    
public intdoStartTag()

	params = new ParamSupport.ParamManager();
	return EVAL_BODY_BUFFERED;
    
private voidinit()

	url = var = null;
	params = null;
	scope = PageContext.PAGE_SCOPE;
    
public voidrelease()

	init();
    
public voidsetScope(java.lang.String scope)

	this.scope = Util.getScope(scope);
    
public voidsetVar(java.lang.String var)

        this.var = var;