Support for new LL Responder API.
This adds mStatus, mReason and mContent to ResponderBase and fills those in instead of passing it to member functions. The added danger here is that now code can accidently try to access these variables while they didn't already get a correct value. Affected members of ResponderBase (that now have less arguments): decode_llsd_body, decode_raw_body, completedHeaders, completed -> httpCompleted, result -> httpSuccess, errorWithContent and error -> httpFailure. New API: ResponderBase::setResult ResponderBase::getStatus() ResponderBase::getReason() ResponderBase::getContent() ResponderBase::getResponseHeaders() (returns AIHTTPReceivedHeaders though, not LLSD) ResponderBase::dumpResponse() ResponderWithCompleted::completeResult ResponderWithResult::failureResult (previously pubErrorWithContent) ResponderWithResult::successResult (previously pubResult) Not implemented: getHTTPMethod() - use getName() instead which returns the class name of the responder. completedHeaders() is still called as usual, although you can ignore it (not implement in a derived responder) and call getResponseHeaders() instead, provided you implement needsHeaders() and have it return true. However, classes derived from ResponderHeadersOnly do not have completedHeaders(), so they still must implement completedHeaders(), and then call getResponseHeaders() or just access mReceivedHeaders directly, as usual.
This commit is contained in:
@@ -73,8 +73,8 @@ public:
|
||||
LLMaterialsResponder(const std::string& pMethod, const std::string& pCapabilityURL, CallbackFunction pCallback);
|
||||
virtual ~LLMaterialsResponder();
|
||||
|
||||
virtual void result(const LLSD& pContent);
|
||||
virtual void error(U32 pStatus, const std::string& pReason);
|
||||
virtual void httpSuccess(void);
|
||||
virtual void httpFailure(void);
|
||||
|
||||
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return materialsResponder_timeout; }
|
||||
/*virtual*/ char const* getName(void) const { return "LLMaterialsResponder"; }
|
||||
@@ -96,18 +96,18 @@ LLMaterialsResponder::~LLMaterialsResponder()
|
||||
{
|
||||
}
|
||||
|
||||
void LLMaterialsResponder::result(const LLSD& pContent)
|
||||
void LLMaterialsResponder::httpSuccess(void)
|
||||
{
|
||||
LL_DEBUGS("Materials") << LL_ENDL;
|
||||
mCallback(true, pContent);
|
||||
mCallback(true, mContent);
|
||||
}
|
||||
|
||||
void LLMaterialsResponder::error(U32 pStatus, const std::string& pReason)
|
||||
void LLMaterialsResponder::httpFailure(void)
|
||||
{
|
||||
LL_WARNS("Materials")
|
||||
<< "\n--------------------------------------------------------------------------\n"
|
||||
<< mMethod << " Error[" << pStatus << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME
|
||||
<< "'\n with url '" << mCapabilityURL << "' because " << pReason
|
||||
<< mMethod << " Error[" << mStatus << "] cannot access cap '" << MATERIALS_CAPABILITY_NAME
|
||||
<< "'\n with url '" << mCapabilityURL << "' because " << mReason
|
||||
<< "\n--------------------------------------------------------------------------"
|
||||
<< LL_ENDL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user