Class representing a ServerRequest object. More...
#include <TAO_Server_Request.h>
Public Member Functions | |
TAO_ServerRequest (TAO_GIOP_Message_Base *mesg_base, TAO_InputCDR &input, TAO_OutputCDR &output, TAO_Transport *transport, TAO_ORB_Core *orb_core) | |
TAO_ServerRequest (TAO_GIOP_Message_Base *mesg_base, CORBA::ULong request_id, CORBA::Boolean response_expected, CORBA::Boolean deferred_flag, TAO::ObjectKey &object_key, const char *operation, TAO_OutputCDR &output, TAO_Transport *transport, TAO_ORB_Core *orb_core, int &parse_error) | |
TAO_ServerRequest (TAO_ORB_Core *orb_core, TAO_Operation_Details const &details, CORBA::Object_ptr target) | |
Constructor used by thru-POA collocated invocation path. | |
~TAO_ServerRequest (void) | |
Destructor. | |
CORBA::ORB_ptr | orb (void) |
Return the underlying ORB. | |
TAO_ORB_Core * | orb_core (void) const |
Return the ORB core pointer member. | |
void | init_reply (void) |
Start a Reply message. | |
TAO_InputCDR * | incoming (void) const |
Retrieve the incoming stream. | |
TAO_OutputCDR * | outgoing (void) const |
Retrieve the outgoing stream. | |
CORBA::Boolean | response_expected (void) const |
Is the response expected? | |
CORBA::Boolean | deferred_reply (void) const |
Should the reply be deferred? | |
void | response_expected (CORBA::Boolean response) |
Set the response expected flag. | |
CORBA::Boolean | sync_with_server (void) const |
Should we return before dispatching the servant? | |
void | sync_with_server (CORBA::Boolean sync_flag) |
Set the sync_with_server flag. | |
void | send_no_exception_reply (void) |
Used with reliable oneway requests. | |
TAO::ObjectKey & | object_key (void) |
TAO_Service_Context & | request_service_context (void) |
Return the request TAO_Service_Context. | |
TAO_Service_Context & | reply_service_context (void) |
Return the reply TAO_Service_Context. | |
IOP::ServiceContextList & | reply_service_info (void) |
IOP::ServiceContextList & | request_service_info (void) |
TAO_Transport * | transport () |
Return the underlying transport. | |
void | forward_location (CORBA::Object_ptr forward_reference) |
CORBA::Object_ptr | forward_location (void) |
Get the forward_location. | |
bool | is_forwarded (void) const |
GIOP::ReplyStatusType | reply_status (void) |
Get the reply status. | |
void | reply_status (GIOP::ReplyStatusType except_type) |
Set the reply status. | |
void | requesting_principal (const CORBA::OctetSeq &principal) |
Set the requesting principal. | |
TAO_Tagged_Profile & | profile (void) |
Return the reference to the tagged profile. | |
void | tao_send_reply (void) |
void | tao_send_reply_exception (const CORBA::Exception &ex) |
void | is_dsi (void) |
Set the boolean member to true. | |
void | dsi_nvlist_align (ptrdiff_t alignment) |
Set the member. | |
TAO_Operation_Details const * | operation_details (void) const |
Get the operation details for the current request. | |
void | argument_flag (CORBA::Boolean flag) |
Set the argument_flag. | |
CORBA::Boolean | argument_flag (void) |
Get the argument_flag. | |
bool | collocated (void) const |
Returns true if the current request is collocated. | |
void | send_cached_reply (CORBA::OctetSeq &ocs) |
size_t & | interceptor_count (void) |
TAO::PICurrent_Impl * | rs_pi_current (void) |
Return a reference to the "request scope" PICurrent object. | |
CORBA::Exception * | caught_exception (void) |
void | caught_exception (CORBA::Exception *exception) |
void | pi_reply_status (PortableInterceptor::ReplyStatus s) |
Set the status of the received reply. | |
PortableInterceptor::ReplyStatus | pi_reply_status (void) |
Get the status of the received reply. | |
Request attributes. | |
const char * | operation (void) const |
Return the operation name. | |
void | operation (const char *operation, size_t length, int release) |
Set the operation name. | |
size_t | operation_length (void) const |
Return the length of the operation. | |
CORBA::ULong | request_id (void) |
void | request_id (CORBA::ULong req) |
Private Member Functions | |
TAO_ServerRequest (void) | |
Private Attributes | |
TAO_GIOP_Message_Base * | mesg_base_ |
const char * | operation_ |
Operation name. | |
size_t | operation_len_ |
Operation length. | |
bool | release_operation_ |
Do we own the memory associated with operation_? | |
CORBA::Object_var | forward_location_ |
bool | is_forwarded_ |
TAO_InputCDR * | incoming_ |
Incoming stream. | |
TAO_OutputCDR * | outgoing_ |
Outgoing stream. | |
CORBA::Boolean | response_expected_ |
CORBA::Boolean | deferred_reply_ |
CORBA::Boolean | sync_with_server_ |
CORBA::Boolean | is_dsi_ |
Did we get passed to a CORBA::ServerRequest? | |
GIOP::ReplyStatusType | reply_status_ |
Reply status (will be NO_EXCEPTION in the majority of the cases). | |
TAO_ORB_Core * | orb_core_ |
TAO_Service_Context | request_service_context_ |
Service Context info. | |
TAO_Service_Context | reply_service_context_ |
CORBA::ULong | request_id_ |
Unique identifier for a request. | |
TAO_Tagged_Profile | profile_ |
The tagged profile that has the addressing information. | |
CORBA::OctetSeq_var | requesting_principal_ |
Identifies the requester. | |
ptrdiff_t | dsi_nvlist_align_ |
Used to pad CDR stream if we have used DSI. | |
TAO_Operation_Details const * | operation_details_ |
CORBA::Boolean | argument_flag_ |
size_t | interceptor_count_ |
TAO::PICurrent_Impl * | rs_pi_current_ |
CORBA::Exception * | caught_exception_ |
Pointer to the caught exception. | |
PortableInterceptor::ReplyStatus | pi_reply_status_ |
Reply status for the current request. | |
TAO::Transport_Selection_Guard | transport_ |
Friends | |
class | TAO::CSD::FW_Server_Request_Wrapper |
class | TAO_AMH_Response_Handler |
Declare TAO_AMH_Response_Handler a friend. |
Class representing a ServerRequest object.
Encapsulates CDR, transport and pluggable messaging components on the server side.
Definition at line 82 of file TAO_Server_Request.h.
TAO_ServerRequest::TAO_ServerRequest | ( | TAO_GIOP_Message_Base * | mesg_base, | |
TAO_InputCDR & | input, | |||
TAO_OutputCDR & | output, | |||
TAO_Transport * | transport, | |||
TAO_ORB_Core * | orb_core | |||
) |
Definition at line 51 of file TAO_Server_Request.cpp.
: mesg_base_ (mesg_base), operation_ (0), operation_len_ (0), release_operation_ (false), is_forwarded_ (false), incoming_ (&input), outgoing_ (&output), response_expected_ (false), deferred_reply_ (false), sync_with_server_ (false), is_dsi_ (false), // @@ We shouldn't be using GIOP specific types here. Need to be revisited. reply_status_ (GIOP::NO_EXCEPTION), orb_core_ (orb_core), request_id_ (0), profile_ (orb_core), requesting_principal_ (0), dsi_nvlist_align_ (0), operation_details_ (0), argument_flag_ (true) #if TAO_HAS_INTERCEPTORS == 1 , interceptor_count_ (0) , rs_pi_current_ (0) , caught_exception_ (0) , pi_reply_status_ (-1) #endif /* TAO_HAS_INTERCEPTORS == 1 */ , transport_(transport) //already duplicated in TAO_Transport::process_parsed_messages () { ACE_FUNCTION_TIMEPROBE (TAO_SERVER_REQUEST_START); // No-op. }
TAO_ServerRequest::TAO_ServerRequest | ( | TAO_GIOP_Message_Base * | mesg_base, | |
CORBA::ULong | request_id, | |||
CORBA::Boolean | response_expected, | |||
CORBA::Boolean | deferred_flag, | |||
TAO::ObjectKey & | object_key, | |||
const char * | operation, | |||
TAO_OutputCDR & | output, | |||
TAO_Transport * | transport, | |||
TAO_ORB_Core * | orb_core, | |||
int & | parse_error | |||
) |
Definition at line 89 of file TAO_Server_Request.cpp.
: mesg_base_ (mesg_base), operation_ (CORBA::string_dup (operation)), operation_len_ (operation == 0 ? 0 : ACE_OS::strlen (operation)), release_operation_ (true), is_forwarded_ (false), incoming_ (0), outgoing_ (&output), response_expected_ (response_expected), deferred_reply_ (deferred_reply), sync_with_server_ (false), is_dsi_ (false), reply_status_ (GIOP::NO_EXCEPTION), orb_core_ (orb_core), request_id_ (request_id), profile_ (orb_core), requesting_principal_ (0), dsi_nvlist_align_ (0), operation_details_ (0), argument_flag_ (true) #if TAO_HAS_INTERCEPTORS == 1 , interceptor_count_ (0) , rs_pi_current_ (0) , caught_exception_ (0) , pi_reply_status_ (-1) #endif /* TAO_HAS_INTERCEPTORS == 1 */ , transport_(transport) //already duplicated in TAO_Transport::process_parsed_messages () { this->profile_.object_key (object_key); parse_error = 0; }
TAO_ServerRequest::TAO_ServerRequest | ( | TAO_ORB_Core * | orb_core, | |
TAO_Operation_Details const & | details, | |||
CORBA::Object_ptr | target | |||
) |
Constructor used by thru-POA collocated invocation path.
Definition at line 131 of file TAO_Server_Request.cpp.
: mesg_base_ (0), operation_ (details.opname ()), operation_len_ (details.opname_len ()), release_operation_ (false), is_forwarded_ (false), incoming_ (0), outgoing_ (0), response_expected_ (details.response_flags () == TAO_TWOWAY_RESPONSE_FLAG || details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_SERVER) || details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_TARGET)), deferred_reply_ (false), sync_with_server_ (details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_SERVER)), is_dsi_ (false), reply_status_ (GIOP::NO_EXCEPTION), orb_core_ (orb_core), request_id_ (0), profile_ (orb_core), requesting_principal_ (0), dsi_nvlist_align_ (0), operation_details_ (&details), argument_flag_ (false) #if TAO_HAS_INTERCEPTORS == 1 , interceptor_count_ (0) , rs_pi_current_ (0) , caught_exception_ (0) , pi_reply_status_ (-1) #endif /* TAO_HAS_INTERCEPTORS == 1 */ , transport_ (0) { // Have to use a const_cast<>. *sigh* this->profile_.object_key ( const_cast<TAO::ObjectKey &> (target->_stubobj ()->object_key ())); // Shallow copy the request service context list. This way the operation // details and server request share the request context. IOP::ServiceContextList & dest_request_contexts = this->request_service_context_.service_info (); IOP::ServiceContextList & src_request_contexts = (const_cast <TAO_Operation_Details&> (details)).request_service_info (); dest_request_contexts.replace (src_request_contexts.maximum (), src_request_contexts.length (), src_request_contexts.get_buffer (), false /* Do not release. */); // Don't shallow copy the reply service context. It is probably empty, // when then during the request it is used, the buffer gets allocated and // then the operation details don't get the reply service context }
TAO_ServerRequest::~TAO_ServerRequest | ( | void | ) |
Destructor.
Definition at line 185 of file TAO_Server_Request.cpp.
{ #if TAO_HAS_INTERCEPTORS == 1 if (this->rs_pi_current_) { TAO::ServerRequestInterceptor_Adapter *interceptor_adapter = this->orb_core_->serverrequestinterceptor_adapter (); if (interceptor_adapter) { interceptor_adapter->deallocate_pi_current ( this->rs_pi_current_); } } #endif /* TAO_HAS_INTERCEPTORS == 1 */ if (this->release_operation_) CORBA::string_free (const_cast<char*> (this->operation_)); }
TAO_ServerRequest::TAO_ServerRequest | ( | void | ) | [private] |
Default ctor only used to create a TAO_ServerRequest that is about to be the target of a clone operation.
Definition at line 11 of file TAO_Server_Request.inl.
: mesg_base_ (0), operation_ (0), operation_len_ (0), release_operation_ (false), incoming_ (0), outgoing_ (0), response_expected_ (false), deferred_reply_ (false), sync_with_server_ (false), is_dsi_ (false), reply_status_ (GIOP::NO_EXCEPTION), orb_core_ (0), request_id_ (0), profile_ (0), requesting_principal_ (0), dsi_nvlist_align_ (0), operation_details_ (0), argument_flag_ (true) #if TAO_HAS_INTERCEPTORS == 1 , interceptor_count_ (0) , rs_pi_current_ () , caught_exception_ (0) , pi_reply_status_ (-1) #endif /* TAO_HAS_INTERCEPTORS == 1 */ , transport_(0) { }
void TAO_ServerRequest::argument_flag | ( | CORBA::Boolean | flag | ) |
Set the argument_flag.
Definition at line 224 of file TAO_Server_Request.inl.
{ this->argument_flag_ = flag; }
CORBA::Boolean TAO_ServerRequest::argument_flag | ( | void | ) |
Get the argument_flag.
Definition at line 218 of file TAO_Server_Request.inl.
{ return this->argument_flag_; }
CORBA::Exception * TAO_ServerRequest::caught_exception | ( | void | ) |
Definition at line 244 of file TAO_Server_Request.inl.
{ return this->caught_exception_; }
void TAO_ServerRequest::caught_exception | ( | CORBA::Exception * | exception | ) |
Definition at line 565 of file TAO_Server_Request.cpp.
{ if (CORBA::SystemException::_downcast (exception) != 0) this->pi_reply_status_ = PortableInterceptor::SYSTEM_EXCEPTION; else if (CORBA::UserException::_downcast (exception) != 0) this->pi_reply_status_ = PortableInterceptor::USER_EXCEPTION; this->caught_exception_ = exception; }
bool TAO_ServerRequest::collocated | ( | void | ) | const |
Returns true
if the current request is collocated.
Definition at line 230 of file TAO_Server_Request.inl.
{ return this->transport_.get () == 0; }
CORBA::Boolean TAO_ServerRequest::deferred_reply | ( | void | ) | const |
Should the reply be deferred?
Definition at line 90 of file TAO_Server_Request.inl.
{ return this->deferred_reply_; }
void TAO_ServerRequest::dsi_nvlist_align | ( | ptrdiff_t | alignment | ) |
Set the member.
Definition at line 212 of file TAO_Server_Request.inl.
{ this->dsi_nvlist_align_ = alignment; }
void TAO_ServerRequest::forward_location | ( | CORBA::Object_ptr | forward_reference | ) |
Set the reference to the object the request should be forwarded to. This reference will only be used if set prior to calling init_reply().
Definition at line 168 of file TAO_Server_Request.inl.
{ this->forward_location_ = CORBA::Object::_duplicate (forward_reference); this->is_forwarded_ = true; }
CORBA::Object_ptr TAO_ServerRequest::forward_location | ( | void | ) |
Get the forward_location.
Definition at line 176 of file TAO_Server_Request.inl.
{ return CORBA::Object::_duplicate (this->forward_location_.in ()); }
TAO_InputCDR * TAO_ServerRequest::incoming | ( | void | ) | const |
Retrieve the incoming stream.
Definition at line 47 of file TAO_Server_Request.inl.
{ return this->incoming_; }
void TAO_ServerRequest::init_reply | ( | void | ) |
Start a Reply message.
Definition at line 226 of file TAO_Server_Request.cpp.
{ if (!this->outgoing_) return; // Collocated // Construct our reply generator. TAO_Pluggable_Reply_Params_Base reply_params; // We put all the info that we have in to this <reply_params> and // call the <write_reply_header> in the // pluggable_messaging_interface. One point to be noted however is // that, it was the pluggable_messaging classes who created us and // delegated us to do work on its behalf. But we would be calling // back. As we don't have a LOCK or any such things we can call // pluggable_messaging guys again. We would be on the same thread of // invocation. So *theoretically* there should not be a problem. reply_params.request_id_ = this->request_id_; reply_params.is_dsi_ = this->is_dsi_; reply_params.dsi_nvlist_align_ = this->dsi_nvlist_align_; // Send back the reply service context. reply_params.service_context_notowned (&this->reply_service_info ()); // Are we going to marshall any data with the reply? reply_params.argument_flag_ = this->argument_flag_; // Forward exception only. if (this->is_forwarded_) { CORBA::Boolean const permanent_forward_condition = this->orb_core_->is_permanent_forward_condition (this->forward_location_.in (), this->request_service_context ()); reply_params.reply_status ( permanent_forward_condition ? GIOP::LOCATION_FORWARD_PERM : GIOP::LOCATION_FORWARD); } // Any exception at all. else { reply_params.reply_status (this->reply_status_); } this->outgoing_->message_attributes (this->request_id_, 0, TAO_REPLY, 0); // Construct a REPLY header. this->mesg_base_->generate_reply_header (*this->outgoing_, reply_params); // Finish the GIOP Reply header, then marshal the exception. if (reply_params.reply_status () == GIOP::LOCATION_FORWARD || reply_params.reply_status () == GIOP::LOCATION_FORWARD_PERM) { // Marshal the forward location pointer. CORBA::Object_ptr object_ptr = this->forward_location_.in (); if ((*this->outgoing_ << object_ptr) == 0) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - ServerRequest::init_reply, ") ACE_TEXT ("TAO_GIOP_ServerRequest::marshal - ") ACE_TEXT ("marshal encoding forwarded objref failed\n"))); } } this->transport_->assign_translators (0, this->outgoing_); }
size_t & TAO_ServerRequest::interceptor_count | ( | void | ) |
Return a reference to the number of interceptors pushed on to the current interceptor flow stack.
Definition at line 238 of file TAO_Server_Request.inl.
{ return this->interceptor_count_; }
void TAO_ServerRequest::is_dsi | ( | void | ) |
Set the boolean member to true.
Definition at line 200 of file TAO_Server_Request.inl.
{ this->is_dsi_ = true; }
bool TAO_ServerRequest::is_forwarded | ( | void | ) | const |
Since forward location is allowed to be nil then this is a proper method to check if the request is being forwarded.
Definition at line 182 of file TAO_Server_Request.inl.
{ return this->is_forwarded_; }
TAO::ObjectKey & TAO_ServerRequest::object_key | ( | void | ) |
Definition at line 114 of file TAO_Server_Request.inl.
{ return this->profile_.object_key (); }
void TAO_ServerRequest::operation | ( | const char * | operation, | |
size_t | length, | |||
int | release | |||
) |
Set the operation name.
Definition at line 65 of file TAO_Server_Request.inl.
{ if (this->release_operation_) CORBA::string_free (const_cast <char*> (this->operation_)); this->operation_len_ = (length == 0 ? ACE_OS::strlen (operation) : length); this->release_operation_ = release; this->operation_ = operation; }
const char * TAO_ServerRequest::operation | ( | void | ) | const |
Return the operation name.
Definition at line 59 of file TAO_Server_Request.inl.
{ return (this->operation_ == 0 ? "" : this->operation_); }
TAO_Operation_Details const * TAO_ServerRequest::operation_details | ( | void | ) | const |
Get the operation details for the current request.
Definition at line 206 of file TAO_Server_Request.inl.
{ return this->operation_details_; }
size_t TAO_ServerRequest::operation_length | ( | void | ) | const |
Return the length of the operation.
Definition at line 78 of file TAO_Server_Request.inl.
{ return this->operation_len_; }
CORBA::ORB_ptr TAO_ServerRequest::orb | ( | void | ) |
Return the underlying ORB.
Definition at line 205 of file TAO_Server_Request.cpp.
TAO_ORB_Core * TAO_ServerRequest::orb_core | ( | void | ) | const |
Return the ORB core pointer member.
Definition at line 41 of file TAO_Server_Request.inl.
{ return this->orb_core_; }
TAO_OutputCDR * TAO_ServerRequest::outgoing | ( | void | ) | const |
Retrieve the outgoing stream.
Definition at line 53 of file TAO_Server_Request.inl.
{ return this->outgoing_; }
void TAO_ServerRequest::pi_reply_status | ( | PortableInterceptor::ReplyStatus | s | ) |
Set the status of the received reply.
Definition at line 250 of file TAO_Server_Request.inl.
{ this->pi_reply_status_ = s; }
PortableInterceptor::ReplyStatus TAO_ServerRequest::pi_reply_status | ( | void | ) |
Get the status of the received reply.
Definition at line 256 of file TAO_Server_Request.inl.
{ return this->pi_reply_status_; }
TAO_Tagged_Profile & TAO_ServerRequest::profile | ( | void | ) |
Return the reference to the tagged profile.
Definition at line 162 of file TAO_Server_Request.inl.
{ return this->profile_; }
TAO_Service_Context & TAO_ServerRequest::reply_service_context | ( | void | ) |
Return the reply TAO_Service_Context.
Definition at line 211 of file TAO_Server_Request.cpp.
{ if (!operation_details_) { return this->reply_service_context_; } else { return const_cast <TAO_Operation_Details*> ( this->operation_details_)->reply_service_context (); } }
IOP::ServiceContextList & TAO_ServerRequest::reply_service_info | ( | void | ) |
Definition at line 126 of file TAO_Server_Request.inl.
{ return this->reply_service_context ().service_info (); }
GIOP::ReplyStatusType TAO_ServerRequest::reply_status | ( | void | ) |
Get the reply status.
Definition at line 188 of file TAO_Server_Request.inl.
{ return this->reply_status_; }
void TAO_ServerRequest::reply_status | ( | GIOP::ReplyStatusType | except_type | ) |
Set the reply status.
Definition at line 194 of file TAO_Server_Request.inl.
{ this->reply_status_ = reply_status; }
CORBA::ULong TAO_ServerRequest::request_id | ( | void | ) |
To handle System Exceptions at the lowest level, a method returning the request_id_ is needed.
Definition at line 144 of file TAO_Server_Request.inl.
{ return this->request_id_; }
void TAO_ServerRequest::request_id | ( | CORBA::ULong | req | ) |
To handle System Exceptions at the lowest level, a method returning the request_id_ is needed.
Definition at line 150 of file TAO_Server_Request.inl.
{ this->request_id_ = req; }
TAO_Service_Context & TAO_ServerRequest::request_service_context | ( | void | ) |
Return the request TAO_Service_Context.
Definition at line 120 of file TAO_Server_Request.inl.
{ return this->request_service_context_; }
IOP::ServiceContextList & TAO_ServerRequest::request_service_info | ( | void | ) |
Definition at line 132 of file TAO_Server_Request.inl.
{ return this->request_service_context ().service_info (); }
void TAO_ServerRequest::requesting_principal | ( | const CORBA::OctetSeq & | principal | ) |
Set the requesting principal.
Definition at line 156 of file TAO_Server_Request.inl.
{ this->requesting_principal_ = principal; }
void TAO_ServerRequest::response_expected | ( | CORBA::Boolean | response | ) |
Set the response expected flag.
Definition at line 96 of file TAO_Server_Request.inl.
{ this->response_expected_ = response; }
CORBA::Boolean TAO_ServerRequest::response_expected | ( | void | ) | const |
Is the response expected?
Definition at line 84 of file TAO_Server_Request.inl.
{ return this->response_expected_; }
TAO::PICurrent_Impl * TAO_ServerRequest::rs_pi_current | ( | void | ) |
Return a reference to the "request scope" PICurrent object.
Definition at line 576 of file TAO_Server_Request.cpp.
{ if (!this->rs_pi_current_) { TAO::ServerRequestInterceptor_Adapter *interceptor_adapter = this->orb_core_->serverrequestinterceptor_adapter (); if (interceptor_adapter) { this->rs_pi_current_ = interceptor_adapter->allocate_pi_current (); } } return this->rs_pi_current_; }
void TAO_ServerRequest::send_cached_reply | ( | CORBA::OctetSeq & | ocs | ) |
Send cached reply. Used in scenarios where the FTORB thinks that this request is a duplicate
Append reply here....
Definition at line 479 of file TAO_Server_Request.cpp.
{ #if defined(ACE_INITIALIZE_MEMORY_BEFORE_USE) // Only inititialize the buffer if we're compiling with Purify. // Otherwise, there is no real need to do so, especially since // we can avoid the initialization overhead at runtime if we // are not compiling with Purify support. char repbuf[ACE_CDR::DEFAULT_BUFSIZE] = { 0 }; #else char repbuf[ACE_CDR::DEFAULT_BUFSIZE]; #endif /* ACE_HAS_PURIFY */ TAO_GIOP_Message_Version gv; if (this->outgoing_) { this->outgoing_->get_version (gv); } TAO_OutputCDR output (repbuf, sizeof repbuf, TAO_ENCAP_BYTE_ORDER, this->orb_core_->output_cdr_buffer_allocator (), this->orb_core_->output_cdr_dblock_allocator (), this->orb_core_->output_cdr_msgblock_allocator (), this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (), this->mesg_base_->fragmentation_strategy (), gv.major, gv.minor); this->transport_->assign_translators (0, &output); // A copy of the reply parameters TAO_Pluggable_Reply_Params_Base reply_params; reply_params.request_id_ = this->request_id_; reply_params.svc_ctx_.length (0); // Send back the empty reply service context. reply_params.service_context_notowned (&this->reply_service_info ()); // We are going to send some data reply_params.argument_flag_ = true; // Make a default reply status reply_params.reply_status (GIOP::NO_EXCEPTION); this->outgoing_->message_attributes (this->request_id_, 0, TAO_REPLY, 0); // Make the reply message if (this->mesg_base_->generate_reply_header (*this->outgoing_, reply_params) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - ServerRequest::send_cached_reply, ") ACE_TEXT ("could not make cached reply\n"))); } /// Append reply here.... this->outgoing_->write_octet_array ( s.get_buffer (), s.length ()); if (!this->outgoing_->good_bit ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - ServerRequest::send_cached_reply, ") ACE_TEXT ("could not marshal reply\n"))); } this->outgoing_->more_fragments (false); // Send the message if (this->transport_->send_message (*this->outgoing_, 0, TAO_REPLY) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - ServerRequest::send_cached_reply, ") ACE_TEXT ("could not send cached reply\n"))); } }
void TAO_ServerRequest::send_no_exception_reply | ( | void | ) |
Used with reliable oneway requests.
Definition at line 297 of file TAO_Server_Request.cpp.
{ // Construct our reply generator. TAO_Pluggable_Reply_Params_Base reply_params; reply_params.request_id_ = this->request_id_; reply_params.is_dsi_ = this->is_dsi_; reply_params.dsi_nvlist_align_ = this->dsi_nvlist_align_; // Change this to pass back the same thing we received, as well as // leave a comment why this is important! reply_params.svc_ctx_.length (0); // Send back the reply service context. reply_params.service_context_notowned (&this->reply_service_info ()); reply_params.reply_status (GIOP::NO_EXCEPTION); // No data anyway. reply_params.argument_flag_ = false; this->outgoing_->message_attributes (this->request_id_, 0, TAO_REPLY, 0); // Construct a REPLY header. this->mesg_base_->generate_reply_header (*this->outgoing_, reply_params); this->outgoing_->more_fragments (false); // Send the message. int result = this->transport_->send_message (*this->outgoing_, 0, TAO_REPLY); if (result == -1) { if (TAO_debug_level > 0) { // No exception but some kind of error, yet a response // is required. ACE_ERROR (( LM_ERROR, ACE_TEXT ("TAO (%P|%t) - ServerRequest::send_no_exception_reply, ") ACE_TEXT ("cannot send NO_EXCEPTION reply\n") )); } } }
CORBA::Boolean TAO_ServerRequest::sync_with_server | ( | void | ) | const |
Should we return before dispatching the servant?
Definition at line 102 of file TAO_Server_Request.inl.
{ return this->sync_with_server_; }
void TAO_ServerRequest::sync_with_server | ( | CORBA::Boolean | sync_flag | ) |
Set the sync_with_server flag.
Definition at line 108 of file TAO_Server_Request.inl.
{ this->sync_with_server_ = sync_flag; }
void TAO_ServerRequest::tao_send_reply | ( | void | ) |
Definition at line 348 of file TAO_Server_Request.cpp.
{ if (this->collocated ()) return; // No transport in the collocated case. this->outgoing_->more_fragments (false); int const result = this->transport_->send_message (*this->outgoing_, 0, TAO_REPLY); if (result == -1) { if (TAO_debug_level > 0) { // No exception but some kind of error, yet a response // is required. ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - ServerRequest::tao_send_reply, ") ACE_TEXT ("cannot send reply\n"))); } } }
void TAO_ServerRequest::tao_send_reply_exception | ( | const CORBA::Exception & | ex | ) |
Definition at line 372 of file TAO_Server_Request.cpp.
{ if (this->response_expected_ && !this->collocated ()) { // A copy of the reply parameters TAO_Pluggable_Reply_Params_Base reply_params; reply_params.request_id_ = this->request_id_; reply_params.svc_ctx_.length (0); // Send back the reply service context. reply_params.service_context_notowned (&this->reply_service_info ()); // We are going to send some data reply_params.argument_flag_ = true; // Make a default reply status // Check whether we are able to downcast the exception if (CORBA::SystemException::_downcast (&ex) != 0) { reply_params.reply_status (GIOP::SYSTEM_EXCEPTION); } else { reply_params.reply_status (GIOP::USER_EXCEPTION); } // Create a new output CDR stream #if defined(ACE_INITIALIZE_MEMORY_BEFORE_USE) // Only inititialize the buffer if we're compiling with a profiler. // Otherwise, there is no real need to do so, especially since // we can avoid the initialization overhead at runtime if we // are not compiling with memory profiler support. char repbuf[ACE_CDR::DEFAULT_BUFSIZE] = { 0 }; #else char repbuf[ACE_CDR::DEFAULT_BUFSIZE]; #endif /* ACE_INITIALIZE_MEMORY_BEFORE_USE */ TAO_GIOP_Message_Version gv; if (this->outgoing_) this->outgoing_->get_version (gv); TAO_OutputCDR output (repbuf, sizeof repbuf, TAO_ENCAP_BYTE_ORDER, this->orb_core_->output_cdr_buffer_allocator (), this->orb_core_->output_cdr_dblock_allocator (), this->orb_core_->output_cdr_msgblock_allocator (), this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (), this->mesg_base_->fragmentation_strategy (), gv.major, gv.minor); this->transport_->assign_translators (0, &output); try { // Make the reply message if (this->mesg_base_->generate_exception_reply (*this->outgoing_, reply_params, ex) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - ServerRequest::") ACE_TEXT ("tao_send_reply_exception, ") ACE_TEXT ("could not make exception reply\n"))); } this->outgoing_->more_fragments (false); // Send the message if (this->transport_->send_message (*this->outgoing_, 0, TAO_REPLY) == -1) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - ServerRequest::") ACE_TEXT ("tao_send_reply_exception, ") ACE_TEXT ("could not send exception reply\n"))); } } catch (const ::CORBA::BAD_PARAM &bp_ex) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - ServerRequest::") ACE_TEXT ("tao_send_reply_exception, ") ACE_TEXT ("could not marshal exception reply\n"))); this->tao_send_reply_exception (bp_ex); } } else if (TAO_debug_level > 0) { // It is unfortunate that an exception (probably a system // exception) was thrown by the upcall code (even by the // user) when the client was not expecting a response. // However, in this case, we cannot close the connection // down, since it really isn't the client's fault. ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - ServerRequest::tao_send_reply_exception, ") ACE_TEXT ("exception thrown ") ACE_TEXT ("but client is not waiting a response\n"))); } }
TAO_Transport * TAO_ServerRequest::transport | ( | void | ) |
Return the underlying transport.
Definition at line 138 of file TAO_Server_Request.inl.
{ return this->transport_.get (); }
friend class TAO::CSD::FW_Server_Request_Wrapper [friend] |
Declare FW_Server_Request_Wrapper a friend This friendship makes the FW_Server_Request_Wrapper be able to clone the TAO_ServerRequest.
Definition at line 89 of file TAO_Server_Request.h.
friend class TAO_AMH_Response_Handler [friend] |
Declare TAO_AMH_Response_Handler a friend.
The TAO_AMH_Response_Handler class needs to copy part of the state in a TAO_ServerRequest, however, we do not want to expose that state as public members of this class, neither do we want to add modifiers to the TAO_AMH_Response_Handler class that would allow us (the TAO_ServerRequest class) to set the state.
Lucky for us, C++ is a language for adult developers, and allow us to use the evil "friend" declaration.
Definition at line 103 of file TAO_Server_Request.h.
An argument flag to indicate whether there is any data that is going to get marshaled along as a reply. The default will be true which indicates that we have some data that needs to be sent back to the client.
Definition at line 355 of file TAO_Server_Request.h.
Pointer to the caught exception.
Definition at line 367 of file TAO_Server_Request.h.
false: Reply would be sent by the object of this class which is the default. true: Reply would not be prepared by this class and it would be deferred for somebody.
Definition at line 315 of file TAO_Server_Request.h.
ptrdiff_t TAO_ServerRequest::dsi_nvlist_align_ [private] |
Used to pad CDR stream if we have used DSI.
Definition at line 345 of file TAO_Server_Request.h.
Definition at line 295 of file TAO_Server_Request.h.
TAO_InputCDR* TAO_ServerRequest::incoming_ [private] |
Incoming stream.
Definition at line 300 of file TAO_Server_Request.h.
size_t TAO_ServerRequest::interceptor_count_ [private] |
The number of interceptors pushed on to the current interceptor flow stack.
Definition at line 360 of file TAO_Server_Request.h.
CORBA::Boolean TAO_ServerRequest::is_dsi_ [private] |
Did we get passed to a CORBA::ServerRequest?
Definition at line 322 of file TAO_Server_Request.h.
bool TAO_ServerRequest::is_forwarded_ [private] |
Definition at line 297 of file TAO_Server_Request.h.
Definition at line 284 of file TAO_Server_Request.h.
const char* TAO_ServerRequest::operation_ [private] |
Operation name.
Definition at line 287 of file TAO_Server_Request.h.
TAO_Operation_Details const* TAO_ServerRequest::operation_details_ [private] |
Definition at line 347 of file TAO_Server_Request.h.
size_t TAO_ServerRequest::operation_len_ [private] |
Operation length.
Definition at line 290 of file TAO_Server_Request.h.
TAO_ORB_Core* TAO_ServerRequest::orb_core_ [private] |
A pointer to the ORB Core for the context where the request was created.
Definition at line 329 of file TAO_Server_Request.h.
TAO_OutputCDR* TAO_ServerRequest::outgoing_ [private] |
Outgoing stream.
Definition at line 303 of file TAO_Server_Request.h.
Reply status for the current request.
Definition at line 370 of file TAO_Server_Request.h.
The tagged profile that has the addressing information.
Definition at line 339 of file TAO_Server_Request.h.
bool TAO_ServerRequest::release_operation_ [private] |
Do we own the memory associated with operation_?
Definition at line 293 of file TAO_Server_Request.h.
Definition at line 333 of file TAO_Server_Request.h.
GIOP::ReplyStatusType TAO_ServerRequest::reply_status_ [private] |
Reply status (will be NO_EXCEPTION in the majority of the cases).
Definition at line 325 of file TAO_Server_Request.h.
CORBA::ULong TAO_ServerRequest::request_id_ [private] |
Unique identifier for a request.
Definition at line 336 of file TAO_Server_Request.h.
Service Context info.
Definition at line 332 of file TAO_Server_Request.h.
CORBA::OctetSeq_var TAO_ServerRequest::requesting_principal_ [private] |
Identifies the requester.
Definition at line 342 of file TAO_Server_Request.h.
false: oneway (SYNC_NONE or SYNC_WITH_TRANSPORT) true: twoway, or oneway (SYNC_WITH_SERVER or SYNC_WITH_TARGET)
Definition at line 307 of file TAO_Server_Request.h.
TAO::PICurrent_Impl* TAO_ServerRequest::rs_pi_current_ [private] |
The "Request Scope Current" (RSC) object, as required by Portable Interceptors.
Definition at line 364 of file TAO_Server_Request.h.
true: oneway (SYNC_WITH_SERVER) false: anything else
Definition at line 319 of file TAO_Server_Request.h.
TAO::Transport_Selection_Guard TAO_ServerRequest::transport_ [private] |
Transport class. An RAII (resource acquisition is initialization) class instance for interfacing with TSS storage for the "current" transport.
Definition at line 376 of file TAO_Server_Request.h.