UltraLightClient Code Community
[ start | index | login ]
Overview > Serializable Check

Serializable Check

Belongs to following categories: Utility, ULC5.2,

Purpose

Implements a helper class that checks at runtime if the current ULC session is serializable. This information can be useful when an ULC application is or will be deployed in a Servlet or EJB container.

Resources

How to use

We call the execute() method of the SerializableCheck class.
SerializableCheck.execute()

How it is implemented

We try to serialize the current ULC session into a byte array using the standard Java Serialization mechanism. An exception will be thrown if the session cannot be serialized.

public class SerializableCheck
{
  public static void execute()
  {
    try
    {
      ULCSession ulcSession = ULCSession.currentSession();

ObjectOutputStream objectOutputStream = new ObjectOutputStream(new ByteArrayOutputStream()); objectOutputStream.writeObject(ulcSession); objectOutputStream.flush(); objectOutputStream.close(); } catch(IOException ioe) { System.err.println("Could not serialize session: " + ioe); } } }

Compatibility

The described functionality has been developed and tested using JDK 1.3.1_10 and ULC 5.2.

Author

>>etienne

no comments | post comment
labels
Category:Utility
Category:ULC5.2
attachments
serialization.war (1220366)
serialization.zip (386410)
Created by etienne. Last edited by admin, one year and 287 days ago. Viewed 7,413 times. #18
[diff] [history] [edit] [rdf]




news




RSS News Feed:

RSS Feed

snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt