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(Throwable cause) 

Source Link

Document

Constructs a new JspException with the specified cause.

Usage

From source file:com.googlecode.spring.appengine.taglib.RuntimeVersionTag.java

@Override
public int doEndTag() throws JspException {
    String version = SystemProperty.version.get();
    if (var == null) {
        try {//  w  ww .  ja  v a  2s  . co m
            pageContext.getOut().print(version);
        } catch (IOException e) {
            throw new JspException(e);
        }
    } else {
        pageContext.setAttribute(var, version, scope);
    }
    return Tag.EVAL_PAGE;
}

From source file:com.googlecode.spring.appengine.taglib.RuntimeEnvironmentTag.java

@Override
public int doEndTag() throws JspException {
    String environment = SystemProperty.environment.get();
    if (var == null) {
        try {//from w  w w. j  a v a 2  s . co m
            pageContext.getOut().print(environment);
        } catch (IOException e) {
            throw new JspException(e);
        }
    } else {
        pageContext.setAttribute(var, environment, scope);
    }
    return Tag.EVAL_PAGE;
}

From source file:com.googlecode.spring.appengine.taglib.ApplicationIdTag.java

@Override
public int doEndTag() throws JspException {
    String applicationId = SystemProperty.applicationId.get();
    if (var == null) {
        try {/*from  ww  w.  ja  va  2  s  . c o m*/
            pageContext.getOut().print(applicationId);
        } catch (IOException e) {
            throw new JspException(e);
        }
    } else {
        pageContext.setAttribute(var, applicationId, scope);
    }
    return Tag.EVAL_PAGE;
}

From source file:com.googlecode.psiprobe.jsp.VolumeTag.java

public int doStartTag() throws JspException {
    String title = Long.toString(value);
    String newValue = SizeExpression.format(value, fractions, true);
    try {//from   w w  w  . j  av  a 2 s  . c  om
        pageContext.getOut().write("<span title=\"" + title + "\">" + newValue + "</span>");
    } catch (IOException e) {
        logger.debug("Exception writing value to JspWriter", e);
        throw new JspException(e);
    }

    return EVAL_BODY_INCLUDE;
}

From source file:org.lightadmin.core.view.editor.JspFragmentFieldControl.java

@Override
public void doTag() throws JspException, IOException {
    addAttribute("field", field);
    addAttribute("attributeMetadata", persistentProperty);
    prepare();//from www. j  av a  2s.c  o  m
    PageContext pageContext = (PageContext) getJspContext();
    try {
        pageContext.include(jspPath, true);
    } catch (ServletException e) {
        throw new JspException(e);
    } finally {
        pageContext.removeAttribute("field", REQUEST_SCOPE);
        pageContext.removeAttribute("attributeMetadata", REQUEST_SCOPE);
    }
}

From source file:com.googlecode.psiprobe.jsp.AddQueryParamTag.java

public int doStartTag() throws JspException {
    StringBuffer query = new StringBuffer();
    query.append(param).append("=").append(value);
    for (Enumeration en = pageContext.getRequest().getParameterNames(); en.hasMoreElements();) {
        String name = (String) en.nextElement();
        if (!param.equals(name)) {
            query.append("&").append(name).append("=")
                    .append(ServletRequestUtils.getStringParameter(pageContext.getRequest(), name, ""));
        }//from  ww  w  .j  a  va2s  . c  om
    }
    try {
        pageContext.getOut().print(query);
    } catch (IOException e) {
        logger.debug("Exception printing query string to JspWriter", e);
        throw new JspException(e);
    }
    return EVAL_BODY_INCLUDE;
}

From source file:de.dentrassi.osgi.web.form.tags.OptionList.java

protected void renderOption(final WriterHelper writer, final Object o) throws JspException {
    try {// w ww .jav  a 2 s .co  m
        final Object result = BeanUtils.getProperty(o, this.itemValue);
        renderOption(writer, result, o, false);
    } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
            | InvocationTargetException e) {
        throw new JspException(e);
    }
}

From source file:edu.duke.cabig.c3pr.web.jsp.tags.TabAccessControlTag.java

public int doStartTag() throws JspException {
    if (tabAuthorizationCheckName == null || tabAuthorizationCheckName.trim().length() == 0) {
        throw new JspException("authorizationCheckName is required");
    }//from ww w .  j  a  v  a 2s  .  co m

    String evaledAuthorizationCheckName = ExpressionEvaluationUtils.evaluateString("authorizationCheckName",
            tabAuthorizationCheckName, pageContext);

    String evaledPrivilegesString = hasPrivilege;
    if (evaledPrivilegesString != null && evaledPrivilegesString.trim().length() > 0) {
        evaledPrivilegesString = ExpressionEvaluationUtils.evaluateString("hasPrivileges", hasPrivilege,
                pageContext);
    }

    String[] requiredPrivileges = evaledPrivilegesString.split(",");

    Object resolvedDomainObject = null;

    if (domainObject instanceof String) {
        resolvedDomainObject = ExpressionEvaluationUtils.evaluate("domainObject", (String) domainObject,
                Object.class, pageContext);
    } else {
        resolvedDomainObject = domainObject;
    }

    if (resolvedDomainObject == null) {

        logger.debug("domainObject resolved to null, so including tag body");

        return Tag.EVAL_BODY_INCLUDE;
    }

    Authentication auth = getAuthentication();

    ApplicationContext context = getContext(pageContext);

    TabAuthroizationCheck tabAutzCheck = (TabAuthroizationCheck) context.getBean(evaledAuthorizationCheckName);
    if (tabAutzCheck == null) {
        throw new JspException(
                "No authorization check found for bean name '" + evaledAuthorizationCheckName + "'.");
    }

    for (String requiredPrivilege : requiredPrivileges) {

        if (tabAutzCheck.checkAuthorization(auth, requiredPrivilege, tab, resolvedDomainObject, scope)) {
            logger.debug("Authorization succeeded, evaluating body");
            return Tag.EVAL_BODY_INCLUDE;
        }

    }

    logger.debug("No permission, so skipping tag body");

    return Tag.SKIP_BODY;
}

From source file:net.testdriven.psiprobe.jsp.AddQueryParamTag.java

@Override
public int doStartTag() throws JspException {
    StringBuffer query = new StringBuffer();
    query.append(param).append("=").append(value);
    for (Enumeration en = pageContext.getRequest().getParameterNames(); en.hasMoreElements();) {
        String name = (String) en.nextElement();
        if (!param.equals(name)) {
            query.append("&").append(name).append("=")
                    .append(ServletRequestUtils.getStringParameter(pageContext.getRequest(), name, ""));
        }// w  ww . j a v  a 2s.c o  m
    }
    try {
        pageContext.getOut().print(query);
    } catch (IOException e) {
        logger.debug("Exception printing query string to JspWriter", e);
        throw new JspException(e);
    }
    return EVAL_BODY_INCLUDE;
}

From source file:com.googlecode.spring.appengine.taglib.LogoutUrlTag.java

@Override
public int doEndTag() throws JspException {
    String loginUrl = UserServiceFactory.getUserService().createLogoutURL(destinationUrl);
    if (var == null) {
        try {//  w w w . j a va2s.  c o  m
            pageContext.getOut().print(loginUrl);
        } catch (IOException e) {
            throw new JspException(e);
        }
    } else {
        pageContext.setAttribute(var, loginUrl, scope);
    }
    return Tag.EVAL_PAGE;
}