cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to read cookies in 2004s (IWebContextAdapter)

Former Member
0 Kudos

Hi,

We are migrating our code from 2004 to 2004s. Here the type cast ((com.sap.tc.webdynpro.services.sal.adapter.core.IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest(); doesn't work anymore.

How do I read cookies ? Is there any other legal way of reading/writing cookies in WD for 2004s?

Thank you.

Ashish

Accepted Solutions (1)

Accepted Solutions (1)

blanca_serrano
Advisor
Advisor
0 Kudos

Hello Ashish,

Please, try the following alternative that uses internal classes to get the HttpServletRequest from below code .

(HttpServletRequest)TaskBinder.getCurrentTask().getProtocolAdapter().get

RequestObjectInternal().getProtocolRequest();

I hope this helps you.

Regards,

Blanca

Answers (2)

Answers (2)

Former Member
0 Kudos

I have to get the session and server name and that cannot be done using request parameters. Blanca's suggestion worked perfectly.

Thanks guys for the replies.

Ashish

Former Member
0 Kudos

This approach looks workable, thank you. But the 2004s IDE is not resolving the HttpServletRequest object. Even when I explicityly add the import, it says that it cannot resolve type. Do I have to explicitly add a jar file ? How I can resolve this issue ?

Former Member
0 Kudos

Hi,

As far as I know you cannot get the http request into your webdynpro project.

You can read the parameters through

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

What cookie you want to retrieve?

Best Wishes

Idhaya R