Commit 9f23d0bf authored by Michael Davis's avatar Michael Davis
Browse files

Serializes and sends response from XrdSsi server

parent b7341d17
......@@ -7,6 +7,26 @@
// This is for specialized private methods called by RequestProc::Execute to handle actions, alerts
// and metadata
template <>
void RequestProc<xrdssi::test::Request, xrdssi::test::Result>::ExecuteAction()
{
// Output message in Json format (for debugging)
std::cerr << "Received message:" << std::endl;
std::cerr << xrdssi::test::MessageToJsonString(request);
// Set reply
response.set_result_code(0);
response.mutable_response()->set_message_text("This is the reply to " + *request.mutable_message_text());
// Output message in Json format (for debugging)
std::cerr << "Sending response:" << std::endl;
std::cerr << xrdssi::test::MessageToJsonString(response);
}
template <>
void RequestProc<xrdssi::test::Request, xrdssi::test::Result>::ExecuteMetadata()
{
......
......@@ -29,9 +29,11 @@ public:
virtual void Finished(XrdSsiRequest &rqstR, const XrdSsiRespInfo &rInfo, bool cancel=false) override;
private:
void ExecuteAction() {}
void ExecuteAlerts() {}
void ExecuteMetadata() {}
// These methods should be specialized according to the needs of each <RequestType, ResponseType> pair
void ExecuteAction() { std::cerr << "Called default ExecuteAction()" << std::endl; }
void ExecuteAlerts() { std::cerr << "Called default ExecuteAlerts()" << std::endl; }
void ExecuteMetadata() { std::cerr << "Called default ExecuteMetadata()" << std::endl; }
RequestType request;
ResponseType response;
......@@ -62,7 +64,7 @@ void RequestProc<RequestType, ResponseType>::Execute()
throw XrdSsiException("ParseFromString() failed");
}
// Release the request buffer (optional, perhaps it is more efficient to reuse it)
// Release the request buffer (optional, perhaps it is more efficient to reuse it?)
ReleaseRequestBuffer();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment