Virtual Directory

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

Virtual Directory

al_masson
Hi,

I am new to Jetty 6, migrating an application from Tomcat.

I now find myself trying to find a way to map an external directory to
serve static content from a Java WebApp. Something that sounds like a
"virtual directory".

Is there any way to do that?

My configuration looks like:

        <Item>
            <New id="voffice" class="org.mortbay.jetty.webapp.WebAppContext">
                <Set name="contextPath">/</Set>
                <Set name="war">./webapps/voffice.war</Set>
                <Set name="VirtualHosts">
                    <Array type="java.lang.String">
                        <Item>(...).com</Item>
                    </Array>
                </Set>
            </New>
        </Item>

What I need is, when somebody access something like /voffice/images/*,
that Jetty should grab the images from a static location (in my FS)
like /usr/local/apps/voffice/images/*.

Is it possible?

TIA

Alexandre Jacques

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Virtual Directory

Nik Gonzalez
Hi Alexandre,

You may define a new Context that points to your images directory like this:

    <New id="images" class="org.mortbay.jetty.servlet.Context">
      <Arg><Ref id="Contexts"/></Arg>
      <Arg>/images</Arg>
      <Set name="ResourceBase"><SystemProperty name="jetty.home"
default="."/>/images</Set>
      <Call name="addServlet">
        <Arg>org.mortbay.jetty.servlet.DefaultServlet</Arg>
        <Arg>/*</Arg>
      </Call>
    </New>

Then you can get your images with this
http://localhost:8080/images/some.gif.

HTH,
Nik

Alexandre Jacques wrote:

> Hi,
>
> I am new to Jetty 6, migrating an application from Tomcat.
>
> I now find myself trying to find a way to map an external directory to
> serve static content from a Java WebApp. Something that sounds like a
> "virtual directory".
>
> Is there any way to do that?
>
> My configuration looks like:
>
>         <Item>
>             <New id="voffice" class="org.mortbay.jetty.webapp.WebAppContext">
>                 <Set name="contextPath">/</Set>
>                 <Set name="war">./webapps/voffice.war</Set>
>                 <Set name="VirtualHosts">
>                     <Array type="java.lang.String">
>                         <Item>(...).com</Item>
>                     </Array>
>                 </Set>
>             </New>
>         </Item>
>
> What I need is, when somebody access something like /voffice/images/*,
> that Jetty should grab the images from a static location (in my FS)
> like /usr/local/apps/voffice/images/*.
>
> Is it possible?
>
> TIA
>
> Alexandre Jacques
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>
>  


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Virtual Directory

al_masson
Hi Nik,

This is almost what I need. The problem is that I need these images to
be called as if they were under the context of my WebApp.

Something like: http://localhost:8080/voffice/images/some.gif

And not like: http://localhost:8080/images/some.gif

The behaviour I am expecting is just like an virtual directory.

TIA

Alexandre Jacques

On 2/1/07, Nik Gonzalez <[hidden email]> wrote:

> Hi Alexandre,
>
> You may define a new Context that points to your images directory like this:
>
>     <New id="images" class="org.mortbay.jetty.servlet.Context">
>       <Arg><Ref id="Contexts"/></Arg>
>       <Arg>/images</Arg>
>       <Set name="ResourceBase"><SystemProperty name="jetty.home"
> default="."/>/images</Set>
>       <Call name="addServlet">
>         <Arg>org.mortbay.jetty.servlet.DefaultServlet</Arg>
>         <Arg>/*</Arg>
>       </Call>
>     </New>
>
> Then you can get your images with this
> http://localhost:8080/images/some.gif.
>
> HTH,
> Nik
>
> Alexandre Jacques wrote:
> > Hi,
> >
> > I am new to Jetty 6, migrating an application from Tomcat.
> >
> > I now find myself trying to find a way to map an external directory to
> > serve static content from a Java WebApp. Something that sounds like a
> > "virtual directory".
> >
> > Is there any way to do that?
> >
> > My configuration looks like:
> >
> >         <Item>
> >             <New id="voffice" class="org.mortbay.jetty.webapp.WebAppContext">
> >                 <Set name="contextPath">/</Set>
> >                 <Set name="war">./webapps/voffice.war</Set>
> >                 <Set name="VirtualHosts">
> >                     <Array type="java.lang.String">
> >                         <Item>(...).com</Item>
> >                     </Array>
> >                 </Set>
> >             </New>
> >         </Item>
> >
> > What I need is, when somebody access something like /voffice/images/*,
> > that Jetty should grab the images from a static location (in my FS)
> > like /usr/local/apps/voffice/images/*.
> >
> > Is it possible?
> >
> > TIA
> >
> > Alexandre Jacques
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job easier.
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Jetty-support mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/jetty-support
> >
> >
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Virtual Directory

al_masson
Hi,

I was looking for an answer for my question and I found this article
from Howard Lewis Ship:

http://www.theserverside.com/tt/blogs/showblog.tss?id=JettyHack

This is exactly what I want. But, since this article is from 2004, I
was wondering if there is something already embbeded in Jetty to
achieve the same result.

I couldn't find anything in the docs.

Thanks again,

Alexandre Jacques



On 2/3/07, Alexandre Jacques <[hidden email]> wrote:

> Hi Nik,
>
> This is almost what I need. The problem is that I need these images to
> be called as if they were under the context of my WebApp.
>
> Something like: http://localhost:8080/voffice/images/some.gif
>
> And not like: http://localhost:8080/images/some.gif
>
> The behaviour I am expecting is just like an virtual directory.
>
> TIA
>
> Alexandre Jacques
>
> On 2/1/07, Nik Gonzalez <[hidden email]> wrote:
> > Hi Alexandre,
> >
> > You may define a new Context that points to your images directory like this:
> >
> >     <New id="images" class="org.mortbay.jetty.servlet.Context">
> >       <Arg><Ref id="Contexts"/></Arg>
> >       <Arg>/images</Arg>
> >       <Set name="ResourceBase"><SystemProperty name="jetty.home"
> > default="."/>/images</Set>
> >       <Call name="addServlet">
> >         <Arg>org.mortbay.jetty.servlet.DefaultServlet</Arg>
> >         <Arg>/*</Arg>
> >       </Call>
> >     </New>
> >
> > Then you can get your images with this
> > http://localhost:8080/images/some.gif.
> >
> > HTH,
> > Nik
> >
> > Alexandre Jacques wrote:
> > > Hi,
> > >
> > > I am new to Jetty 6, migrating an application from Tomcat.
> > >
> > > I now find myself trying to find a way to map an external directory to
> > > serve static content from a Java WebApp. Something that sounds like a
> > > "virtual directory".
> > >
> > > Is there any way to do that?
> > >
> > > My configuration looks like:
> > >
> > >         <Item>
> > >             <New id="voffice" class="org.mortbay.jetty.webapp.WebAppContext">
> > >                 <Set name="contextPath">/</Set>
> > >                 <Set name="war">./webapps/voffice.war</Set>
> > >                 <Set name="VirtualHosts">
> > >                     <Array type="java.lang.String">
> > >                         <Item>(...).com</Item>
> > >                     </Array>
> > >                 </Set>
> > >             </New>
> > >         </Item>
> > >
> > > What I need is, when somebody access something like /voffice/images/*,
> > > that Jetty should grab the images from a static location (in my FS)
> > > like /usr/local/apps/voffice/images/*.
> > >
> > > Is it possible?
> > >
> > > TIA
> > >
> > > Alexandre Jacques
> > >
> > > -------------------------------------------------------------------------
> > > Using Tomcat but need to do more? Need to support web services, security?
> > > Get stuff done quickly with pre-integrated technology to make your job easier.
> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > _______________________________________________
> > > Jetty-support mailing list
> > > [hidden email]
> > > https://lists.sourceforge.net/lists/listinfo/jetty-support
> > >
> > >
> >
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job easier.
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Jetty-support mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/jetty-support
> >
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Virtual Directory

TEL00
Did you ever find a good answer to this?  I'm looking for something similar

Thanks,

Tom
al_masson wrote
Hi,

I was looking for an answer for my question and I found this article
from Howard Lewis Ship:

http://www.theserverside.com/tt/blogs/showblog.tss?id=JettyHack

This is exactly what I want. But, since this article is from 2004, I
was wondering if there is something already embbeded in Jetty to
achieve the same result.

I couldn't find anything in the docs.

Thanks again,

Alexandre Jacques



On 2/3/07, Alexandre Jacques <dev.lists@gmail.com> wrote:
> Hi Nik,
>
> This is almost what I need. The problem is that I need these images to
> be called as if they were under the context of my WebApp.
>
> Something like: http://localhost:8080/voffice/images/some.gif
>
> And not like: http://localhost:8080/images/some.gif
>
> The behaviour I am expecting is just like an virtual directory.
>
> TIA
>
> Alexandre Jacques
>
> On 2/1/07, Nik Gonzalez <ngonzalez@exist.com> wrote:
> > Hi Alexandre,
> >
> > You may define a new Context that points to your images directory like this:
> >
> >     <New id="images" class="org.mortbay.jetty.servlet.Context">
> >       <Arg><Ref id="Contexts"/></Arg>
> >       <Arg>/images</Arg>
> >       <Set name="ResourceBase"><SystemProperty name="jetty.home"
> > default="."/>/images</Set>
> >       <Call name="addServlet">
> >         <Arg>org.mortbay.jetty.servlet.DefaultServlet</Arg>
> >         <Arg>/*</Arg>
> >       </Call>
> >     </New>
> >
> > Then you can get your images with this
> > http://localhost:8080/images/some.gif.
> >
> > HTH,
> > Nik
> >
> > Alexandre Jacques wrote:
> > > Hi,
> > >
> > > I am new to Jetty 6, migrating an application from Tomcat.
> > >
> > > I now find myself trying to find a way to map an external directory to
> > > serve static content from a Java WebApp. Something that sounds like a
> > > "virtual directory".
> > >
> > > Is there any way to do that?
> > >
> > > My configuration looks like:
> > >
> > >         <Item>
> > >             <New id="voffice" class="org.mortbay.jetty.webapp.WebAppContext">
> > >                 <Set name="contextPath">/</Set>
> > >                 <Set name="war">./webapps/voffice.war</Set>
> > >                 <Set name="VirtualHosts">
> > >                     <Array type="java.lang.String">
> > >                         <Item>(...).com</Item>
> > >                     </Array>
> > >                 </Set>
> > >             </New>
> > >         </Item>
> > >
> > > What I need is, when somebody access something like /voffice/images/*,
> > > that Jetty should grab the images from a static location (in my FS)
> > > like /usr/local/apps/voffice/images/*.
> > >
> > > Is it possible?
> > >
> > > TIA
> > >
> > > Alexandre Jacques
> > >
> > > -------------------------------------------------------------------------
> > > Using Tomcat but need to do more? Need to support web services, security?
> > > Get stuff done quickly with pre-integrated technology to make your job easier.
> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > _______________________________________________
> > > Jetty-support mailing list
> > > Jetty-support@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/jetty-support
> > >
> > >
> >
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job easier.
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Jetty-support mailing list
> > Jetty-support@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jetty-support
> >
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jetty-support mailing list
Jetty-support@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jetty-support