How to get Request-URI in RESPMOD?

Asked by johan on 2009-07-06

hi Alex and guys,

how I get uri request variable in ecap in respmod vectoring ?
for example when user request
in adapter , i need to know full of uri part.


Question information

English Edit question
eCAP Edit question
No assignee Edit question
Last query:
Last reply:
Alex Rousskov (rousskov) said : #1

libecap::host::Xaction::cause() method gives access to the request message in RESPMOD.

Once you have the request message, you can access its Request-URI and Host header values via firstLine() and header() methods.

johan (johanfirdi) said : #2

I get error when compile following code,
here the error
error: ‘const class libecap::Message’ has no member named ‘FirstLine’
here the code
void Adapter::Xaction::noteVbContentAvailable()
const libecap::Area vb = hostx->vbContent(0, libecap::nsize); // get all vb
const libecap::Area hosturi = hostx->cause().FirstLine().uri();

        Must(receivingVb == opOn);
        if (sendingAb == opOn)
using namespace std;
         ofstream myfile; ("/tmp/vb.txt",ios::out|ios::binary|ios::app);
// myfile << hosturi.toString();
        myfile << vb.toString();


there's something wrong ?
any idea ?


Alex Rousskov (rousskov) said : #3

The Message method is called firstLine and not FirstLine.

johan (johanfirdi) said : #4

Thanks Alex for correction.
Next, what member i should use ?
I tried hostx->cause().firstLine().header().value(uriname), get error.
error: ‘const class libecap::FirstLine’ has no member named ‘header’

if i tried hostx->cause().firstLine().uri() get error too
error: ‘const class libecap::FirstLine’ has no member named 'uri’

If i look at in libecap source, in header.h
class FirstLine {
                virtual ~FirstLine() {}

                virtual Version version() const = 0;
                virtual void version(const Version &aVersion) = 0;
                virtual Name protocol() const = 0;
                virtual void protocol(const Name &aProtocol) = 0;

class RequestLine: public FirstLine {
                virtual ~RequestLine() {}

                virtual void uri(const Area &aUri) = 0;
                virtual Area uri() const = 0;

                virtual void method(const Name &aMethod) = 0;
                virtual Name method() const = 0;

On Tue, Jul 7, 2009 at 12:07 PM, Alex
Rousskov<email address hidden> wrote:
> Your question #76192 on eCAP changed:
> Status: Open => Answered
> Alex Rousskov proposed the following answer:
> The Message method is called firstLine and not FirstLine.
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> You received this question notification because you are a direct
> subscriber of the question.

Alex Rousskov (rousskov) said : #5

To get to the RequestLine::uri() method, you need to dynamic_cast the generic FirstLine pointer or reference to specific RequestLine pointer or reference. FirstLine class does not have a uri() method because only requests have URIs. Similarly, only ResponseLine can deal with response status codes.

Alex Rousskov (rousskov) said : #6

Alex Rousskov suggests this article as an answer to your question:
FAQ #1576: “How to get requested URL?”.

Can you help with this problem?

Provide an answer of your own, or ask johan for more information if necessary.

To post a message you must log in.