cancel
Showing results for 
Search instead for 
Did you mean: 

Any way to get HTTP header in web dynpro Java?

Former Member
0 Kudos
148

Is there any way to get HTTP header in web dynpro java? This method gives me the params. Is params same as header? It doesn't have any way to retrieve header data. I am on NW 7.0.19

WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("param");

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear Faraz,

I'm afraid the code you've pasted is only to retrieve URL parameters.

Have you tried this document to see if it offers any good hint:

[http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0446f5c-fcb9-2910-e082-88becbe3ddc9]

Not sure if you can process the HTTP header with a WD4J.

An alternative could be to develop some Portal component in plain JAVA working as a proxy to call your WD4J afterwards.

That portal component would process your HTTP header and forward any parameter to your WD4J.

But this is me just guessing.

Kind Regards

/Ricardo

Former Member
0 Kudos

Document doesn't provide any help. Seems like it is not supported in this version. In CE the HTTPServletRequest object can be retrieved but not in earlier versions.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

try this:

HttpServletRequest request = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();

Denis.

Former Member
0 Kudos

@Denis

Great answer Denis!

I didn't knew about that alternative.

Learning all the time.

;o)

/Ricardo

Former Member
0 Kudos

I don't find IWebContextAdapter in any jar file. Its not in tc/wd/webdynpro' in webdynproservices.jar

Former Member
0 Kudos

Instead i found that this works like a charm.

HttpServletRequest req = (HttpServletRequest)TaskBinder.getCurrentTask().getProtocolAdapter().getRequestObjectInternal().getProtocolRequest();