Thanks, Erik!

You were right on the money with Jetty.

Their documentation is extensive, so using their classes was cake. I
used the 'mini.http.jar' build option to build just the HTTP server
jar, weighing in at a measly 312KB.

That's exactly what I needed.

~akb



On 4/14/05, Erik Hatcher <[EMAIL PROTECTED]> wrote:
> As you've just discovered, its quite trivial.  Here's a snippet that
> I've used to set up a static content server _and_ a Java web container
> mapped to different paths:
> 
>      String rootDir = args[0];
>      String defaultsDescriptor = args[1];
>      String war = args[2];
> 
>      HttpContext context = new HttpContext();
>      context.setContextPath("/");
>      context.setResourceBase(rootDir);
>      ResourceHandler handler = new ResourceHandler();
>      handler.setRedirectWelcome(false);
>      context.addHandler(handler);
>      context.setRedirectNullPath(false);
>      server.addContext(context);
> 
>      WebApplicationContext webapp = server.addWebApplication("/webapp",
> war);
>      webapp.setDefaultsDescriptor(defaultsDescriptor);
>      webapp.setRedirectNullPath(false);
> 
> 
> On Apr 14, 2005, at 2:22 PM, A. Kevin Baynes wrote:
> 
> > I just took a closer look at the build.xml in Jetty and I see the
> > 'mini.http.jar' build option. The jar it produced is only 312KB, which
> > is nice. I'm guessing it is possible to include this jar and in my
> > classpath and access it's classes to run the Web server from my app?
> >
> > I'm looking at the org.mortbay.http.HttpServer class and it looks like
> > I need to use this with HttpListener, HttpContext, and HttpHandler
> > classes. I'll keep digging into it. Am I on the right track? I'm
> > trying to find an example that uses the code in this way.
> >
> > Thanks!
> >
> > On 4/14/05, Erik Hatcher <[EMAIL PROTECTED]> wrote:
> >> Jetty is quite suited to this job.  I recommend it.  I use it not only
> >> for a servlet container, but also as a static content web server.
> >>
> >>         Erik
> >>
> >>
> >> On Apr 14, 2005, at 1:33 PM, A. Kevin Baynes wrote:
> >>
> >>> I'm looking for a small open-source web server to embed into a
> >>> standalone Java application. I know I could embed Tomcat or Jetty,
> >>> but
> >>> I think they are overkill for this use-case. I don't need servlet
> >>> support, just HTTP. I would like to be able to start and stop it
> >>> quickly, changing the root directory on each instantiation.
> >>>
> >>> I'm Googling and investigating the findings, but a recommendation
> >>> from
> >>> the list would be much appreciated.
> >>>
> >>> Thanks!
> >>>
> >>> ~akb
> >>> _________________
> >>> A. Kevin Baynes
> >>>
> >>> _______________________________________________
> >>> Juglist mailing list
> >>> [email protected]
> >>> http://trijug.org/mailman/listinfo/juglist_trijug.org
> >>
> >>
> >
> >
> > --
> > ~akb
> > _________________
> > A. Kevin Baynes
> 
> _______________________________________________
> Juglist mailing list
> [email protected]
> http://trijug.org/mailman/listinfo/juglist_trijug.org
>

_______________________________________________
Juglist mailing list
[email protected]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to