2 #include "Server_Request_Interceptor.h"
3 #include "tao/PI_Server/PI_Server.h"
4 #include "tao/ORB_Constants.h"
8 Server_Request_Interceptor::Server_Request_Interceptor (CORBA::ULong request_pass_count
)
9 : request_pass_count_ (request_pass_count
)
11 , to_ (CORBA::Object::_nil ())
16 Server_Request_Interceptor::forward (
19 if (CORBA::is_nil (to
))
20 throw CORBA::INV_OBJREF (
21 CORBA::SystemException::_tao_minor_code (
26 ACE_TCHAR
*argv
[] = {NULL
};
29 // Fetch the ORB having been initialized in main()
31 CORBA::ORB_init (argc
, argv
, "Server ORB");
33 CORBA::String_var s_to
= orb
->object_to_string (to
);
35 this->to_
= orb
->string_to_object (s_to
.in ());
39 Server_Request_Interceptor::name ()
41 return CORBA::string_dup ("Server_Request_Interceptor");
45 Server_Request_Interceptor::destroy ()
47 CORBA::release (this->to_
);
51 Server_Request_Interceptor::receive_request_service_contexts (
52 PortableInterceptor::ServerRequestInfo_ptr
)
54 this->request_count_
++;
58 Server_Request_Interceptor::receive_request (
59 PortableInterceptor::ServerRequestInfo_ptr
)
61 if (this->request_count_
== this->request_pass_count_
)
64 "SERVER: Request %d will be forwarded "
65 "to object 'to'\nSERVER: via "
66 "receive_request_service_contexts().\n",
67 this->request_count_
));
69 // Throw forward exception
70 throw PortableInterceptor::ForwardRequest (this->to_
);
75 Server_Request_Interceptor::send_reply (
76 PortableInterceptor::ServerRequestInfo_ptr
)
81 Server_Request_Interceptor::send_exception (
82 PortableInterceptor::ServerRequestInfo_ptr
)
87 Server_Request_Interceptor::send_other (
88 PortableInterceptor::ServerRequestInfo_ptr
)