Search in sources :

Example 16 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 17 with JspWriter

use of javax.servlet.jsp.JspWriter in project sling by apache.

the class TestEncodeTag method init.

/**
	 * Initializes the fields for this test.
	 */
@SuppressWarnings("serial")
@Before
public void init() {
    log.info("init");
    encodeTag = new EncodeTag();
    sb = new StringBuilder();
    final JspWriter w = new JspWriter(0, false) {

        public void newLine() throws IOException {
            throw new UnsupportedOperationException();
        }

        public void print(boolean paramBoolean) throws IOException {
            sb.append(paramBoolean);
        }

        public void print(char paramChar) throws IOException {
            sb.append(paramChar);
        }

        public void print(int paramInt) throws IOException {
            sb.append(paramInt);
        }

        public void print(long paramLong) throws IOException {
            sb.append(paramLong);
        }

        public void print(float paramFloat) throws IOException {
            sb.append(paramFloat);
        }

        public void print(double paramDouble) throws IOException {
            sb.append(paramDouble);
        }

        public void print(char[] paramArrayOfChar) throws IOException {
            sb.append(paramArrayOfChar);
        }

        public void print(String paramString) throws IOException {
            sb.append(paramString);
        }

        public void print(Object paramObject) throws IOException {
            sb.append(paramObject);
        }

        public void println() throws IOException {
            throw new UnsupportedOperationException();
        }

        public void println(boolean paramBoolean) throws IOException {
            throw new UnsupportedOperationException();
        }

        public void println(char paramChar) throws IOException {
            throw new UnsupportedOperationException();
        }

        public void println(int paramInt) throws IOException {
            throw new UnsupportedOperationException();
        }

        public void println(long paramLong) throws IOException {
            throw new UnsupportedOperationException();
        }

        public void println(float paramFloat) throws IOException {
            throw new UnsupportedOperationException();
        }

        public void println(double paramDouble) throws IOException {
            throw new UnsupportedOperationException();
        }

        public void println(char[] paramArrayOfChar) throws IOException {
            throw new UnsupportedOperationException();
        }

        public void println(String paramString) throws IOException {
            throw new UnsupportedOperationException();
        }

        public void println(Object paramObject) throws IOException {
            throw new UnsupportedOperationException();
        }

        public void clear() throws IOException {
            throw new UnsupportedOperationException();
        }

        public void clearBuffer() throws IOException {
            throw new UnsupportedOperationException();
        }

        public void flush() throws IOException {
            throw new UnsupportedOperationException();
        }

        public void close() throws IOException {
            throw new UnsupportedOperationException();
        }

        public int getRemaining() {
            throw new UnsupportedOperationException();
        }

        public void write(char[] cbuf, int off, int len) throws IOException {
            sb.append(cbuf);
        }
    };
    pageContext = new MockPageContext() {

        public JspWriter getOut() {
            return w;
        }
    };
    encodeTag.setPageContext(pageContext);
    log.info("init Complete");
}
Also used : JspWriter(javax.servlet.jsp.JspWriter) Before(org.junit.Before)

Example 18 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 19 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)

Example 20 with JspWriter

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

the class EchoAttributesTag method doTag.

@Override
public void doTag() throws JspException, IOException {
    JspWriter out = getJspContext().getOut();
    for (int i = 0; i < keys.size(); i++) {
        String key = keys.get(i);
        Object value = values.get(i);
        out.println("<li>" + key + " = " + value + "</li>");
    }
}
Also used : JspWriter(javax.servlet.jsp.JspWriter)

Aggregations

JspWriter (javax.servlet.jsp.JspWriter)46 JspException (javax.servlet.jsp.JspException)20 IOException (java.io.IOException)19 HttpServletRequest (javax.servlet.http.HttpServletRequest)9 Properties (java.util.Properties)6 HtmlCode (org.compiere.util.HtmlCode)6 org.apache.ecs.xhtml.select (org.apache.ecs.xhtml.select)5 ArrayList (java.util.ArrayList)3 Iterator (java.util.Iterator)3 List (java.util.List)3 HttpSession (javax.servlet.http.HttpSession)3 JspContext (javax.servlet.jsp.JspContext)3 PageContext (javax.servlet.jsp.PageContext)3 org.apache.ecs.xhtml.option (org.apache.ecs.xhtml.option)3 Element (org.dom4j.Element)3 StringWriter (java.io.StringWriter)2 Collection (java.util.Collection)2 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)2 DisplaySectionBean (org.akaza.openclinica.bean.submit.DisplaySectionBean)2 org.apache.ecs.xhtml.br (org.apache.ecs.xhtml.br)2