on 03-13-2014 1:32 PM
Hi All,
In my WDJ component, I need to get the ServerName, Port and the protocol (http / https) from the WDJ application URL. I am able to get the server name and the port but unable to get the protocol. Any help would be highly appreciated.
Code I am using is :
String ServerName = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getServerName();
String port = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getServerPort();
Regards,
Srinivas Sistu
Hi,
Hey got the solution for this,
Get the URL of Application in WD java :
String URL=WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getApplication().getDeployableObjectPart());
wdComponentAPI.getMessageManager().reportSuccess("URL:"+URL);
This will return the FINAL server URL.
Checked with both http:// and https:// links of my server.
In my case https:// link is redirecting to FQDN URL(http://) of my server, so it worked.
Please mark it correct if it works for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Srinivas,
Did you get any solution. Pls share if any.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
The interface ServletRequest has the following methods:
getProtocol: Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.
getSchema: Returns the name of the scheme used to make this request, for example, http, https, or ftp. Different schemes have different rules for constructing URLs, as noted in RFC 1738.
IWDRequest request = WDProtocolAdapter.getProtocolAdapter().getRequestObject();
HttpServletRequest httpRequest = (HttpServletRequest) WDProtocolAdapter
.getProtocolAdapter().getRequestObject().getProtocolRequest();
String protocol = httpRequest.getScheme();
String url = protocol + "://" + request.getServerName() + ":" + request.getServerPort();
msgManager.reportSuccess(url);
Regards,
Jann Cortés
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.