dev@jersey.java.net

RE: [Jersey] [WebDAV] Application.getSingletons() not called

From: Markus KARG <markus.karg_at_gmx.net>
Date: Thu, 25 Dec 2008 12:53:46 +0100

Marc,

sorry for answering late, but still fighting with my influenza... Thanks for
the code snippet, it works pretty well. So if I understand correctly, there
is no automatic scanning for applications but it must be explicitly provided
always, right?

BTW, for all Grizzly users, if you wonder how to do the same using Grizzly,
try this code line:

GrizzlyServerFactory.create("http://localhost:80/",
RuntimeDelegate.getInstance().createEndpoint(new AddressBookApplication(),
Adapter.class));

Merry Christmas
Markus

> -----Original Message-----
> From: Marc.Hadley_at_Sun.COM [mailto:Marc.Hadley_at_Sun.COM]
> Sent: Montag, 22. Dezember 2008 23:25
> To: dev_at_jersey.dev.java.net
> Subject: Re: [Jersey] [WebDAV] Application.getSingletons() not called
>
> On Dec 22, 2008, at 4:27 PM, Daniel Manzke wrote:
>
> > We do Rocket Science... :)
> >
> > final HttpServer server =
> HttpServerFactory.create("http://localhost:80/
> > ");
> > server.start();
> > Thread.sleep(Long.MAX_VALUE);
> >
> Try something like this instead:
>
> Application app = ...;
> RuntimeDelegate rd = RuntimeDelegate.getInstance();
> HttpHandler handler = rd.createEndpoint(app, HttpHandler.class);
> HttpServer server = HttpServer.create(new InetSocketAddress(80), 0);
> server.createContext("/", handler);
> server.setExecutor(null);
> server.start();
>
> HTH,
> Marc
>
> >
> > 2008/12/22 Marc Hadley <Marc.Hadley_at_sun.com>
> > On Dec 22, 2008, at 4:07 PM, Daniel Manzke wrote:
> >
> > thanks for your answer, but we tested it with the built in http-
> > server in Java 6. Any ideas what we could do or does it only works
> > in a real servlet container?
> >
> > It should work with any container, can you post the code you are
> > using to obtain and publish the HTTP endpoint.
> >
> > Marc.
> >
> >
> >
> > 2008/12/22 Marc Hadley <Marc.Hadley_at_sun.com>
> > On Dec 21, 2008, at 1:01 PM, Markus KARG wrote:
> >
> > to be able to support "unknown" XML extensions in our WebDAV code,
> > we need to allow the JAX-RS developer to add classes to the
> > JAXBContext. We developed a ContextResolver which works pretty well,
> > and we want to have it configured and instantiated in
> > Application.getSingletons(). But: Neither getClasses() nor
> > getSingletons() is called EVER (we even added System.exit(0) but the
> > program runs well... so we're pretty sure).
> >
> > Is that a bug in Jersey? Or what is our fault?
> >
> > It depends on how you set up your web.xml. You may have configured
> > it to use one of the Jersey-supplied Application subclasses rather
> > than yours to take advantage of package scanning etc.
> >
> > Marc.
> >
> > ---
> > Marc Hadley <marc.hadley at sun.com>
> > CTO Office, Sun Microsystems.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> > For additional commands, e-mail: dev-help_at_jersey.dev.java.net
> >
> >
> >
> >
> > --
> > Mit freundlichen Grüßen
> >
> > Daniel Manzke
> >
> > ---
> > Marc Hadley <marc.hadley at sun.com>
> > CTO Office, Sun Microsystems.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> > For additional commands, e-mail: dev-help_at_jersey.dev.java.net
> >
> >
> >
> >
> > --
> > Mit freundlichen Grüßen
> >
> > Daniel Manzke
>
> ---
> Marc Hadley <marc.hadley at sun.com>
> CTO Office, Sun Microsystems.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: dev-help_at_jersey.dev.java.net