Virtual Host Question

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Virtual Host Question

John Tsimikas
I'm trying to set up a virtual host in jetty.xml to
link to a my deployed web application.

I can't get this to work, I keep getting message
No context on this server matched or handled this
request.
Contexts known to this server are:

WebApplicationContext[/MyWebApp,MyWebApp]
etc.


jetty.xml

<Call name="addWebApplication">
<Arg>/MyWebApp</Arg>
<Arg>./webapps/MyWebApp.war</Arg>
<Set name="extractWAR">true</Set>
<Set
name="defaultsDescriptor">org/mortbay/jetty/servlet/webdefault.xml</Set>
<Set name="classLoaderJava2Compliant">true</Set>
<Set name="virtualHosts">
<Array type="java.lang.String">
<Item></Item>
<Item>127.0.0.1</Item>
<Item>localhost</Item>
<Item>www.MyWebSite.com</Item>
</Array>
</Set>
</Call>



web.xml

<web-app>
<display-name>MyWebApp</display-name>
etc.

The URL
http://www.MyWebSite.com/MyWebApp

works fine and my web application comes up fine.

however I want to be able to reference it as such

http://www.MyWebSite.com

Any ideas?


John




-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Virtual Host Question

Greg Wilkins-5
John,

You need to use a context path of / instead of /MyWebApp.

cheers


John Tsimikas wrote:

> I'm trying to set up a virtual host in jetty.xml to
> link to a my deployed web application.
>
> I can't get this to work, I keep getting message
> No context on this server matched or handled this
> request.
> Contexts known to this server are:
>
> WebApplicationContext[/MyWebApp,MyWebApp]
> etc.
>
>
> jetty.xml
>
> <Call name="addWebApplication">
> <Arg>/MyWebApp</Arg>
> <Arg>./webapps/MyWebApp.war</Arg>
> <Set name="extractWAR">true</Set>
> <Set
> name="defaultsDescriptor">org/mortbay/jetty/servlet/webdefault.xml</Set>
> <Set name="classLoaderJava2Compliant">true</Set>
> <Set name="virtualHosts">
> <Array type="java.lang.String">
> <Item></Item>
> <Item>127.0.0.1</Item>
> <Item>localhost</Item>
> <Item>www.MyWebSite.com</Item>
> </Array>
> </Set>
> </Call>
>
>
>
> web.xml
>
> <web-app>
> <display-name>MyWebApp</display-name>
> etc.
>
> The URL
> http://www.MyWebSite.com/MyWebApp
>
> works fine and my web application comes up fine.
>
> however I want to be able to reference it as such
>
> http://www.MyWebSite.com
>
> Any ideas?
>
>
> John
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
> a projector? How fast can you ride your desk chair down the office luge track?
> If you want to score the big prize, get to know the little guy.  
> Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Virtual Host Question

John Tsimikas
I tried that already .. If I set the context to /, I
can reference the web pages.. but all the image
references are now broken links.  

When I reference the images, I use something like:
<IMG SRC="\MyWebApp\images\image.jpg">  

This works fine if I reference the app as
http://mydomain.com/MyWebApp

but if I try
http://mydomain.com 
(using / context) all the image links are broken.



But even if I can get this work with the images I'm
not sure I'm really solving my problem.

I have many domains - and each one needs to point to a
different web app, all of which will be located under
the webapps directory (MyWebApp-A.war, MyWebApp-B.war)

so domain-A.com --> MyWebApp-A
   domain-B.com --> MyWebApp-B

I want to be able to link the domain with the webapp,
but if I am using a / context then how is that
possible?  Isn't the context defined in the web app?
In my case, MyWebApp?  So shouldn't I use this?

Not sure why I need to specify the root context?


Thanks


--- Greg Wilkins <[hidden email]> wrote:

> John,
>
> You need to use a context path of / instead of
> /MyWebApp.
>
> cheers
>
>
> John Tsimikas wrote:
> > I'm trying to set up a virtual host in jetty.xml
> to
> > link to a my deployed web application.
> >
> > I can't get this to work, I keep getting message
> > No context on this server matched or handled this
> > request.
> > Contexts known to this server are:
> >
> > WebApplicationContext[/MyWebApp,MyWebApp]
> > etc.
> >
> >
> > jetty.xml
> >
> > <Call name="addWebApplication">
> > <Arg>/MyWebApp</Arg>
> > <Arg>./webapps/MyWebApp.war</Arg>
> > <Set name="extractWAR">true</Set>
> > <Set
> >
>
name="defaultsDescriptor">org/mortbay/jetty/servlet/webdefault.xml</Set>

