Example usage for javax.servlet.jsp JspException JspException

List of usage examples for javax.servlet.jsp JspException JspException

Introduction

In this page you can find the example usage for javax.servlet.jsp JspException JspException.

Prototype

public JspException(String message, Throwable cause) 

Source Link

Document

Constructs a new JspException with the specified detail message and cause.

Usage

From source file:com.redhat.rhn.frontend.taglibs.list.RowRendererTag.java

/**
 * {@inheritDoc}//from  w ww. java 2s  .co m
 */
public int doEndTag() throws JspException {
    ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext);
    if (command.equals(ListCommand.ENUMERATE)) {
        if (!StringUtils.isBlank(name)) {
            ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this, ListTag.class);

            try {
                ClassLoader cl = Thread.currentThread().getContextClassLoader();

                if (name.indexOf('.') == -1) {
                    name = "com.redhat.rhn.frontend.taglibs.list.row." + name;
                }
                RowRenderer row = (RowRenderer) cl.loadClass(name).newInstance();
                if (!StringUtils.isEmpty(classes)) {
                    row.setRowClasses(classes);
                }
                parent.setRowRenderer(row);

            } catch (Exception e) {
                String msg = "Exception while adding Decorator [" + name + "]";
                throw new JspException(msg, e);
            }
        }
    }
    return super.doEndTag();
}

From source file:com.agiletec.aps.tags.URLTag.java

/**
 * Prepares a PageURL object; this object may comprehend several sub-tags
 *//*from   w ww. j  av  a2  s  . c  o  m*/
@Override
public int doStartTag() throws JspException {
    ServletRequest request = this.pageContext.getRequest();
    RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
    try {
        IURLManager urlManager = (IURLManager) ApsWebApplicationUtils.getBean(SystemConstants.URL_MANAGER,
                this.pageContext);
        this._pageUrl = urlManager.createURL(reqCtx);
        if (_pageCode != null) {
            _pageUrl.setPageCode(_pageCode);
        }
        if (_langCode != null) {
            _pageUrl.setLangCode(_langCode);
        }
        if (this.isParamRepeat()) {
            List<String> exclusion = this.getParametersToExclude();
            _pageUrl.setParamRepeat(exclusion);
        }
    } catch (Throwable t) {
        _logger.error("Error during tag initialization", t);
        throw new JspException("Error during tag initialization", t);
    }
    return EVAL_BODY_INCLUDE;
}

From source file:org.shredzone.cilla.web.tag.RenderTag.java

@Override
public int doStartTag() throws JspException {
    try {//from w w  w  .  j  a  v a 2 s . co m
        context = fragmentService.createContext(pageContext);
        context.setRootObject(item);
    } catch (CillaServiceException ex) {
        throw new JspException("Could not generate FragmentContext", ex);
    }

    return EVAL_BODY_INCLUDE;
}

From source file:com.redhat.rhn.frontend.taglibs.RhnHiddenTag.java

/**
 * {@inheritDoc}//from www  . j av a  2 s. c  o m
 */
@Override
public int doStartTag() throws JspException {
    JspWriter out = null;
    try {
        StringBuffer buf = new StringBuffer();
        out = pageContext.getOut();

        HtmlTag baseTag = new HiddenInputTag();
        if (!StringUtils.isBlank(getId())) {
            baseTag.setAttribute("id", getId());
        }
        baseTag.setAttribute("name", getName());
        baseTag.setAttribute("value", StringEscapeUtils.escapeHtml(getValue()));
        buf.append(baseTag.render());
        out.print(buf.toString());
        return SKIP_BODY;
    } catch (Exception e) {
        throw new JspException("Error writing to JSP file:", e);
    }
}

From source file:de.micromata.genome.gwiki.web.tags.GWikiTagRenderUtils.java

public static void write(PageContext pageContext, String data) throws JspException {
    try {//from   w ww  .  j av a2  s . c om
        pageContext.getOut().write(data);
    } catch (IOException e) {
        throw new JspException("Failure writing tag", e);
    }
}

From source file:com.agiletec.plugins.jpcrowdsourcing.aps.tags.IdeaTagListTag.java

