Package javax.faces.application

Examples of javax.faces.application.StateManager$SerializedView


    if (log.isDebugEnabled()) {
      log.debug("Try to restore tree structure ......");
    }

    StateManager stateManager = context.getApplication().getStateManager();
   
    Map sessionMap = context.getExternalContext().getSessionMap();
    Map requestMap = context.getExternalContext().getRequestParameterMap();
 
    if(log.isDebugEnabled()){
      if(requestMap.containsKey(KitConstants.XFBRIDGE_REQUEST)){
        log.debug("AJAX request detected (from XULFACES_BRIDGE)");             
     
    }

    String viewString = (String) requestMap.get(javax.faces.render.ResponseStateManager.VIEW_STATE_PARAM);   
   
    if (log.isDebugEnabled()) {
      log.debug("ViewString is " + viewString)
    }           
   
    Object structure = null;
   
    if (viewString == null) {
      return null;
    }

    if (stateManager.isSavingStateInClient(context)) {
     
      viewStateData.set(null);
     
      if (log.isDebugEnabled()) {
        log.debug("State was on client")
View Full Code Here


    ResponseWriter writer = facesContext.getResponseWriter();
   
    writer.write("<state>");
    writer.startCDATA();
   
    StateManager stateManager = facesContext.getApplication().getStateManager();
    stateManager.writeState(facesContext, stateManager.saveView(facesContext));
   
    writer.endCDATA();
    writer.write("</state>");
  }
View Full Code Here

    writer.write("</row-count>");
   
    //State
    writer.write("<state>");
    writer.startCDATA();
      StateManager stateManager = facesContext.getApplication().getStateManager();
      stateManager.writeState(facesContext, stateManager.saveView(facesContext));
    writer.endCDATA();
    writer.write("</state>");

    writer.write("</data-response>");
  }
View Full Code Here

 
      //State
      writer.write("<state>");
      writer.startCDATA();
     
      StateManager stateManager = facesContext.getApplication().getStateManager();
      stateManager.writeState(facesContext, stateManager.saveView(facesContext));
     
      writer.endCDATA();
      writer.write("</state>");
     
      writer.write("</partial-response>");
View Full Code Here

 
      //State
      writer.write("<state>");
      writer.startCDATA();
     
      StateManager stateManager = facesContext.getApplication().getStateManager();
      stateManager.writeState(facesContext, stateManager.saveView(facesContext));
     
      writer.endCDATA();
      writer.write("</state>");
     
      writer.write("</partial-response>");
View Full Code Here

      writer.write(stepToDisplay);
      writer.write("</current-step>");
     
      writer.write("<state>");
      writer.startCDATA();
      StateManager stateManager = facesContext.getApplication().getStateManager();
      stateManager.writeState(facesContext, stateManager.saveView(facesContext));
      writer.endCDATA();
      writer.write("</state>");
     
    writer.write("</wizard-response>");
  }
View Full Code Here

            // is actually written into the output, but this cannot
            // programatically be discovered
            stateWriter.writingState();
        }

        StateManager stateManager = context.getApplication().getStateManager();
        if (stateManager.isSavingStateInClient(context))
        {
            // Only write state marker if javascript view state is disabled
            ExternalContext extContext = context.getExternalContext();
            if (!(JavascriptUtils.isJavascriptAllowed(extContext) && MyfacesConfig.getCurrentInstance(extContext).isViewStateJavascript())) {
                context.getResponseWriter().write(FORM_STATE_MARKER);
            }
        }
        else
        {
            stateManager.writeState(context, new Object[2]);
        }
    }
View Full Code Here

        }

        ResponseWriter oldResponseWriter = responseWriter;
        StateMarkerAwareWriter stateAwareWriter = null;

        StateManager stateManager = facesContext.getApplication().getStateManager();
        if (stateManager.isSavingStateInClient(facesContext))
        {
            stateAwareWriter = new StateMarkerAwareWriter();

            // Create a new response-writer using as an underlying writer the stateAwareWriter
            // Effectively, all output will be buffered in the stateAwareWriter so that later
            // this writer can replace the state-markers with the actual state.
            responseWriter = hookInStateAwareWriter(
                    oldResponseWriter, stateAwareWriter, renderKit, externalContext);
            facesContext.setResponseWriter(responseWriter);
        }

        actuallyRenderView(facesContext, viewToRender);

        facesContext.setResponseWriter(oldResponseWriter);

        //We're done with the document - now we can write all content
        //to the response, properly replacing the state-markers on the way out
        //by using the stateAwareWriter
        if (stateManager.isSavingStateInClient(facesContext))
        {
            stateAwareWriter.flushToWriter(response.getWriter());
        }
        else
        {
            stateManager.saveView(facesContext);
        }

        // Final step - we output any content in the wrappedResponse response from above to the response,
        // removing the wrappedResponse response from the request, we don't need it anymore
        ServletViewResponseWrapper afterViewTagResponse = (ServletViewResponseWrapper) externalContext.getRequestMap().get(
View Full Code Here

     * @throws IOException
     */
    @Override
    public void writeState(FacesContext facesContext) throws IOException
    {
        StateManager stateManager = facesContext.getApplication().getStateManager();
        if (stateManager.isSavingStateInClient(facesContext))
        {
        // Only write state marker if javascript view state is disabled
        ExternalContext extContext = facesContext.getExternalContext();
        if (!(JavascriptUtils.isJavascriptAllowed(extContext) && MyfacesConfig.getCurrentInstance(extContext).isViewStateJavascript())) {
            facesContext.getResponseWriter().write(FORM_STATE_MARKER);
        }
        }
        else
        {
            stateManager.writeState(facesContext, new Object[2]);
        }
    }
View Full Code Here

        }

        public void flushToWriter(Writer writer) throws IOException
        {
            FacesContext facesContext = FacesContext.getCurrentInstance();
            StateManager stateManager = facesContext.getApplication().getStateManager();

            StringWriter stateWriter = new StringWriter();
            ResponseWriter realWriter = facesContext.getResponseWriter();
            facesContext.setResponseWriter(realWriter.cloneWithWriter(stateWriter));

            Object serializedView = stateManager.saveView(facesContext);

            stateManager.writeState(facesContext, serializedView);
            facesContext.setResponseWriter(realWriter);

            StringBuilder contentBuffer = getStringBuilder();
            String state = stateWriter.getBuffer().toString();
View Full Code Here

TOP

Related Classes of javax.faces.application.StateManager$SerializedView

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.