> > <Set name="classLoaderJava2Compliant">true</Set>
> > <Set name="virtualHosts">
> > <Array type="java.lang.String">
> > <Item></Item>
> > <Item>127.0.0.1</Item>
> > <Item>localhost</Item>
> > <Item>www.MyWebSite.com</Item>
> > </Array>
> > </Set>
> > </Call>
> >
> >
> >
> > web.xml
> >
> > <web-app>
> > <display-name>MyWebApp</display-name>
> > etc.
> >
> > The URL
> > http://www.MyWebSite.com/MyWebApp
> >
> > works fine and my web application comes up fine.
> >
> > however I want to be able to reference it as such
> >
> > http://www.MyWebSite.com
> >
> > Any ideas?
> >
> >
> > John
> >
> >
> >
> >
> >
>
-------------------------------------------------------

> > This SF.Net email is sponsored by: NEC IT Guy
> Games.  How far can you shotput
> > a projector? How fast can you ride your desk chair
> down the office luge track?
> > If you want to score the big prize, get to know
> the little guy.  
> > Play to win an NEC 61" plasma display:
> http://www.necitguy.com/?r=20
> > _______________________________________________
> > Jetty-support mailing list
> > [hidden email]
> >
>
https://lists.sourceforge.net/lists/listinfo/jetty-support
> >
>
>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Virtual Host Question

Greg Wilkins-5
John,

It sounds like your problem is that your image links are using
absolute URLS with a context name in them.  You need to either generate
the links with the context name, use relative links or manually adjust
for the / domain.

You can easily have the
   domain-A.com --> MyWebApp-A
   domain-B.com --> MyWebApp-B

mapping and it would be simple to write a little bit of
code - like addWebApplications that added all your webapps as
/ contexts and set the virtual host for them all using the war file/dir
name.


cheers


John Tsimikas wrote:

> I tried that already .. If I set the context to /, I
> can reference the web pages.. but all the image
> references are now broken links.  
>
> When I reference the images, I use something like:
> <IMG SRC="\MyWebApp\images\image.jpg">  
>
> This works fine if I reference the app as
> http://mydomain.com/MyWebApp
>
> but if I try
> http://mydomain.com 
> (using / context) all the image links are broken.
>
>
>
> But even if I can get this work with the images I'm
> not sure I'm really solving my problem.
>
> I have many domains - and each one needs to point to a
> different web app, all of which will be located under
> the webapps directory (MyWebApp-A.war, MyWebApp-B.war)
>
> so domain-A.com --> MyWebApp-A
>    domain-B.com --> MyWebApp-B
>
> I want to be able to link the domain with the webapp,
> but if I am using a / context then how is that
> possible?  Isn't the context defined in the web app?
> In my case, MyWebApp?  So shouldn't I use this?
>
> Not sure why I need to specify the root context?
>
>
> Thanks
>
>
> --- Greg Wilkins <[hidden email]> wrote:
>
>
>>John,
>>
>>You need to use a context path of / instead of
>>/MyWebApp.
>>
>>cheers
>>
>>
>>John Tsimikas wrote:
>>
>>>I'm trying to set up a virtual host in jetty.xml
>>
>>to
>>
>>>link to a my deployed web application.
>>>
>>>I can't get this to work, I keep getting message
>>>No context on this server matched or handled this
>>>request.
>>>Contexts known to this server are:
>>>
>>>WebApplicationContext[/MyWebApp,MyWebApp]
>>>etc.
>>>
>>>
>>>jetty.xml
>>>
>>><Call name="addWebApplication">
>>><Arg>/MyWebApp</Arg>
>>><Arg>./webapps/MyWebApp.war</Arg>
>>><Set name="extractWAR">true</Set>
>>><Set
>>>
>>
> name="defaultsDescriptor">org/mortbay/jetty/servlet/webdefault.xml</Set>
>
>>><Set name="classLoaderJava2Compliant">true</Set>
>>><Set name="virtualHosts">
>>><Array type="java.lang.String">
>>><Item></Item>
>>><Item>127.0.0.1</Item>
>>><Item>localhost</Item>
>>><Item>www.MyWebSite.com</Item>
>>></Array>
>>></Set>
>>></Call>
>>>
>>>
>>>
>>>web.xml
>>>
>>><web-app>
>>><display-name>MyWebApp</display-name>
>>>etc.
>>>
>>>The URL
>>>http://www.MyWebSite.com/MyWebApp
>>>
>>>works fine and my web application comes up fine.
>>>
>>>however I want to be able to reference it as such
>>>
>>>http://www.MyWebSite.com
>>>
>>>Any ideas?
>>>
>>>
>>>John
>>>
>>>
>>>
>>>
>>>
>>
> -------------------------------------------------------
>
>>>This SF.Net email is sponsored by: NEC IT Guy
>>
>>Games.  How far can you shotput
>>
>>>a projector? How fast can you ride your desk chair
>>
>>down the office luge track?
>>
>>>If you want to score the big prize, get to know
>>
>>the little guy.  
>>
>>>Play to win an NEC 61" plasma display:
>>
>>http://www.necitguy.com/?r=20
>>
>>>_______________________________________________
>>>Jetty-support mailing list
>>>[hidden email]
>>>
>>
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>
>>
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support