cancel
Showing results for 
Search instead for 
Did you mean: 

Get User Agent (Browser) in Webdynpro 7.01

Former Member
0 Kudos

Hello Community,

Some time ago, I already asked this question. Then, we were on NW04. That was the Thread: [Old Thread|;

The solution to retrieve the User-Agent was:


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

Now, "IWebContextAdapter" does not work anymore. So I'm in need of another solution. The suggestion of


HttpServletRequest request = (HttpServletRequest)WDProtocolAdapter.getProtocolAdapter().getRequestObject();
String value = request.getHeader("<Param Name>");

in the old thread still throws a "ClassCastException".

I have also found this Thread: [Other Thread|;

But here the suggestion is


HttpServletRequest request = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getProtocolRequest();	  
String userAgent = request.getHeader("User-Agent");

what doesn't work, because it seems, there is no method "getProtocolRequest()".

I'd be glad, if anyone would suggest a working way of how to retrieve the User Agent in webdynpro NW 7.0 EHP 1 SPS 04.

Thank you very much,

Best regards,

Christian

Accepted Solutions (0)

Answers (1)

Answers (1)

pravesh_verma
Active Contributor
0 Kudos

Hi Christian,

Can you try using this line of code. You can directly get the value of the request object using this.


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

// There is getParameterMap() method in which you can know what all parameters are available to be captured.
Map parameterMap =   WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameterMap();

I hope this helps.

Thanks and Regards,

Pravesh

christiansche
Active Participant
0 Kudos

Hi Pravesh,

Well, this way, I can gat parameters, that were submitted as POST or GET Parameters. What I need is the HTP Header Info about the USER-Agent, to switch between output for IE and Firefox. But thanks for this answer.

Best regards,

Christian