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());
}
}
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());
}
}
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("<");
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();
}
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());
}
}
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;
}
Aggregations