http://127.0.0.1:7101/Sage-ViewController-context-root/faces/Welcome.jspx
Each part of the URL is significant, though the one that stands out as being odd is the rather cumbersome "Sage-ViewController-context-root". This part of the URL in Java EE parlance is called the context-root, and not just because our example literally has context-root written into it.
The context-root at its most basic form is the unique part of the URL on the application server to clearly distinguish your application from another on the server. However as you can see in this example the "Sage-ViewController-context-root" is hardly something you'd want to present to users. Something more palatable like "Sage" or "HR" would be useful, delivering an end URL like:
http://127.0.0.1:7101/Sage/faces/Welcome.jspx
So how do we go about making a friendly context-root for our applications? Essentially there's 2 locations.
Design time
If you're running your application from JDeveloper by opening & running a jspx page via the right mouse menu or similar, when the application is deployed to the integrated WLS server, it will use Java EE Application options under the ViewController's Project Properties, accessible by right clicking the same name option of the ViewController project:

Deploy time
Once you've finished testing and running your application in your local integrated WLS instance, you're likely to generate an EAR or WAR file to deploy to an external WLS server. In this case the context-root is influenced by settings in the WAR file for the ViewController project. Simply right click the ViewController project -> select Project Properties -> Deployment and locate the associated WAR file deployment profile. In the following picture you can see it's called "Sage_ViewController_webapp1":


3 comments:
I have an issue related to ectx.getRequestContextPath()
I am developing an application in Jdeveloper 11.1.1.2.0.
While excecuting ectx.getRequestContextPath() the result I get it is
http://127.0.0.1:7101/ABCD/xyz/
But for me to navigate to the next page I only need
http://127.0.0.1:7101/ABCD/
ie i dont need the xyz part
My exact statement is like this
String url = ectx.getRequestContextPath() + "/faces/Login.jspx";
and the result I am getting is
http://127.0.0.1:7101/ABCD/xyz/faces/Login.jspx
instead I need
http://127.0.0.1:7101/ABCD/faces/Login.jspx
Thanks
Susan
How about just substringing the result to the location of the the 3rd or 4th slash?
CM.
you can even make the url more pretty by deploying the application to a virtual host and set the managed server port to 80 and the context root to only "/"
you url will looks like :
http://abc.server.com
Post a Comment