Запуск проекта Jersey (Отдых веб-службы)для tomcat

Я пытаюсь следовать этому руководству:туториал , но когда я запускаю его в веб-браузере, он возвращает ошибку:

HTTP Status 404 - /
type Status report
message /
description The requested resource (/rest.api/rest/hello) is not available.

Я установил tomcat7 в /usr/local на своем Mac и запустил его с помощью startup.sh на терминале. Это мой web.xml и Hello.java



HelloRest


Jersey REST Service
com.sun.jersey.spi.container.servlet.ServletContainer

  com.sun.jersey.config.property.packages
  rest.api

1


 Jersey REST Service
 /rest/*

package rest.api;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

// POJO, no interface no extends

// The class registers its methods for the HTTP GET request using the @GET annotation. 
// Using the @Produces annotation, it defines that it can deliver several MIME types,
// text, XML and HTML. 

// The browser requests per default the HTML MIME type.

//Sets the path to base URL + /hello
@Path("/hello")
public class Hello {

// This method is called if TEXT_PLAIN is request
@GET
@Produces(MediaType.TEXT_PLAIN)
public String sayPlainTextHello() {
    return "Hello Jersey";
}

// This method is called if XML is request
@GET
@Produces(MediaType.TEXT_XML)
public String sayXMLHello() {
    return "" + " Hello Jersey" + "";
}

// This method is called if HTML is request
@GET
@Produces(MediaType.TEXT_HTML)
public String sayHtmlHello() {
    return " " + "" + "Hello Jersey" + ""
            + "

" + "Hello Jersey" + "

" + " "; } }

Это мой проект конфигурации:

enter image description here

Любые предложения?

5
задан Dany 10 April 2012 в 14:32
поделиться