minil
minil

Reputation: 7145

Issues in RESTFul Webservice annotation

I am trying to write a RESTFul Webservice using Jersey.

package sample.hello.resources;

@Path("/hello")
public class HelloResource  {   
    @GET
    @Produces({MediaType.TEXT_PLAIN})
    public String sayHello() {
        return "Hello Jersey";
    }
}

My Eclipse give error for all the annotations - @Path, (Path cannot be resolved to a type)

Do I need to include any other libraries or configure the projects in Eclipse?

Upvotes: 3

Views: 3484

Answers (2)

Orlov Andrey
Orlov Andrey

Reputation: 272

Add the javax.ws.rs.jar and import :

import javax.ws.rs.Path;

Is need to help!

Upvotes: 0

suat
suat

Reputation: 4289

It seems that Path annotation exists in jersey-core library. I think you should include that library in your project

Upvotes: 8

Related Questions