Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/125.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ POCO C++;图书馆。获取完整url_C++_Poco Libraries - Fatal编程技术网

C++ POCO C++;图书馆。获取完整url

C++ POCO C++;图书馆。获取完整url,c++,poco-libraries,C++,Poco Libraries,当我试图从响应中getUri时,我只得到uri路径。是否有任何方法可以从HTTPResponse获取uri片段 class TestMyRequestHandler : public HTTPRequestHandler { public: void handleRequest(HTTPServerRequest &req, HTTPServerResponse &resp) { resp.setStatus(HTTPResponse::HTTP_OK);

当我试图从响应中
getUri
时,我只得到uri路径。是否有任何方法可以从
HTTPResponse
获取uri片段

class TestMyRequestHandler : public HTTPRequestHandler
{
public:
    void handleRequest(HTTPServerRequest &req, HTTPServerResponse &resp)
    {
    resp.setStatus(HTTPResponse::HTTP_OK);
    resp.setContentType("text/html");
    ostream& out = resp.send();

    URI uri(req.getURI());
    clog << uri.toString() << endl;
    }
};

class TestRequestHandlerFactory : public HTTPRequestHandlerFactory
{
public:
    virtual HTTPRequestHandler* createRequestHandler(const HTTPServerRequest &)
    {
        return new TestMyRequestHandler;
    }
};

int main()
{
    HTTPServer test(new TestRequestHandlerFactory, ServerSocket(8080), new HTTPServerParams);
    test.start();
    for(;;)
    {
    }
    test.stop();
}
类TestMyRequestHandler:公共HTTPRequestHandler
{
公众:
无效HandlerRequest(HTTPServerRequest&req、HTTPServerResponse&resp)
{
响应setStatus(HTTPResponse::HTTP_OK);
分别为setContentType(“文本/html”);
ostream&out=resp.send();
URI(req.getURI());

木屐帮了忙:@JerryJeremiah谢谢,这帮了忙