Не удается подключить службу JAX-RS к шаблону MVC

Я пытаюсь использовать Паттерн MVC JAX-RS '(Джерси). Попытки достичь http: // localhost: 8080 / myproject / foos / test приводят к ошибке, которая гласит:

java.io.IOException: The template name, /view, could not be resolved to a fully qualified template name

http: // localhost: 8080 / myproject / foos приводит к тому же ошибка.

Что мне не хватает?

Ресурс:

package resources;

import com.sun.jersey.api.view.Viewable;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("foos")
public class FooResource {

    @GET
    @Produces(MediaType.TEXT_HTML)
    public Viewable get() {

        return new Viewable("/index", this);

    }   

    @GET
    @Path("{id}")
    @Produces(MediaType.TEXT_HTML)
    public Viewable get(@PathParam("id") String id) {

        return new Viewable("/view", id);

    } 

}

Просмотры:

WEB-INF / jsp / resources / FooResource

  • index.jsp
  • view.jsp

web.xml:




    
        jersey
        com.sun.jersey.spi.container.servlet.ServletContainer
        
            com.sun.jersey.config.property.WebPageContentRegex
            /(resources|images|js|styles|(WEB-INF/jsp))/.*
        
    

    
        jersey
        /*
    

    
        ServletAdaptor
        com.sun.jersey.spi.container.servlet.ServletContainer
        
            Set the default, base template path to the WEB-INF folder.
            com.sun.jersey.config.property.JSPTemplatesBasePath
            /WEB-INF/jsp
        
        1
    

    
        ServletAdaptor
        /*
    

    
        
            30
        
    


6
задан craig 23 January 2012 в 20:36
поделиться