Peter
Peter

Reputation: 119

Jersey 2.3.1 on Google App Engine

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!

Upvotes: 2

Views: 2451

Answers (1)

Floris
Floris

Reputation: 1123

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.

Upvotes: 3

Related Questions