1 package test.interceptor.ctx_passing; 2 3 import org.omg.PortableInterceptor.*; 4 import org.omg.IOP.Codec ; 5 import org.omg.IOP.ServiceContext ; 6 7 16 17 public class ServerInterceptor 18 extends org.omg.CORBA.LocalObject 19 implements ServerRequestInterceptor 20 { 21 private int slot_id = -1; 22 private Codec codec = null; 23 24 public ServerInterceptor(int slot_id, Codec codec) 25 { 26 this.slot_id = slot_id; 27 this.codec = codec; 28 } 29 30 public String name() 32 { 33 return "ServerInterceptor"; 34 } 35 36 public void destroy() 37 { 38 } 39 40 public void receive_request_service_contexts(ServerRequestInfo ri) 41 throws ForwardRequest 42 { 43 System.out.println("ServerInterceptor: receive_request_service_contexts()"); 44 45 try 46 { 47 ServiceContext ctx = 48 ri.get_request_service_context( 4711 ); 49 50 ri.set_slot( slot_id, codec.decode( ctx.context_data )); 51 } 52 catch (Exception e) 53 { 54 e.printStackTrace(); 55 } 56 } 57 58 public void receive_request(ServerRequestInfo ri) 59 throws ForwardRequest{ 60 } 61 62 public void send_reply(ServerRequestInfo ri){ 63 } 64 65 public void send_exception(ServerRequestInfo ri) 66 throws ForwardRequest{ 67 } 68 69 public void send_other(ServerRequestInfo ri) 70 throws ForwardRequest{ 71 } 72 73 } 75 76 | Popular Tags |