Salve.
Ho approdato alla tecnologia Rest.
Riesco a far avviare la pagina di index.jsp del progetto ma ho un errore di all'indirizzo
http://localhost:8080/SimpleRestWeb/rest/hello/Max:
HTTP Status 404 -
type Status report
message
description The requested resource is not available.
Apache Tomcat/7.0.55
Questo è il file xml:
codice:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>SimpleRestWeb</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<display-name>Restful Web Application</display-name>
<servlet>
<servlet-name>helloworld</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>com.rest.example</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>helloworld</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
sotto c'è il file della servlet:
codice:
package com.rest.example;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
@Path("/hello")
public class HelloWorld {
@GET
@Path("/{param}")
public javax.ws.rs.core.Response getMsg(@PathParam("param") String msg) {
String output = "Ben venuto nel mondo Rest: " + msg;
return Response.status(200).entity(output).build();
}
}
Qualcuno ha qualche idea? Grazie