package com.cidat.proclets;


public class RedirectProclet implements Proclet {
	String servletPath = null;
	String anchorExpr = null;
	String addParamsExpr = null;
	String absoluteUrlExpr = null;

	public RedirectProclet(String servletPath, String addParamsExpr) {
		this.servletPath = servletPath;
		this.addParamsExpr = addParamsExpr;
		this.anchorExpr = "";
	}

	public RedirectProclet(String servletPath, String addParamsExpr,
			String anchorExpr) {
		this.servletPath = servletPath;
		this.addParamsExpr = addParamsExpr;
		this.anchorExpr = anchorExpr;
	}

	public RedirectProclet(String absoluteUrlExpr) {
		this.absoluteUrlExpr = absoluteUrlExpr;
	}

	public void process(ProcletServiceData sd) throws ProcletException {
		sd.clearRedirect();

		if ((this.absoluteUrlExpr == null) && (this.addParamsExpr == null)) {
			return;
		}

		if (this.absoluteUrlExpr != null) {
			sd.absRedirect = sd.res
					.encodeURL(sd.evalExpr(this.absoluteUrlExpr));
			return;
		}

		sd.relRedirectServletPath = this.servletPath;
		sd.relRedirectAddParams = this.addParamsExpr;
		sd.relRedirectAnchor = this.anchorExpr;
	}
}

/*
 * Location:
 * D:\svn\ejie\q53.trunk\codigo\q53\q53ItourbaskWar\WebContent\WEB-INF\
 * lib\proclets_wl81.jar Qualified Name: com.cidat.proclets.RedirectProclet
 * JD-Core Version: 0.6.0
 */