users@jersey.java.net

Re: [Jersey] Better example

From: Leonardo <sombriks_at_gmail.com>
Date: Thu, 22 Jul 2010 13:07:22 -0300

Hi Rebel,

on your web.xml do something like this:

        <servlet>
                <description>servlet do jersey</description>
                <display-name>ServletContainer</display-name>
                <servlet-name>ServletContainer</servlet-name>
                <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
        </servlet>
        <servlet-mapping>
                <servlet-name>ServletContainer</servlet-name>
                <url-pattern>/service/*</url-pattern>
        </servlet-mapping>

 and if you want some classpath scanning facilities, grab those jars
(those are a bit outdated, but will do the job as example):

asm-3.1.jar
jersey-core-1.1.5.1.jar
jersey-json-1.1.5.1.jar
jersey-server-1.1.5.1.jar
jsr311-api-1.1.jar

2010/7/22 Rebel Geek <rebel.geek_at_gmail.com>:
> Hello,
> I did a few searches in the forums and I could not find what I was looking
> for, so please forgive me if I've indadvertedly repeated a question....
> I have a Wep Application (WAR) that I have running with the Jetty-runner. It
> has the following features:
>
> Serves up dojo pages (static HTML)
> Has Servlets/filters for authentication and AJAX
>
> I would like to add Jersey RESTful services to this, but I'd also like to
> get rid of Jetty and use Grizzly completely embedded in the application.  I
> see examples of embedding Grizzly and I see examples of creating REST
> Resource, etc., but I don't see any examples that will point me to using
> Jersey/Grizzly to create a web server that will server HTML, Servlets and
> RESTful services all in one.
> The reason why I'm struggling is because the Jersey examples use the
> com.sun.jersey.api.container.grizzly.GrizzlyWebContainerFactory as opposed
> to GrizzlyWebServer class from the Grizzly packages. Can somebody point me
> to documentation or an example that will put me on the correct path?
> Thank you,
> Alfred