Package javax.servlet.jsp.tagext

Examples of javax.servlet.jsp.tagext.BodyContent


    public int doAfterBody() throws JspException
    {
        if (log.isTraceEnabled()) log.trace("entering ViewTag.doAfterBody");
        try
        {
            BodyContent bodyContent = getBodyContent();
            if (bodyContent != null)
            {
                FacesContext facesContext = FacesContext.getCurrentInstance();
                StateManager stateManager = facesContext.getApplication().getStateManager();
                StateManager.SerializedView serializedView
                        = stateManager.saveSerializedView(facesContext);
                if (serializedView != null)
                {
                    //until now we have written to a buffer
                    ResponseWriter bufferWriter = facesContext.getResponseWriter();
                    bufferWriter.flush();
                    //now we switch to real output
                    ResponseWriter realWriter = bufferWriter.cloneWithWriter(getPreviousOut());
                    facesContext.setResponseWriter(realWriter);

                    String bodyStr = bodyContent.getString();
                    if ( stateManager.isSavingStateInClient(facesContext) )
                    {
                        int form_marker = bodyStr.indexOf(JspViewHandlerImpl.FORM_STATE_MARKER);
                        int url_marker = bodyStr.indexOf(HtmlLinkRendererBase.URL_STATE_MARKER);
                        int lastMarkerEnd = 0;
                        while (form_marker != -1 || url_marker != -1)
                        {
                            if (url_marker == -1 || (form_marker != -1 && form_marker < url_marker))
                            {
                                //replace form_marker
                                realWriter.write(bodyStr, lastMarkerEnd, form_marker - lastMarkerEnd);
                                stateManager.writeState(facesContext, serializedView);
                                lastMarkerEnd = form_marker + JspViewHandlerImpl.FORM_STATE_MARKER_LEN;
                                form_marker = bodyStr.indexOf(JspViewHandlerImpl.FORM_STATE_MARKER, lastMarkerEnd);
                            }
                            else
                            {
                                //replace url_marker
                                realWriter.write(bodyStr, lastMarkerEnd, url_marker - lastMarkerEnd);
                                if (stateManager instanceof MyfacesStateManager)
                                {
                                    ((MyfacesStateManager)stateManager).writeStateAsUrlParams(facesContext,
                                                                                              serializedView);
                                }
                                else
                                {
                                    log.error("Current StateManager is no MyfacesStateManager and does not support saving state in url parameters.");
                                }
                                lastMarkerEnd = url_marker + HtmlLinkRendererBase.URL_STATE_MARKER_LEN;
                                url_marker = bodyStr.indexOf(HtmlLinkRendererBase.URL_STATE_MARKER, lastMarkerEnd);
                            }
                        }
                        realWriter.write(bodyStr, lastMarkerEnd, bodyStr.length() - lastMarkerEnd);
                    }
                    else
                    {
                        realWriter.write( bodyStr );
                    }
                }
                else
                {
                    bodyContent.writeOut(getPreviousOut());
                }
            }
        }
        catch (IOException e)
        {
View Full Code Here


        _escape = escape;
    }
   
    public int doAfterBody() throws JspException
    {
        BodyContent bodyContent = getBodyContent();
        if (bodyContent != null)
        {
            UIOutput component = (UIOutput)getComponentInstance();
            component.setValue(bodyContent.getString());
        }
        return super.doAfterBody();
    }
View Full Code Here

    /**
     * @see javax.servlet.jsp.tagext.BodyTagSupport
     */
    public int doAfterBody() throws JspException {
        BodyContent body = getBodyContent();
        String html = body.getString();
        body.clearBody();

        try {
            boolean hasPerm = getUserStatus().hasPermission(permission);
            if (hasPerm) getPreviousOut().print(html);
        } catch (Exception e) {
View Full Code Here

    public int doAfterBody() throws JspException
    {
        if (log.isTraceEnabled()) log.trace("entering ViewTag.doAfterBody");
        try
        {
            BodyContent bodyContent = getBodyContent();
            if (bodyContent != null)
            {
                FacesContext facesContext = FacesContext.getCurrentInstance();
                StateManager stateManager = facesContext.getApplication().getStateManager();
                StateManager.SerializedView serializedView
                        = stateManager.saveSerializedView(facesContext);

                //until now we have written to a buffer
                ResponseWriter bufferWriter = facesContext.getResponseWriter();
                bufferWriter.flush();
                //now we switch to real output
                ResponseWriter realWriter = bufferWriter.cloneWithWriter(getPreviousOut());
                facesContext.setResponseWriter(realWriter);

                String bodyStr = bodyContent.getString();
              /*
                do this always - even with server-side-state saving
                if ( stateManager.isSavingStateInClient(facesContext) )
                { */

 
View Full Code Here

        _escape = escape;
    }
   
    public int doAfterBody() throws JspException
    {
        BodyContent bodyContent = getBodyContent();
        if (bodyContent != null)
        {
            UIOutput component = (UIOutput)getComponentInstance();
            component.setValue(bodyContent.getString());
        }
        return super.doAfterBody();
    }
View Full Code Here

    /**
     * TODO: Ignore <!-- --> comments
     */
    private boolean isBodyContentEmpty()
    {
        BodyContent bodyContent = getBodyContent();
        if (bodyContent == null)
        {
            return true;
        }
        try
        {
            Reader reader = bodyContent.getReader();
            int c;
            while ((c = reader.read()) != -1)
            {
                if (!Character.isWhitespace((char)c))
                {
View Full Code Here

    /**
     * TODO: Ignore <!-- --> comments
     */
    private boolean isBodyContentEmpty()
    {
        BodyContent bodyContent = getBodyContent();
        if (bodyContent == null)
        {
            return true;
        }
        try
        {
            Reader reader = bodyContent.getReader();
            int c;
            while ((c = reader.read()) != -1)
            {
                if (!Character.isWhitespace((char)c))
                {
View Full Code Here

    }

    @Override
    public int doAfterBody() throws JspException
    {
        BodyContent bodyContent = getBodyContent();
        if (bodyContent != null)
        {
            UIOutput component = (UIOutput)getComponentInstance();
            component.setValue(bodyContent.getString());
            bodyContent.clearBody();
        }
        return super.getDoAfterBodyValue();
    }
View Full Code Here

    }

    public int doEndTag() throws JspException {
        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

        BodyContent body = getBodyContent();
        String bodyString = body.getString();

        StringBuffer newURL = new StringBuffer();

        appendContentPrefix(request, newURL);
        newURL.append(bodyString);
        body.clearBody();

        try {
            getPreviousOut().print(newURL.toString());
        } catch (IOException e) {
            if (UtilJ2eeCompat.useNestedJspException(pageContext.getServletContext())) {
View Full Code Here

    }

    public int doAfterBody() throws JspException {
        NumberFormat nf = null;
        DateFormat df = null;
        BodyContent body = getBodyContent();
        String value = body.getString();
        body.clearBody();

        if (value == null || value.length() == 0)
            return SKIP_BODY;

        if (type.charAt(0) == 'C' || type.charAt(0) == 'c')
View Full Code Here

TOP

Related Classes of javax.servlet.jsp.tagext.BodyContent

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.