Search in sources :

Example 61 with JspWriter

use of javax.servlet.jsp.JspWriter in project logging-log4j2 by apache.

the class DumpTagTest method setUp.

@Before
public void setUp() {
    this.output = new ByteArrayOutputStream();
    this.writer = new OutputStreamWriter(this.output, UTF8);
    this.context = new MockPageContext() {

        private final MockJspWriter jspWriter = new MockJspWriter(writer);

        @Override
        public JspWriter getOut() {
            return this.jspWriter;
        }
    };
    this.tag = new DumpTag();
    this.tag.setPageContext(this.context);
}
Also used : MockPageContext(org.springframework.mock.web.MockPageContext) MockJspWriter(org.springframework.mock.web.MockJspWriter) OutputStreamWriter(java.io.OutputStreamWriter) ByteArrayOutputStream(java.io.ByteArrayOutputStream) JspWriter(javax.servlet.jsp.JspWriter) MockJspWriter(org.springframework.mock.web.MockJspWriter) Before(org.junit.Before)

Example 62 with JspWriter

use of javax.servlet.jsp.JspWriter in project jodd by oblac.

the class FormTag method doAfterBody.

/**
 * Performs smart form population.
 */
@Override
public int doAfterBody() throws JspException {
    final BodyContent body = getBodyContent();
    final JspWriter out = body.getEnclosingWriter();
    final String bodytext = populateForm(body.getString(), name -> value(name, pageContext));
    try {
        out.print(bodytext);
    } catch (final IOException ioex) {
        throw new JspException(ioex);
    }
    return SKIP_BODY;
}
Also used : BodyContent(javax.servlet.jsp.tagext.BodyContent) JspException(javax.servlet.jsp.JspException) IOException(java.io.IOException) JspWriter(javax.servlet.jsp.JspWriter)

Example 63 with JspWriter

use of javax.servlet.jsp.JspWriter in project jodd by oblac.

the class UrlTag method doTag.

@Override
public void doTag() {
    final PageContext pageContext = (PageContext) getJspContext();
    final URLCoder.Builder builder = URLCoder.build(baseUrl);
    for (int i = 0; i < attrs.size(); i += 2) {
        builder.queryParam(attrs.get(i), attrs.get(i + 1));
    }
    if (var == null) {
        final JspWriter out = pageContext.getOut();
        try {
            out.print(builder.get());
        } catch (final IOException ioex) {
        // ignore
        }
    } else {
        pageContext.setAttribute(var, builder.get());
    }
}
Also used : URLCoder(jodd.net.URLCoder) PageContext(javax.servlet.jsp.PageContext) IOException(java.io.IOException) JspWriter(javax.servlet.jsp.JspWriter)

Example 64 with JspWriter

use of javax.servlet.jsp.JspWriter in project SpringStepByStep by JavaProgrammerLB.

the class HighlightTag method doTag.

@Override
public void doTag() throws JspException, IOException {
    JspWriter out = getJspContext().getOut();
    StringWriter stringWriter = new StringWriter();
    getJspBody().invoke(stringWriter);
    String highlightedValue = doHighlight(stringWriter.toString());
    out.print(highlightedValue);
}
Also used : StringWriter(java.io.StringWriter) JspWriter(javax.servlet.jsp.JspWriter)

Example 65 with JspWriter

use of javax.servlet.jsp.JspWriter in project SpringStepByStep by JavaProgrammerLB.

the class StatusLabelTag method doTag.

@Override
public void doTag() throws JspException, IOException {
    JspWriter out = getJspContext().getOut();
    String statusLabel = TodoListUtils.getStatusLabel(status);
    out.print(statusLabel);
}
Also used : JspWriter(javax.servlet.jsp.JspWriter)

Aggregations

JspWriter (javax.servlet.jsp.JspWriter)145 IOException (java.io.IOException)72 JspException (javax.servlet.jsp.JspException)68 HttpServletRequest (javax.servlet.http.HttpServletRequest)17 JspWriteRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.JspWriteRuntimeException)14 PageContext (javax.servlet.jsp.PageContext)13 Iterator (java.util.Iterator)9 Engine (org.apache.wiki.api.core.Engine)9 JspContext (javax.servlet.jsp.JspContext)8 JspTagException (javax.servlet.jsp.JspTagException)8 OuterFormTagMissingRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.OuterFormTagMissingRuntimeException)7 ArrayList (java.util.ArrayList)6 Properties (java.util.Properties)6 HttpSession (javax.servlet.http.HttpSession)5 BodyContent (javax.servlet.jsp.tagext.BodyContent)5 org.apache.ecs.xhtml.select (org.apache.ecs.xhtml.select)5 Page (org.apache.wiki.api.core.Page)5 HtmlCode (org.compiere.util.HtmlCode)5 MissingParametersRuntimeException (org.jaffa.presentation.portlet.widgets.taglib.exceptions.MissingParametersRuntimeException)5 IPropertyRuleIntrospector (org.jaffa.rules.IPropertyRuleIntrospector)5