on 07-23-2008 3:52 PM
Hi @ all,
I have to do some upgrade work for my WD application from 6.4 to version 7.0
I have some codings that don`t work anymore, where the Request URL was read out like this way:
HttpServletRequest request = (HttpServletRequest)WDProtocolAdapter.getProtocolAdapter().getRequestObject();
String url = (String) request.getRequestURL().toString();
With this i got values like this: http://sappep.server-customer.de:60000/irj/portal/anonymous/activation?guest_user=ep_selfreg_anon
In NW 7 this coding doesn`t work at all. There must be a new method of access I cannot find.
Please note: I need the entire url and not only the parameters of the url. How to get the url parameters I already got in an other document but how to get the entire url?
Thx in advance
Mathias
Hello,
if you want to determine the url and port on which the application is running, you can use:
wdThis.wdGetAPI().getComponent().getApplication().getURLService().getGeneralService().getAbsoluteWebResourceURL(wdThis.wdGetAPI().getComponent().getDeployableObjectPart().getName()));
String[] url = wdContext.currentContextElement().getUrl().split("/");
Inside the url[] the ip is on position 2.
kind regards
Fabian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi friends.
I have tried the 2 previous responses, but both return the same value, and it is equals to:
../../sap.com/cafeugpuidt/AppWorkset
Then, I can't get the server name and the port number of the server.
Thank you for your response.
Manuel Loayza
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use this to get URL of deployed application
String appURL = null;
try {
WDDeployableObjectPart currentAppPart =wdThis
.wdGetAPI()
.getComponent()
.getApplication()
.getDeployableObjectPart();
appURL = WDURLGenerator.getApplicationURL(currentAppPart);
} catch (final WDURLException ex) {
wdComponentAPI.getMessageManager().reportException(
new WDNonFatalException(ex),
false);
}
Mandeep Virk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you know the name of the querystring parameter, then you can read it within your WD application like the following:
//let's say the URL is of the form http://<servername>:<port>/webdynpro/dispatcher/<package>/<component>/<Application name>?param1="abc"¶m2="123"
String qParam1 = WDProtocolAdapter.getProtocolAdapter().getRequestParameter("param1");
String qParam2 = WDProtocolAdapter.getProtocolAdapter().getRequestParameter("param2");
For your requirement about server information, you can use
String serverName = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getServerName();
String serverPort = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getServerPort();
In case you don't see the above mentioned methods (I use CE), then you can also use the not-so-sophisticated way of reading the server information:
String appURL = WDURLGenerator.getWorkloadBalancedApplicationURL(wdComponentAPI.getApplication().getDeployableObjectPart());
/**
*appURL will be of the form http://<servername>:<port>/webdynpro/dispatcher/<package>/<component>/<Application name>
*now you can do a standard string split to fetch the information
*/
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.