This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JBoss and the fly likes How to set context root of an application in JBoss? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » JBoss
Reply Bookmark "How to set context root of an application in JBoss? " Watch "How to set context root of an application in JBoss? " New topic
Author

How to set context root of an application in JBoss?

Rob Jon
Greenhorn

Joined: May 22, 2008
Posts: 12
hi guys! i need help in addressing issues in a website, which use STRUTS/servlets etc.

My problem is I get duplicate domain while getting into the website e.g www.abc.com/abc.com/view/login.do.

i want to get rid of 2nd abc.com which i believe is root war location.

i have a web.xml and using filter to strip abc.com but its not working.

any body has any idea or went thru same experience.

thanks in advance.

[Edited by Jaikiran : Changed the subject, to be more meaningful]
[ May 23, 2008: Message edited by: Jaikiran Pai ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56218
    
  13

Do you really feel that "Struts Technology" is a good subject for your question?

If you are trying to remove the context path from the URL displayed from the browser, you are going to be disappointed. There is no way to do this in a filter or otherwise.

If you don't want your web app to have a visible context path, you must make the web app the ROOT web app (which has a context path of /).


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Rob Jon
Greenhorn

Joined: May 22, 2008
Posts: 12
Thanks for your response and apologize for odd subject.

Can you please explain how can i make context path to root(\)?

thanks in advance.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

What container are you using?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Rob Jon
Greenhorn

Joined: May 22, 2008
Posts: 12
we are using JBOSS
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Since this configuration is container specific, I'm going to move this thread to our JBoss forum for you.

-ben
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5541

To change the context for a web app on JBossAS, add a WEB-INF/jboss-web.xml file to your WAR file:

<jboss-web>
<context-root>/</context-root>
</jboss-web>

You will also want to remove the root application - server/default/deploy/jboss-web.deploy/ROOT.war (in 4.2.x).


JBoss In Action
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56218
    
  13

Originally posted by Rob Jon:
Thanks for your response and apologize for odd subject.

No need to apologize. But I'd change it to something more appropriate were I you.
Rob Jon
Greenhorn

Joined: May 22, 2008
Posts: 12
Thanxs Peter and bear. It was wonderful experience as a first time user.
Rob Jon
Greenhorn

Joined: May 22, 2008
Posts: 12
I have another problem. The server where we hosted our website has multiple war files or other sites uploaded.

according to our previous discussion if we update jboss-web.xml file with context-root; will it affect other sites?

please let me know. thnax in advance.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5541

Changing jboss-web.xml affects only the web application (war file) in which is appears.
Rob Jon
Greenhorn

Joined: May 22, 2008
Posts: 12
Thanks Peter. Your information is valuable.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to set context root of an application in JBoss?
 
Similar Threads
Struts issue on tomcat
How to hide image path in JSP
Redirecting The Request
how to forward from the root
Regex pattern