aspose file tools*
The moose likes JBoss/WildFly and the fly likes How to set context root of an application in JBoss? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
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: 61202
    
  66

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 /).


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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: 5827
    
    7

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: 61202
    
  66

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: 5827
    
    7

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://aspose.com/file-tools
 
subject: How to set context root of an application in JBoss?