cancel
Showing results for 
Search instead for 
Did you mean: 

Getting URL in HTTP Handler class

Former Member
0 Kudos

Hi Everyone,

I have created new sub-element (test_html) in SICF node and assigned a http handler class.

I can test my handler class and also add a parameter to my URL and get the details in the

IF_HTTP_EXTENSION~HANDLE_REQUEST method of the class using:

server->request->get_form_fields( CHANGING fields = fields ).

This is all fine as normal.

My problem might sound bit strange but I need this.(please don't ask me why I need this)

My URL looks like: http://<server>:<port>/custom/test_html?screen=1

If you would have noticed when we change the URL to

http://<server>:<port>/custom/test_html/blablabla?screen=1 everything still works fine.

What I want is: how can I get what has been added before '?' not as parameter, In this case blablabla.

test_html is my defined sub-element so anything I add after it using '/' and not '?' as I can get the parameters any ways.

Any solutions? any method or FM to get the URL? I tried using FM HTTP_GET_URL2 and HTTP_GET_URL but anything after the sub-element name and before the parameter is getting ignored.

Any solutions would be highly appreciated.

Thanks & Regards,

Abhinav

Accepted Solutions (1)

Accepted Solutions (1)

GrahamRobbo
Active Contributor
0 Kudos

Hi Abhi,

this stuff is stored in the request header fields.

You can access them with the method call

server->request->get_header_fields

in the IF_HTTP_EXTENSION~HANDLE_REQUEST method.

Cheers

Graham Robbo

Answers (2)

Answers (2)

Former Member

server->request->get_header_field( name = if_http_header_fields_sap=>path_info ).

is the solution.

Regards,

Abhinav

RieSe
Contributor
0 Kudos

Hi,

at runtime and debugging mode: have a look at the SERVER object and its values.

The runtime passes this to HANDLE_REQUEST method.

SERVER has also other useful attributes like request and response.

Best regards, Stefan