Search in sources :

Example 1 with JspTagException

use of javax.servlet.jsp.JspTagException in project tomcat by apache.

the class FooTag method doAfterBody.

@Override
public int doAfterBody() throws JspException {
    try {
        if (i == 3) {
            bodyOut.writeOut(bodyOut.getEnclosingWriter());
            return SKIP_BODY;
        }
        pageContext.setAttribute("member", atts[i]);
        i++;
        return EVAL_BODY_BUFFERED;
    } catch (IOException ex) {
        throw new JspTagException(ex.toString());
    }
}
Also used : IOException(java.io.IOException) JspTagException(javax.servlet.jsp.JspTagException)

Example 2 with JspTagException

use of javax.servlet.jsp.JspTagException in project tomcat by apache.

the class LogTag method doAfterBody.

@Override
public int doAfterBody() throws JspException {
    try {
        String s = bodyOut.getString();
        System.err.println(s);
        if (toBrowser)
            bodyOut.writeOut(bodyOut.getEnclosingWriter());
        return SKIP_BODY;
    } catch (IOException ex) {
        throw new JspTagException(ex.toString());
    }
}
Also used : IOException(java.io.IOException) JspTagException(javax.servlet.jsp.JspTagException)

Example 3 with JspTagException

use of javax.servlet.jsp.JspTagException in project tomcat by apache.

the class ShowSource method doEndTag.

@Override
public int doEndTag() throws JspException {
    if ((jspFile.indexOf("..") >= 0) || (jspFile.toUpperCase(Locale.ENGLISH).indexOf("/WEB-INF/") != 0) || (jspFile.toUpperCase(Locale.ENGLISH).indexOf("/META-INF/") != 0))
        throw new JspTagException("Invalid JSP file " + jspFile);
    try (InputStream in = pageContext.getServletContext().getResourceAsStream(jspFile)) {
        if (in == null)
            throw new JspTagException("Unable to find JSP file: " + jspFile);
        JspWriter out = pageContext.getOut();
        try {
            out.println("<body>");
            out.println("<pre>");
            for (int ch = in.read(); ch != -1; ch = in.read()) if (ch == '<')
                out.print("&lt;");
            else
                out.print((char) ch);
            out.println("</pre>");
            out.println("</body>");
        } catch (IOException ex) {
            throw new JspTagException("IOException: " + ex.toString());
        }
    } catch (IOException ex2) {
        throw new JspTagException("IOException: " + ex2.toString());
    }
    return super.doEndTag();
}
Also used : InputStream(java.io.InputStream) IOException(java.io.IOException) JspWriter(javax.servlet.jsp.JspWriter) JspTagException(javax.servlet.jsp.JspTagException)

Example 4 with JspTagException

use of javax.servlet.jsp.JspTagException in project jetty.project by eclipse.

the class DateTag method doAfterBody.

public int doAfterBody() throws JspException {
    try {
        SimpleDateFormat format = new SimpleDateFormat(body.getString());
        format.setTimeZone(TimeZone.getTimeZone(tz));
        body.getEnclosingWriter().write(format.format(new Date()));
        return SKIP_BODY;
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new JspTagException(ex.toString());
    }
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) JspTagException(javax.servlet.jsp.JspTagException) Date(java.util.Date) JspException(javax.servlet.jsp.JspException) JspTagException(javax.servlet.jsp.JspTagException)

Example 5 with JspTagException

use of javax.servlet.jsp.JspTagException in project grails-core by grails.

the class JspInvokeGrailsTagLibTag method doEndTag.

@Override
public int doEndTag() throws JspException {
    if (!bodyInvokation) {
        if (tagContent == null) {
            tagContent = sw.toString();
        }
        if (tagContent != null) {
            try {
                jspWriter = pageContext.getOut();
                jspWriter.write(tagContent);
                out.close();
            } catch (IOException e) {
                throw new JspTagException("I/O error writing tag contents [" + tagContent + "] to response out");
            }
        }
    }
    return SKIP_BODY;
}
Also used : IOException(java.io.IOException) JspTagException(javax.servlet.jsp.JspTagException)

Aggregations

JspTagException (javax.servlet.jsp.JspTagException)12 IOException (java.io.IOException)8 JspException (javax.servlet.jsp.JspException)2 InputStream (java.io.InputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Locale (java.util.Locale)1 RequestDispatcher (javax.servlet.RequestDispatcher)1 ServletException (javax.servlet.ServletException)1 JspWriter (javax.servlet.jsp.JspWriter)1 BodyContent (javax.servlet.jsp.tagext.BodyContent)1 SlingHttpServletRequest (org.apache.sling.api.SlingHttpServletRequest)1 SlingHttpServletResponse (org.apache.sling.api.SlingHttpServletResponse)1 RequestDispatcherOptions (org.apache.sling.api.request.RequestDispatcherOptions)1 Resource (org.apache.sling.api.resource.Resource)1 SyntheticResource (org.apache.sling.api.resource.SyntheticResource)1 JspSlingHttpServletResponseWrapper (org.apache.sling.scripting.jsp.util.JspSlingHttpServletResponseWrapper)1 NoSuchMessageException (org.springframework.context.NoSuchMessageException)1 BindStatus (org.springframework.web.servlet.support.BindStatus)1