Exemplo n.º 1
0
	virtual void get(
		LLHTTPNode::ResponsePtr response,
		const LLSD& context) const
	{
		std::string name = context["request"]["wildcard"]["option-name"];
		response->result(LLApp::instance()->getOption(name));
	}
Exemplo n.º 2
0
	virtual void get(
		LLHTTPNode::ResponsePtr response,
		const LLSD& context) const
	{
		response->result(LLApp::instance()->getOptionData(
			(LLApp::OptionPriority)PRIORITY));
	}
Exemplo n.º 3
0
		std::string makeRequest(
			const std::string& name,
			const std::string& httpRequest,
			bool timeout = false)
		{
			LLPipeStringInjector* injector = new LLPipeStringInjector(httpRequest);
			LLPipeStringExtractor* extractor = new LLPipeStringExtractor();
			
			apr_pool_t* pool;
			apr_pool_create(&pool, NULL);

			LLPumpIO* pump;
			pump = new LLPumpIO(pool);

			LLPumpIO::chain_t chain;
			LLSD context;

			chain.push_back(LLIOPipe::ptr_t(injector));
			LLIOHTTPServer::createPipe(chain, mRoot, LLSD());
			chain.push_back(LLIOPipe::ptr_t(extractor));

			pump->addChain(chain, DEFAULT_CHAIN_EXPIRY_SECS);

			pumpPipe(pump, 10);
			if(mResponse.notNull() && (! timeout)) 
			{
				mResponse->result(mResult);
				mResponse = NULL;
			}
			pumpPipe(pump, 10);
			
			std::string httpResult = extractor->string();

			chain.clear();
			delete pump;
			apr_pool_destroy(pool);

			if(mResponse.notNull() && timeout)
			{
				mResponse->result(mResult);
				mResponse = NULL;
			}
			
			return httpResult;
		}
Exemplo n.º 4
0
	virtual void get(
		LLHTTPNode::ResponsePtr response,
		const LLSD& context) const
	{
		std::string name = context["request"]["wildcard"]["option-name"];
		LLSD options = LLApp::instance()->getOptionData(
			LLApp::PRIORITY_RUNTIME_OVERRIDE);
		response->result(options[name]);
	}
Exemplo n.º 5
0
// virtual
void LLHTTPNode::post(LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const
{
	try
	{
		response->result(simplePost(input));
	}
	catch (NotImplemented)
	{
		response->methodNotAllowed();
	}
}
Exemplo n.º 6
0
// virtual
void LLHTTPNode::get(LLHTTPNode::ResponsePtr response, const LLSD& context) const
{
	try
	{
		response->result(simpleGet());
	}
	catch (NotImplemented)
	{
		response->methodNotAllowed();
	}
}
Exemplo n.º 7
0
	virtual void post(
		LLHTTPNode::ResponsePtr response,
		const LLSD& context,
		const LLSD& input) const
	{
		LLSD result = LLApp::instance()->getOptionData(
			LLApp::PRIORITY_RUNTIME_OVERRIDE);
		LLSD::map_const_iterator iter = input.beginMap();
		LLSD::map_const_iterator end = input.endMap();
		for(; iter != end; ++iter)
		{
			result[(*iter).first] = (*iter).second;
		}
		LLApp::instance()->setOptionData(
			LLApp::PRIORITY_RUNTIME_OVERRIDE,
			result);
		response->result(result);
	}
Exemplo n.º 8
0
	virtual void get(
		LLHTTPNode::ResponsePtr response,
		const LLSD& context) const
	{
		LLSD result;
		LLApp* app = LLApp::instance();
		LLSD::map_const_iterator iter;
		LLSD::map_const_iterator end;
		for(int ii = LLApp::PRIORITY_COUNT - 1; ii >= 0; --ii)
		{
			LLSD options = app->getOptionData((LLApp::OptionPriority)ii);
			iter = options.beginMap();
			end = options.endMap();
			for(; iter != end; ++iter)
			{
				result[(*iter).first] = (*iter).second;
			}
		}
		response->result(result);
	}