protected void SaveStateInClient(FacesContext facesContext, StateManager.SerializedView serializedView) { //UIViewRoot uiViewRoot = facesContext.getViewRoot (); ////save state in response (client-side: full state; server-side: sequence) //RenderKit renderKit = RenderKitFactory.getRenderKit (facesContext, uiViewRoot.getRenderKitId ()); //// not us. //renderKit.getResponseStateManager ().writeState (facesContext, serializedView); java.io.ByteArrayOutputStream bytearrayoutputstream = new java.io.ByteArrayOutputStream(); java.io.ObjectOutputStream objectoutputstream = new java.io.ObjectOutputStream(bytearrayoutputstream); //ignore tree structure //objectoutputstream.writeObject (serializedView.getStructure ()); objectoutputstream.writeObject(serializedView.getState()); objectoutputstream.close(); bytearrayoutputstream.close(); string s = @"<div> <input type=""hidden"" name=""" + VIEWSTATE + "\" id=\"" + VIEWSTATE + "\" value=\"" + Convert.ToBase64String((byte [])vmw.common.TypeUtils.ToByteArray(bytearrayoutputstream.toByteArray())) + @""" /> </div>"; facesContext.getResponseWriter().write(s); }
ResponseWriter SetupResponseWriter(TextWriter httpWriter) //TODO { FacesContext facesContext = getFacesContext(); ResponseWriter oldWriter = facesContext.getResponseWriter(); if (oldWriter == null) { throw new InvalidOperationException(); } ResponseWriter writer = oldWriter.cloneWithWriter(new AspNetResponseWriter(httpWriter)); facesContext.setResponseWriter(writer); return(oldWriter); }
protected void SaveStateInClient (FacesContext facesContext, StateManager.SerializedView serializedView) { //UIViewRoot uiViewRoot = facesContext.getViewRoot (); ////save state in response (client-side: full state; server-side: sequence) //RenderKit renderKit = RenderKitFactory.getRenderKit (facesContext, uiViewRoot.getRenderKitId ()); //// not us. //renderKit.getResponseStateManager ().writeState (facesContext, serializedView); java.io.ByteArrayOutputStream bytearrayoutputstream = new java.io.ByteArrayOutputStream (); java.io.ObjectOutputStream objectoutputstream = new java.io.ObjectOutputStream (bytearrayoutputstream); //ignore tree structure //objectoutputstream.writeObject (serializedView.getStructure ()); objectoutputstream.writeObject (serializedView.getState ()); objectoutputstream.close (); bytearrayoutputstream.close (); string s = @"<div> <input type=""hidden"" name=""" + VIEWSTATE + "\" id=\"" + VIEWSTATE + "\" value=\"" + Convert.ToBase64String ((byte []) vmw.common.TypeUtils.ToByteArray (bytearrayoutputstream.toByteArray ())) + @""" /> </div>"; facesContext.getResponseWriter ().write (s); }
public override ResponseWriter getResponseWriter() { return(_facesContex.getResponseWriter()); }