hmm the application should be available
because if we start writing classnames and we have to resolve them
then i want to be able to get the right classloader.
But i gues this can also be done in the constructor of
WicketObjectInputStream (give the classloader)

johan


On 2/12/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:

On 2/12/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> On 2/12/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> > > for eelco: you had to disable both methods! (objectToByte and
byteToObject)
> > > For now i enabled both so that it gets tested as much as possible
the coming
> > > few days
> >
> > Ok, we can keep it in for a few days, but it has to improve quite a
> > bit before it's ready for real world use.
>
> Actually, we should abstract it so that the handling is plug-gable. It
> would be great if clients can decide whether they want to use JDK's
> default, jboss, xstream or maybe our custom scheme.
>
> Support for XStream might be a bit difficult actually. The easiest
> thing for us to do would to have a setting or factory method that
> produced the type of ObjectOutputStream/ObjectInputStream that should
> be used.

Just implemented that:

public interface IObjectStreamFactory
{
        /**
         * Gets a new instance of an [EMAIL PROTECTED] ObjectInputStream} with 
the
provided
         * [EMAIL PROTECTED] InputStream}.
         *
         * @param in
         *            The inpu stream that should be used for the reading
         * @return a new object input stream instance
         * @throws IOException
         *             if an I/O error occurs while reading stream header
         */
        ObjectInputStream newObjectInputStream(InputStream in) throws
IOException;

        /**
         * Gets a new instance of an [EMAIL PROTECTED] ObjectOutputStream} with 
the
provided
         * [EMAIL PROTECTED] OutputStream}.
         *
         * @param out
         *            The output stream that should be used for the
writing
         * @return a new object output stream instance
         * @throws IOException
         *             if an I/O error occurs while writing stream header
         */
        ObjectOutputStream newObjectOutputStream(OutputStream out) throws
IOException;
}

It's set as a static instance on the Objects class, and you can set it
for your application using Objects#setObjectStreamFactory.

I choose - as an exception - for a static var as this the Application
often will not be available as a thread local when
Objects#byteArrayToObject and Objects#objectToByteArray is used, and
it seems very unlikely to me that people will want to vary this
between instances of applications anyway (though the door is still
open to do that, they would just have to program a few lines
themselves).

Eelco

Reply via email to