@Override
public int doEndTag() throws JspException {
    ServletRequest request = this.pageContext.getRequest();
    RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
    try {//from   ww  w  .j a v  a  2 s  . co m
        List<CategoryInfoBean> list = this.loadTags(reqCtx);
        this.pageContext.setAttribute(this.getVar(), list);
    } catch (Throwable t) {
        _logger.error("error in doEndTag", t);
        throw new JspException("Errore tag", t);
    }
    this.release();
    return super.doEndTag();
}

From source file:com.agiletec.plugins.jpblog.aps.tags.BlogArchiveTag.java

@Override
public int doEndTag() throws JspException {
    ServletRequest request = this.pageContext.getRequest();
    RequestContext reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
    try {//from w  w w.  j a v a  2  s.c o m
        IBlogArchiveTagHelper helper = (IBlogArchiveTagHelper) ApsWebApplicationUtils
                .getBean(JpblogSystemConstants.BLOG_ARCHIVE_TAG_HELPER, this.pageContext);
        List<BlogArchiveInfoBean> list = helper.getBlogArchiveList(this, reqCtx);
        this.pageContext.setAttribute(this.getVar(), list);
    } catch (Throwable t) {
        _logger.error("error in doEndTag", t);
        throw new JspException("Error detected while finalising the tag", t);
    }
    this.release();
    return EVAL_PAGE;
}

From source file:com.agiletec.plugins.jpcmstagcloud.aps.tags.TagCloudBuilderTag.java

@Override
public int doStartTag() throws JspException {
    ITagCloudManager tagCloudManager = (ITagCloudManager) ApsWebApplicationUtils
            .getBean(JpcmstagcloudSystemConstants.TAG_CLOUD_MANAGER, this.pageContext);
    try {//from   w  w w .  j a  v  a2 s .  c om
        UserDetails currentUser = (UserDetails) this.pageContext.getSession()
                .getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
        Map<ITreeNode, Integer> occurrences = tagCloudManager.getCloudInfos(currentUser);
        if (null != this.getOccurrencesVar()) {
            this.pageContext.setAttribute(this.getOccurrencesVar(), occurrences);
        }
        List<CloudInfoBean> cloudBeans = this.buildCloudsInfoBeans(occurrences);
        this.pageContext.setAttribute(this.getCloudBeansVar(), cloudBeans);
    } catch (Throwable t) {
        _logger.error("Error in doStartTag", t);
        throw new JspException("Error in doStartTag", t);
    }
    return super.doStartTag();
}

From source file:com.agiletec.aps.tags.URLTag.java

/**
 * Completes the URL generation making it available for immediate
 * output or placing it in a variable/* www .  ja  v  a  2  s  . c om*/
 */
@Override
public int doEndTag() throws JspException {
    String url = _pageUrl.getURL();
    if (this.getVar() != null) {
        this.pageContext.setAttribute(this.getVar(), url);
    } else {
        try {
            this.pageContext.getOut().print(url);
        } catch (Throwable t) {
            _logger.error("Error closing tag", t);
            throw new JspException("Error closing tag", t);
        }
    }
    return EVAL_PAGE;
}

From source file:com.glaf.jbpm.tag.JbpmProcessImageTag.java

public int doEndTag() throws JspException {
    JbpmContext jbpmContext = null;//from   www . j a  v  a 2  s. co m
    HttpServletRequest request = null;
    try {
        request = (HttpServletRequest) pageContext.getRequest();
        contextPath = request.getContextPath();
        jbpmContext = ProcessContainer.getContainer().createJbpmContext();
        initialize(jbpmContext);
        if (processInstance != null && processDefinition != null) {
            retrieveByteArrays();
            if (gpdBytes != null && imageBytes != null) {
                writeTable();
            }
        }
    } catch (IOException e) {
        throw new JspException("table couldn't be displayed", e);
    } catch (DocumentException e) {
        throw new JspException("table couldn't be displayed", e);
    } catch (Throwable ex) {
    } finally {
        release();
        try {
            Context.close(jbpmContext);
        } catch (java.lang.Throwable ex) {
        }
    }
    return EVAL_PAGE;
}