Я пишу веб-сервис REST.Это фрагмент веб-службы:
@Path("/first")
public class InitialResource
{
@GET
@Path(value="/{input}/{location}/{category}/{session}")
@Produces({"application/xml", "text/html"})
public List<Message> getMessage(@PathParam("input") String input, @PathParam("location") String location, @PathParam("category") String category, @PathParam("session") String session) throws NotFoundException
{
if(date.recentUpdate(location) == false)// if false, the checking of category update was run later than 1 hour ago
{
user.dropTable(); // invokes method which checks if you need to drop any user's intermediate results table
if(version.getVersion(location)== true) // if version of category did not change
{
}
else
{// version of category old; updates list of category for a specific country
updateCategory.getCategoryList(id.getSiteId(location));
}
}
return search.runSearch(input, location, category, session.split("\\.")[1]);
}
}
Если вы вызовете его через этот URI
http://localhost:8080/Project/resources/first/cat/EBAY-IE/1/0.123
, вы получите ошибку 404 HTTP.
Существует еще один ресурсниже.
@GET
@Produces("text/html")
public String getMess( ) {
return "hello";
}
Если вы вызываете службу с этим URI
http://localhost:8080/Project/resources/first
, на экране появляется строка «привет».Почему я не могу вызвать первый ресурс с указанным путем?