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 void Save(Stream stream) { //FileOutputStream _javastream = new FileOutputStream(filePath); java.io.ByteArrayOutputStream byteStream = new java.io.ByteArrayOutputStream(); java.io.ObjectOutput objOut = new DotnetObjectOutputStream(byteStream); ((ReteooRuleBase)this._javaRuleBase).writeExternal(objOut); stream.Write(byteStream.toByteArray(), 0, byteStream.toByteArray().Length); byteStream.close(); }
public override void close() { int size = _out.size(); _out.close(); if (size < _contentLength) { throw new IOException("Cannot close stream until all bytes are written."); } }
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); }