Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Masking url

 
Maksim Ustinov
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an enterprise application written in JAVA with JSF (using RichFaces 3.3). I'm using Glassfish server.
Currently my URL looks like this:

http://localhost/WebApplication/faces/folder1/page.jsp

Question is how do I mask my url to make it like this:

http://localhost/folder1/page.jps

Basically i want to hide "WebApplication/faces/"

Thanks
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This actually isn´t to be called "masking url".

You need to put the webapplication in the tomcat root directory or to change the context name to root.
Also you need to change the FacesServlet mapping from /faces/* to *.jps.

If that *.jps is actually a typo: at least you need to change it to an extension-mapping, like *.jsf.
No, you can´t use *.jsp.
 
Maksim Ustinov
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah.. the "/faces/" part was easy... and .jps was a typo, i meant jsp. and I've renamed jsp to jsf. Works perfectly.

Now, because I have Enterprise project with EJBs and I'm using Glassfish I think I can't move war file to the root directory of my domain1. or i'm wrong?

right now my url looks like this:
http://localhost/WebApp/index.jsf

And I want to get rid of "WebApp" part in my url.

Thanks for your help!
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can change the context root in the application.xml of the EAR.
 
Maksim Ustinov
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For some reason I can't find application.xml in my project. I think I need to make it manually.
Are you sure that I need to add that to application.xml? I thought it should be somewhere on the application server level.

I'm using NetBeans to make my application, so is it possible application.xml file is missing because NetBeans did not add it?
 
Maksim Ustinov
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have figure out how to put application.xml to my enterprise app.

In NetBeans I just need to right-click on the EAR icon in the project view (triangle icon in NB), select New…, and choose “Standard Deployment Descriptor…”.

This will cause NetBeans to create and populate the application.xml file, including referencing the EAR’s source war files and putting in your already-defined context roots.

But when I put <context-root> </context-root> it did not work to specify root. How can I do it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic