Package javax.servlet.jsp

Examples of javax.servlet.jsp.JspContext


     * Encodes the provided code attribute
     */
    @Override
    public void doTag() throws JspException {
        try {
            JspContext context = getJspContext();
            JspWriter out = context.getOut();
            out.print(encodeToHtmlEntities(code));
        } catch (java.io.IOException ex) {
            throw new JspException(ex.getMessage());
        }
    }
View Full Code Here


     * Ciphers the provided code attribute
     */
    @Override
    public void doTag() throws JspException {
        try {
            JspContext context = getJspContext();
            JspWriter out = context.getOut();
            Cipherer cipher = (Cipherer) context.getAttribute(Cipherer.CIPHERER, 2);
            String encoded = cipher.encrypt(code);
            if (logger.isDebugEnabled()) logger.debug("Ciphered [" + code + "] to [" + encoded + "] in view");
            out.print(encoded);
        } catch (java.io.IOException ex) {
            throw new JspException(ex.getMessage());
View Full Code Here

    return (HttpServletResponse)getPageContext().getResponse();
  }
 
  /** Return the underlying {@link PageContext}.  */
  protected final PageContext getPageContext(){
    JspContext jspContext = getJspContext();
    return (PageContext)jspContext;
  }
View Full Code Here

    }

    /** {@inheritDoc} */
    @Override
    public Request createRequest() {
        JspContext pageContext = getJspContext();
        return JspRequest.createServletJspRequest(org.apache.tiles.request.jsp.JspUtil.getApplicationContext(pageContext),
                                                  (PageContext) pageContext);
    }
View Full Code Here

     * Test method for {@link org.apache.tiles.request.jsp.JspUtil#getApplicationContext(javax.servlet.jsp.JspContext)}.
     */
    @Test
    public void testGetApplicationContext() {
        ApplicationContext applicationContext = createMock(ApplicationContext.class);
        JspContext jspContext = createMock(JspContext.class);

        expect(jspContext.getAttribute(ApplicationAccess
                .APPLICATION_CONTEXT_ATTRIBUTE, PageContext.APPLICATION_SCOPE))
                .andReturn(applicationContext);

        replay(applicationContext, jspContext);
        assertEquals(applicationContext, JspUtil.getApplicationContext(jspContext));
View Full Code Here

    }

    @Test
    public void testCreateModelBody() {
        JspFragment jspBody = createMock(JspFragment.class);
        JspContext jspContext = createMock(JspContext.class);
        JspTag parent = createMock(JspTag.class);
        JspWriter writer = createMock(JspWriter.class);
        expect(jspContext.getOut()).andReturn(writer);
        replay(jspBody, jspContext, parent, writer);
        JspAutotagRuntime runtime = new JspAutotagRuntime();
        runtime.setJspBody(jspBody);
        runtime.setJspContext(jspContext);
        runtime.setParent(parent);
View Full Code Here

    }

    @Test(expected = UnsupportedOperationException.class)
    public void testGetParameter() {
        JspFragment jspBody = createMock(JspFragment.class);
        JspContext jspContext = createMock(JspContext.class);
        JspTag parent = createMock(JspTag.class);
        replay(jspBody, jspContext, parent);
        JspAutotagRuntime runtime = new JspAutotagRuntime();
        runtime.setJspBody(jspBody);
        runtime.setJspContext(jspContext);
View Full Code Here

    public void doTag() throws JspException, IOException {
        String formatted =
            new SimpleDateFormat("long".equals(format)?"EEE 'the' d:MMM:yyyy":"d:MM:yy")
            .format(new Date());
        StringTokenizer tok = new StringTokenizer(formatted,":");
        JspContext context = getJspContext();
        context.setAttribute("day", tok.nextToken() );
        context.setAttribute("month", tok.nextToken() );
        context.setAttribute("year", tok.nextToken() );

        JspFragment fragment = getJspBody();
        fragment.invoke(null);
    }
View Full Code Here

        return null;
    }

    @Override
    public Object getValue(ELContext context, Object base, Object property) {
        JspContext pageContext = (JspContext) context.getContext(JspContext.class);
        Boolean escapeXml = (Boolean) pageContext.getAttribute(ESCAPE_XML_ATTRIBUTE);
        if (escapeXml != null && !escapeXml) {
            return null;
        }

        try {
View Full Code Here

      DcpClassLoader loader = new DcpClassLoader(componentUri, componentTemplateUri);
      Executable dcpExecutable = loader.getExecutable();
      log.debug("Got Executable '{}'", dcpExecutable);
      String result = dcpExecutable.execute();

      JspContext context = getJspContext();
      JspWriter out = context.getOut();
      out.write(result);
    } catch (Exception e) {
      log.error("Exception occurred", e);
      throw new JspException(e);
    }
View Full Code Here

TOP

Related Classes of javax.servlet.jsp.JspContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.