2

I wonder if last version of Jersey does have support of Google App Engine. I have found 'gae-integration' project (https://github.com/jersey/jersey/tree/master/incubator/gae-integration) with a link to Jersey 2.3.1. Actually all my attempts failed but maybe someone was luckier?

Thanks in advance!

Peter
  • 119
  • 9
  • I have used Jersey 1.16 before with GAE and it worked fine. Are you saying that the latest version is incompatible with GAE ? – M.Sameer Oct 10 '13 at 17:28
  • Atleast I have issues... I've a project with 1.15 and everything is ok, but starting 2.0 Jersey introduce a lot of changes... I would really appreciate a link on a small demo with 2.3.1 playing with GAE – Peter Oct 10 '13 at 17:39
  • May I suggest using Cloud Endpoints for REST instead of Jersey .. I currently use it and it's nice IMO. I do not know may be if you try it it would save you time trying to fix Jersey. – M.Sameer Oct 10 '13 at 19:06
  • Any progress with Jersey 2 on GAE? I also ran into problems and the only thing I could find were tutorials for Jersey 1.17. ... I do not want to use Cloud Endpoints (due to portability concerns). – naeger Jul 01 '14 at 11:55
  • I struggled to get Jersey 2 to work with GAE but figured it out now. Tested OK with `GAE SDK 1.9.10` and `Jersey 2.12` See for instance this link `http://blog.dejavu.sk/2013/11/19/registering-resources-and-providers-in-jersey-2/`. – Floris Sep 15 '14 at 13:00

1 Answers1

3

I struggled to get Jersey 2 to work with GAE but figured it out now.

Tested OK with GAE SDK 1.9.10 and Jersey 2.12, including multipart/form-data. See for instance this blog article.

In Jersey 2 you have to enable features in your web.xml which is automatically enabled in Jersey 1. For example the snippet below enables JSP page support and the multipart/form-data MIME type features. (I don't think the GaeFeature is required, but haven't tested without it).

<servlet>
    <servlet-name>com.namibiaonthenet.www</servlet-name>
    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>

    <init-param>
        <param-name>jersey.config.server.provider.packages</param-name>
        <param-value>com.namibiaonthenet.www</param-value>
    </init-param>

    <init-param>
        <param-name>jersey.config.server.provider.classnames</param-name>
        <param-value>
            org.glassfish.jersey.server.mvc.jsp.JspMvcFeature;
            org.glassfish.jersey.server.gae.GaeFeature;
            org.glassfish.jersey.media.multipart.MultiPartFeature;
         </param-value>
    </init-param>

   <load-on-startup>1</load-on-startup> 
</servlet>

To enable the multipart/form-data feature an additional short config. file is required in your project - for details see my and @yves' answers here.

If you still struggle, let me know in a comment to this answer.

Community
  • 1
  • 1
Floris
  • 1,082
  • 10
  • 26