Fetching server name and port number for ADF application

Requirement – How to get server name and server port.
Solutions- You can get this information in by writing below code in java

FacesContext fctx = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest) fctx.getExternalContext ().GetRequest ();
String serverName = request.getServerName();
int serverPort =request.getServerPort();

System.out.println ("Server Name:" + serverName);
System.out.println ("Server Port no:" + server port);

Happy coding with Vinay Kumar in Techartifact.

Vinay

I am an Oracle ACE in Oracle ADF/Webcenter. Sr Java Consultant-working on Java/J2EE/Oracle ADF/Webcenter Portal/ content and Hibernate for several years. I'm an active member of the OTN JDeveloper/Webcenter forum. Passionate about learning new technologies. I am here to share my knowledge. Give your views and suggestion on [email protected] .

More Posts - Website

Follow Me:
TwitterLinkedInGoogle PlusYouTube