Refine search
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); JspWriter out = pageContext.getOut(); String body = getBodyContent().getString(); out.write(buf.toString()); throw new JspException(ioe.getMessage());
/** * Performs smart form population. */ @Override public int doAfterBody() throws JspException { BodyContent body = getBodyContent(); JspWriter out = body.getEnclosingWriter(); String bodytext = populateForm(body.getString(), name -> value(name, pageContext)); try { out.print(bodytext); } catch (IOException ioex) { throw new JspException(ioex); } return SKIP_BODY; }
/** * Clear the body without throwing any exceptions. */ public void clearBody() { try { this.clear(); } catch (IOException ex) { // TODO -- clean this one up. throw new Error("internal error!;"); } }
/** * The user customised the output of the error messages - flush the * buffered content into the main {@link javax.servlet.jsp.JspWriter}. */ protected void flushBufferedBodyContent(BodyContent bodyContent) throws JspException { try { bodyContent.writeOut(bodyContent.getEnclosingWriter()); } catch (IOException ex) { throw new JspException("Unable to write buffered body content.", ex); } }
} else { if (bodyContent != null && bodyContent.getString() != null) input = bodyContent.getString().trim(); pageContext.removeAttribute(var, scope); false); if (loc == null) { throw new JspException( Resources.getMessage("PARSE_NUMBER_NO_PARSE_LOCALE")); parsed = parser.parse(input); } catch (ParseException pe) { throw new JspException( Resources.getMessage("PARSE_NUMBER_PARSE_ERROR", input), pe); pageContext.setAttribute(var, parsed, scope); } else { try { pageContext.getOut().print(parsed); } catch (IOException ioe) { throw new JspTagException(ioe.toString(), ioe);
public int doEndTag() throws JspException { try { pageContext.getOut().print(bodyContent.getString()); } catch (IOException ioe) { throw new JspTagException(ioe.toString(), ioe); } return EVAL_PAGE; }
sqlStatement = bodyContent.getString(); throw new JspTagException( Resources.getMessage("SQL_NO_STATEMENT")); throw new JspException(sqlStatement + ": " + e.getMessage(), e); pageContext.setAttribute(var, Integer.valueOf(result), scope); return EVAL_PAGE;
private static void write(PageContext pageContext, String s, boolean toEnclosingWriter) throws JspException { JspWriter writer = pageContext.getOut(); if(toEnclosingWriter && writer instanceof BodyContent) writer = ((BodyContent)writer).getEnclosingWriter(); try { writer.print(s); } catch(IOException e) { throw new JspException("Input/output error: " + e.toString()); } }
public int doEndTag() throws JspException { try { String body = bodyContent.getString(); bodyContent.clearBody(); String link = getLoginLink((HttpServletRequest) pageContext.getRequest(), body); bodyContent.getEnclosingWriter().write(link); } catch (IOException e) { throw new JspException("IOException: " + e); } return super.doEndTag(); }
BodyContent content = getBodyContent(); if (content != null) { msgid = content.getString().trim(); content.clearBody(); throw new JspTagException("No message given in TranslationTag"); pageContext.getOut().print(msg); } catch (IOException ex) { throw new JspException(ex);
public int doEndTag() throws JspException { try { String text = bodyContent.getString(); if (text == null) { text = ""; } else { text = renderText(text); } JspWriter out = pageContext.getOut(); out.print(text); } catch (IOException ioe) { throw new JspException(ioe.toString()); } return EVAL_PAGE; }
public int doAfterBody() throws JspException { try { ApplResources ar = ApplResources.getInstance(pageContext.getServletContext()); ResultCache rc = ResultCache.getInstance( pageContext.getSession(), pageContext.getServletContext(), name); // if this is the first call, we have to parse the mdx query if (!resultCache || rc.getQuery() == null) { String mdx = getBodyContent().getString(); rc.parse(mdx); } return SKIP_BODY; } catch (Exception e) { e.printStackTrace(); throw new JspException(e); } }
@Override public int doEndTag() throws JspException { Object argument = null; if (this.valueSet) { argument = this.value; } else if (getBodyContent() != null) { // Get the value from the tag body argument = getBodyContent().getString().trim(); } // Find a param-aware ancestor ArgumentAware argumentAwareTag = (ArgumentAware) findAncestorWithClass(this, ArgumentAware.class); if (argumentAwareTag == null) { throw new JspException("The argument tag must be a descendant of a tag that supports arguments"); } argumentAwareTag.addArgument(argument); return EVAL_PAGE; }
@Override public int doEndTag() throws JspException { try { JspWriterUtils.write( pageContext.getOut(), getBodyContent().getString() + STAG + SL + TAG + ETAG); recycle(); return EVAL_PAGE; } catch (Exception e) { throw new JspException(e); } }
public void writePrevious(PageContext pageContext, String text) throws JspException { JspWriter writer = pageContext.getOut(); if (writer instanceof BodyContent) { writer = ((BodyContent) writer).getEnclosingWriter(); } try { writer.print(text); } catch (IOException e) { String msg = "Failed to print the text by the writer: writer=" + writer + " text=" + text; throw new IllegalStateException(msg, e); } }
public int doAfterBody() throws JspException { try { SecuritySession session = SecuritySession.getInstance((HttpServletRequest) pageContext.getRequest()); if (!session.isLoggedIn()) { bodyContent.writeOut(getPreviousOut()); } } catch (Exception e) { log.error("", e); throw new JspTagException(e); } finally { bodyContent.clearBody(); } return SKIP_BODY; }
@Override protected void renderFromBodyContent(BodyContent bodyContent, TagWriter tagWriter) throws JspException { Object value = this.pageContext.getAttribute(VALUE_VARIABLE_NAME); String label = bodyContent.getString(); renderOption(value, label, tagWriter); }
/** * Writes content of tag, returns status to iterate * @throws JspException */ public int doAfterBody() throws JspException { try { bodyContent.writeOut(getPreviousOut()); } catch (IOException e) { throw new JspTagException("GetCollectionTag: " + e.getMessage()); } finally { bodyContent.clearBody(); } return SKIP_BODY; }
/** * Write the escaped body content to the page. * <p>Can be overridden in subclasses, e.g. for testing purposes. * @param content the content to write * @throws IOException if writing failed */ protected void writeBodyContent(String content) throws IOException { Assert.state(this.bodyContent != null, "No BodyContent set"); this.bodyContent.getEnclosingWriter().print(content); }