Japod's blog
Archives
« April 2009 »
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
18
19
20
21
23
24
25
26
28
29
30
  
       
Today
Click me to subscribe
Search

Links
 

View My Stats
« Previous month (Feb 2009) | Main | Next month (Apr 2009) »
Monday Apr 27, 2009
Jersey 1.0.3 GlassFish V3 packages split up

Jersey version 1.0.3 is now available also to GlassFish V3 Prelude users via GFv3 update center. I am writing this, because several changes happened about how things work there.

As you can see at the snapshot, the first big change relates to number of Jersey packages. Started from the 1.0.3 version, we are providing two separate packages.

We are going to integrate with GlassFish V3 bits, so that people would not need to install Jersey separately. And as we wanted to lower the Jersey footprint in GlassFish V3, we have broken the original Jersey package down into two separate modules:

The "Jersey Core" package contains OSGI modules for jersey-bundle, jettison, and jackson-asl libraries. This should be sufficient for you to deploy Jersey based web applications to GlassFish V3 Prelude without a need to bundle any Jersey related jars with your application WAR file and should be good for production.

"Jersey Examples and Documentation" package contains Jersey API javadocs and some examples. This package should be useful especially for developers, who want to learn Jersey, and see how it works before developing their own RESTful web applications. If you choose this package, the UC client will automatically install also the "Jersey core" module, and you will get installed everything you need to start up.

A rather cosmetic change happened to location, where jersey subdirectory gets installed into. It has moved from $AS_HOME/jersey to $AS_HOME/glassfish/jersey.

When upgrading from earlier versions of Jersey, you could be a bit confused with consequences of the above described changes. So if you upgraded into a newer Jersey version and try to figure out, where all Jersey examples and docs went, just install "Jersey Examples and Documentation" in addition and it should re-appear in $AS_HOME/glassfish/jersey.

Posted at 11:52AM Apr 27, 2009 by Jakub Podlesak in REST  |  Comments[0]

Wednesday Apr 22, 2009
Jersey aplication sharing Grizzly with static content and servlets

I was asked the question some time ago by one of my colleges here at SUN, and the same question was asked again recently at our user mailing list: "I want to run Jersey based application on Grizzly web server, but i want to also run another servlet from there, and possibly also serve some static content using the very same Grizzly sever instance. How do i do that?"

The answer is as simple as follows. Having imported

import com.sun.grizzly.http.embed.GrizzlyWebServer;
import com.sun.grizzly.http.servlet.ServletAdapter;
import com.sun.jersey.spi.container.servlet.ServletContainer;

You can just use:

        // static content is linked from here
        GrizzlyWebServer gws = new GrizzlyWebServer(8080, "/var/www");

        // Jersey web resources
        ServletAdapter jerseyAdapter = new ServletAdapter();
        jerseyAdapter.addInitParameter("com.sun.jersey.config.property.packages",
                "com.example");
        jerseyAdapter.setContextPath("/jersey");
        jerseyAdapter.setServletInstance(new ServletContainer());
        
        // Another non-Jersey servlet
        ServletAdapter simpleServletAdapter = new ServletAdapter();
        simpleServletAdapter.setContextPath("/simple");
        simpleServletAdapter.setServletInstance(new SimpleServlet());

        // register all above defined adapters
        gws.addGrizzlyAdapter(jerseyAdapter, new String[] {"/jersey"});
        gws.addGrizzlyAdapter(simpleServletAdapter, new String[] {"/simple"});

        // let Grizzly run
        gws.start();

Your Jersey resource classes are placed in com.example package, and will become accessible at http://localhost:8080/jersey base. Your static content for http://localhost:8080/ is taken from /var/www directory and a SimpleServlet will become available at http://localhost:8080/simple.

The only dependency you will need to include other than Jersey dependencies itself is

        <dependency>
            <groupId>com.sun.grizzly</groupId>
            <artifactId>grizzly-servlet-webserver</artifactId>
            <version>1.9.10</version>
        </dependency>

If you are interested in some more advanced scenarios, you can get inspired at Jean-Francois Arcand's blog post

Posted at 12:04PM Apr 22, 2009 by Jakub Podlesak in REST  |  Comments[3]

Friday Apr 17, 2009
Videa z únorového setkání CZJUGu

Videa z únorového setkání CZJUGu jsou k dispozici ke stažení. Jen pro připomenutí: jednalo se o monotematicky zaměřené setkání věnované technologii JavaFX.

Úvodní prezentace Honzy Štěrby a Juraje Švece z pražského vývojového centra společnosti SUN Microsystems byla přímo nabitá demonstracemi předvádějícími jednotlivé funkce JavaFX.

Michal Škvor pak navázal předvedením nástrojů potřebných pro vývoj. Zajímavá byla ukázka podpory JavaFX v nástrojích firmy Adobe.

Setkání bylo zakončeno poměrně dlouhou diskuzí, kde prezentátoři nejen odpovídali na dotazy, ale předvedli další dema.

Jednotlivé záznamy jsou přístupné na následujících adresách:

Slajdy jsou zde a zde. I když díky množství demonstrací platí, že kdo neviděl video, slajdy mu rozhodně stačit nebudou :-)

Poznámka: Po downloadu by měla videa být přehratelná na Linuxu/Solarisu mplayerem (vyzkoušeno), z platformy Apple byste je měli být schopni přehrát přímo z webu. Na systémech Windows věřím, že po stažení QuickTime Playeru by přehrání mělo být také bez problémů.

Posted at 06:52PM Apr 17, 2009 by Jakub Podlesak in CZJUG  |  Comments[0]