tags:

views:

212

answers:

2

Hi,

I have been trying to solve a problem, but I have not found any good solution yet. The problem is: I have a web app and this web app is deployed to the $TOMCAT_HOME/webapps/XXX directory. I can reach that on the http://localhost:8080/XXX address BUT, I would like to reach the web app on the http://localhost:8080/YYY address too. I added the following to the server.xml: `

<Service>
    <Engine>
        <Host>
            .......
            <Context path="/YYY" docBase="XXX"></Context>
        </Host>
    </Engine>
</Service>

`

It helped but the Tomcat started two web contexts and it caused some other problem. Is it possible to create a "multiple" address for one web app?

A: 

Try using the crossContext attribute:

<Context path="/YYY" docBase="XXX" crossContext="true"></Context>
Eric
To be clear, it only enables returning the other context when you want to access it using `ServletContext#getContext()`. I am however not sure how that fits into the as far posted information in the question.
BalusC
Yes, you're correct. I had looked into this a while back and remember that I ran into some confusion about it. Sorry about that. Should have looked into it a little more before posting the suggestion.
Eric
A: 

it caused some other problem.

Let me guess, the actual problem is that they both use their own HttpSession and don't share it? In that case you need to set the HTTP connector's emptySessionPath attribute to true. The only pitfall is that this affects all webapplications on the same server.

If that is not the actual problem, then you need to elaborate a bit more about it so that we can give more suitable answers.

BalusC
Sorry but maybe I was not understandable. So I have a JSF web app and this webapp is deployed to the $TOMCAT_HOME/webapps/XXX directory. I can reach this webapp on the http://localhost:4041/XXX and on the https://localhost:8443/XXX when I added <Context path="/YYY" docBase="XXX"></Context> to the server.xml everything was working fine (at the first sight :( the tomcat started two contexts. And that was the problem because I want only one context for the two address. I tried the UrlRewriteFilter but it was not good because it modified the URL and I would like to hide this "address forwarding
AlBundy