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:
Aleric Inglewood
2014-07-12 18:29:44 +02:00
parent 3dd846b600
commit 74dff061ff
71 changed files with 721 additions and 752 deletions

View File

@@ -117,7 +117,7 @@ public:
mInvitiationType = invitation_type;
}
/*virtual*/ void result(const LLSD& content)
/*virtual*/ void httpSuccess(void)
{
if ( gIMMgr)
{
@@ -137,7 +137,7 @@ public:
//but unfortunately, our base that we are receiving here
//may not be the most up to date. It was accurate at
//some point in time though.
speaker_mgr->setSpeakers(content);
speaker_mgr->setSpeakers(mContent);
//we now have our base of users in the session
//that was accurate at some point, but maybe not now
@@ -167,10 +167,10 @@ public:
}
}
/*virtual*/ void error(U32 statusNum, const std::string& reason)
/*virtual*/ void httpFailure(void)
{
llwarns << "LLViewerChatterBoxInvitationAcceptResponder error [status:"
<< statusNum << "]: " << reason << llendl;
<< mStatus << "]: " << mReason << llendl;
//throw something back to the viewer here?
if ( gIMMgr )
{
@@ -181,7 +181,7 @@ public:
if ( floaterp )
{
if ( 404 == statusNum )
if ( 404 == mStatus )
{
std::string error_string;
error_string = "session_does_not_exist_error";