Code for ApplicationObjectServlet :

  private void recupererListe(  HttpServletRequest request,
                                HttpServletResponse response,
                                String nomObjet)
    throws IOException {

    try {
      List listeDonnee = (List)
UtilsCom.litSurFluxZippe(request.getInputStream());

      ServletContext context = getServletContext();

      listeDonnee = (List) context.getAttribute("Liste" + nomObjet);

      ByteCounterOutputStream byteCounterStream =
                      new
ByteCounterOutputStream(response.getOutputStream());
      int start = byteCounterStream.bytesWrittenSoFar();

      UtilsCom.ecritSurFluxZippe((Serializable)listeDonnee,
byteCounterStream);

      int objectSize = byteCounterStream.bytesWrittenSoFar() - start;

      log.debug("Taille de l'objet serialise : " + objectSize + " octets");

      _nbBytesWritten += objectSize;
    }
    catch (ClassNotFoundException ex) {
      if (log.isEnabledFor(Priority.ERROR)) {
        log.error(ex.toString());
      }
    }
  }

ByteCounterOutputStream  is just a class that inherit from DataOutputStream
and that permits to know the number of bytes written.

Here is the code for UtilsCom :

  public static void ecritSurFluxZippe(Serializable objectToSerialize,
OutputStream out)
  throws java.io.IOException{
    GZIPOutputStream zipStream = new GZIPOutputStream(out);
    ObjectOutputStream objectOutput = new ObjectOutputStream(zipStream);
    objectOutput.writeObject(objectToSerialize);
    objectOutput.flush();
    objectOutput.close();
  }

C�cile SAINT-MARTIN
Ouest-France
Tel. 77.24
mailto:[EMAIL PROTECTED]


> Howdy,
> 
> >We use a servlet to send serialized data to a java client. It always
> append
> 
> Post the relevant servlet code.
> 
> >Is there a limitation to the size of data that we can send 
> by a socket?
> 
> No.
> 
> Yoav Shapira
> 
----------------------------------------------------------------------------
-------------- 
Les informations ou pi�ces jointes contenues dans ce message sont
confidentielles. Seul le destinataire express�ment vis� peut en prendre
connaissance. Toute autre personne qui en divulguera, diffusera ou prendra
des copies sera passible de poursuites. La soci�t� Ouest-France d�cline en
outre, toute responsabilit� de quelque nature que ce soit au titre de ce
message s'il a �t� alt�r�, d�form� ou falsifi�.
----------------------------------------------------------------------------
--------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to