Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a way to detect if an incoming serialized object stream is GZIPOutputStream compressed or a simple ObjectOutputStream?
    primarykey
    data
    text
    <p>I have a legacy system where servers get slowly updated over a period of weeks. The hierarchy is such:</p> <pre><code>1 2 3 4 5 1 is the client pc 2 is a master server 3 4 and 5 are servers across the country. </code></pre> <p>Currently all of these are sending POJO (plain old java objects) back and forth in an uncompressed format. Think OjbectOutputStream() etc.</p> <p>I'd like to compress the data being serialized over the wire but do it in such a way that only data being received from a query is compressed. The data being sent down is trivial (query filter data). </p> <p>Only client #1 and master server #2 are updated right away. Servers #3, #4 and #5 could be updated weeks or months apart from each other. I need a way for the server #2 to be able to detect whether the streams coming back from #3, #4 or #5 are compressed and deal with it accordingly (as they get upgraded).</p> <p>-EDIT- The solution must be unobtrusive for the servers #3, #4, and #5. These servers do not have the concept of resending the data if an exception occurs.</p> <p>Here is an example of code used by #2 to communicate with #3, #4, or #5:</p> <pre><code> // Set the content type to be application/x-java-serialized-object connection.setRequestProperty("Content-Type", "application/x-java-serialized-object"); setupHeaderAttributes(getHttpHeaders()); setupSessionCookies(getHttpHeaders()); // Load/add httpHeaders addHeadersToConnection(connection, getHttpHeaders()); // Write the serialized object as post data objectoutputstream = new ObjectOutputStream(connection.getOutputStream()); objectoutputstream.writeObject(obj); objectoutputstream.flush(); // Get ready to receive the reply. inputstream = connection.getInputStream(); setHttpStatus(connection.getResponseCode()); </code></pre> <p>Is this possible? Thank you for your time.</p> <p>-Dennis</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload