Hi,

another option could be to define two contexts in Tomcat for your application.

You could do that in server.xml within the Host element (But this is not 
recommended):

        <Context docBase="MyApplication" path="MyApplication" />
        <Context docBase="MyApplication" path="department" />

The preferred way should be to put two context files in 
$CATALINA_BASE/conf/[enginename]/[hostname]/ (e. g. 
$CATALINA_BASE/conf/Catalina/localhost/)

        MyApplication.xml
        department.xml

The content has to be:

        <Context docBase="<path-to-app>/MyApplication" />

Please note that yout MUST NOT put MyApplication.war in $CATALINA_BASE/webapps 
!!!

For further information about contexts in Tomcat look here: 
http://tomcat.apache.org/tomcat-8.0-doc/config/context.html

Regards,
Thomas


-----Ursprüngliche Nachricht-----
Von: Thomas Rohde 
Gesendet: Freitag, 9. Oktober 2015 09:22
An: [email protected]
Betreff: AW: 2 different context paths using one single war file

Hi,

as Martin suggested, a proxy is the best solution for this.

If you don't want to setup a proxy perhaps this could fit your needs:

Deploy your application as ROOT.war in Tomcat. Then you could use the following 
URLs:

http://hostname/page1
http://hostname/page2

Regards,
Thomas


-----Ursprüngliche Nachricht-----
Von: Martin Grigorov [mailto:[email protected]]
Gesendet: Freitag, 9. Oktober 2015 09:10
An: [email protected]
Betreff: Re: 2 different context paths using one single war file

Hi,

The easiest way it to introduce a proxy in front of Tomcat, e.g. Nginx or 
Apache HTTPD.
See https://www.nginx.com/resources/admin-guide/reverse-proxy/ and/or 
https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Oct 9, 2015 at 5:03 AM, trlt <[email protected]> wrote:

> I have developed a Wicket application (MyApplication.war), to be 
> deployed on Apache + Tomcat.
> It can be invoked using: http://hostname//MyApplication
>
> The application has 2 bookmarkable pages:
> http://hostname/MyApplication/page1
> http://hostname/MyApplication/page2
>
> I'd like to make page2 also available using a different hostname:
> http://hostname2/department/page2
>
> Using one single war file, how can I use the same source code in 
> Wicket to serve the following 2 different URLs:
>
> http://hostname/MyApplication/page2
> http://hostname2/department/page2
>
> Hoping someone in the user group can offer some help or suggestions.
> Thanks!
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/2-different-context-paths-u
> sing-one-single-war-file-tp4672189.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to