package p2.webclient.system.tags;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;

import p2.webclient.system.controller.AppInstance;
import p2.webclient.system.controller.ControlHandler;
import p2.webclient.system.controller.ControlProperties;
import p2.webclient.system.controller.SessionContext;
import p2.webclient.system.controller.WebClientEvent;

@SuppressWarnings("serial")
public class WebClientTagSupport extends BodyTagSupport {
    /**
     * WebClientEvent
     */
    protected WebClientEvent a = null;
    /**
     * SessionContext
     */
    protected SessionContext b = null;
    /**
     * AppInstance
     */
    protected AppInstance c = null;
    /**
     * ControlHandler
     */
    protected ControlHandler d = null;
    /**
     * ControlProperties
     */
    protected ControlProperties e = null;

    @Override
    public int doStartTag() throws JspException {
        try {
            HttpServletRequest localHttpServletRequest = (HttpServletRequest) this.pageContext.getRequest();
            this.b = SessionContext.getSessionContext(localHttpServletRequest);
            this.a = this.b.getCurrentEvent();
            this.c = this.b.getCurrentApp();
            this.d = this.b.getCurrentEventHandler();
            this.e = this.d.getProperties();
            return 0;
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }

    @Override
    public void release() {
        this.b.printDebugMessage("JSPEVENT", "END TAG: " + getClass().getName());
        this.a = null;
        this.b = null;
        this.c = null;
        this.d = null;
        this.e = null;
    }
}
