Skip to Content
0
Former Member
Jul 31, 2013 at 10:36 AM

Restful Webservice on Application Server Java

187 Views

Hi,

i'm trying to create Restful Webservices on the Netweaver Java Application Server with JAX-RS.

The Classes are annotated correctly.

package pkg;

@Path(value = "/Calculate")

public class Calculate{

@Path("/{x}&{y}")

@GET

@Produces(MediaType.TEXT_PLAIN)

public String sum(@PathParam("x") int x, @PathParam("y") int y) {

return Integer.toString(x + y);

}

}

and in the web.xml:

<servlet>

<servlet-name>Servlet</servlet-name>

<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>

<init-param>

<param-name>com.sun.jersey.config.property.packages</param-name>

<param-value>testpkg</param-value>

</init-param>

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

</servlet>

<servlet-mapping>

<servlet-name>Servlet</servlet-name>

<url-pattern>/rest/*</url-pattern>

</servlet-mapping>

However, if i deploy on a glassfish server it works.

The Java AS only writes "404 - not found".

Any Suggestions? - Thank you.

Regards,

Michael