cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get my application Context Path?

Former Member
0 Kudos

How can I get my application Context Path via webdynpro code?

Let say I'm accesing my application with URL

https://myapp:8443/webdynpro/dispatcher/local/MyApp/App, how can I get

the value 'https://myapp:8443' from webdynpro code? In J2EE, this is

equivalent of HttpServletRequest.getContextPath() method. Do we have

this method call in webdynpro object?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi John,

Yes you can achieve that in Web Dynpro.

Try the following -

// USE THIS FOR GETTING THE SERVER NAME AND IMPORT WEBLOGIC.JAR FILE IN THE JAVA BUILD PATH PROPERTIES

HttpServletRequest request = (( com.sap.tc.webdynpro.services.sal.adapter.core.IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();

//GETS THE HOST NAME OF THE SERVER

String strHostName = request.getServerName();

Thanks,

Sam

Former Member
0 Kudos

There's no getHttpServletRequest() method from WDWebContextAdapter object. Is there any other way to get HttpServletRequest object from webdynpro object?