The work area partition service provides a Java Naming and Directory Interface (JNDI) binding to an implementation of the work area partition manager interface under the name java:comp/websphere/WorkAreaPartitionManager. Applications that need to access their partition can perform a lookup on that JNDI name and then use the getWorkAreaPartition method on the work area partition manager, as shown in the following code example:
import com.ibm.websphere.workarea.*; import javax.naming.*; public class SimpleSampleServlet { ... //Variable to hold our WorkAreaPartitionManager implementation WorkAreaPartitionManager partitionManager = null; try { InitialContext initialContext = new InitialContext(); partitionManager = (WorkAreaPartitionManager) initialContext.lookup("java:comp/websphere/WorkAreaPartitionManager"); } catch (Exception e) {...} //Variable used to hold the retrieved WorkArea Partition UserWorkArea myPartition = null; try{ myPartition = partitionManager.getWorkAreaPartition(partitionName); }catch(NoSuchPartitionException e){...} }