1 16 package org.mortbay.j2ee.session; 17 18 import javax.naming.Context ; 19 import javax.naming.InitialContext ; 20 21 23 28 31 public class 32 SerializableContext 33 implements java.io.Serializable 34 { 35 protected void 36 log_warn(String message) 37 { 38 System.err.println("WARNING: "+message); 39 } 40 41 protected void 42 log_error(String message, Exception e) 43 { 44 System.err.println("ERROR: "+message); 45 e.printStackTrace(System.err); 46 } 47 48 protected 49 SerializableContext() 50 throws java.rmi.RemoteException 51 { 52 } 53 54 SerializableContext(Context context) 55 throws java.rmi.RemoteException 56 { 57 58 log_warn("distribution of Contexts is NYI - assuming java:comp/env"); 59 60 } 78 79 Context 80 toContext() 81 throws java.rmi.RemoteException 82 { 83 try 84 { 85 return (Context )new InitialContext ().lookup("java:comp/env"); 87 } 88 catch (Exception e) 89 { 90 log_error("could not lookup Context: "+"java:comp/env", e); 91 return null; 92 } 93 } 94 } 95 | Popular Tags |