1 24 25 package com.rift.coad.lib.interceptor.iiop; 27 28 import java.util.MissingResourceException ; 30 import org.omg.CORBA.TIMEOUT ; 31 import org.omg.IOP.ServiceContext ; 32 import org.omg.PortableInterceptor.ClientRequestInterceptor ; 33 import org.omg.PortableInterceptor.ClientRequestInfo ; 34 import org.omg.PortableInterceptor.ForwardRequest ; 35 import org.omg.PortableInterceptor.ORBInitInfo ; 36 37 import org.apache.log4j.Logger; 39 40 import com.rift.coad.lib.common.ObjectSerializer; 42 import com.rift.coad.lib.interceptor.credentials.Credential; 43 import com.rift.coad.lib.interceptor.InterceptorWrapper; 44 import com.rift.coad.lib.interceptor.ClientInterceptor; 45 46 47 53 public class SessionClientInterceptor extends InterceptorWrapper implements 54 ClientRequestInterceptor { 55 56 protected static Logger log = 58 Logger.getLogger(SessionClientInterceptor.class.getName()); 59 62 public SessionClientInterceptor(ORBInitInfo info) { 63 } 64 65 66 71 public String name() { 72 return "SessionClientInterceptor"; 73 } 74 75 76 79 public void destroy() { 80 } 82 83 84 87 public void receive_exception(ClientRequestInfo ri) throws ForwardRequest { 88 89 } 90 91 92 96 public void receive_other(ClientRequestInfo ri) throws ForwardRequest { 97 98 } 99 100 101 108 public void receive_reply(ClientRequestInfo ri) { 109 110 } 111 112 113 117 public void send_poll(ClientRequestInfo ri) throws TIMEOUT { 118 119 } 120 121 122 126 public void send_request(ClientRequestInfo ri) throws ForwardRequest { 127 try { 128 log.debug("Send a request on the client side"); 129 ClientInterceptor clientInterceptor = this.getClientInterceptor(); 130 Credential credential = clientInterceptor.getSessionCredential(); 131 ServiceContext securityContext = new ServiceContext ( 132 Constants.STANDARD_SECURITY_CONTEXT_ID,ObjectSerializer. 133 serialize(credential)); 134 ri.add_request_service_context(securityContext,true); 135 } catch (Exception ex) { 136 throw new SecurityInterceptorException( 137 "Failed to setup the context for the call to the server : " + 138 ex.getMessage(),ex); 139 } 140 } 141 142 } 143 | Popular Tags |