Reputation: 8467
Tomcat 7.0
was failing to start for the following method definition
@GET
@Path("/GetSeriesByIndex")
@Produces("application/json")
public String getSeriesListByIndex(@QueryParam("indexCharacter")char indexCharacter){
String allSeriesByIndex = null;
ArrayList<SeriesListDTO> seriesListing=null;
try{
ProjectManager projectManager = new ProjectManager();
seriesListing = projectManager.getSeriesListByIndex(indexCharacter);
Gson gson = new Gson();
allSeriesByIndex = gson.toJson(seriesListing);
}catch(Exception e){
System.out.println(e);
}
return allSeriesByIndex;
}
with the error message
com.sun.jersey.api.container.ContainerException: Method, public java.lang.String tv.series.services.webService.TV_Services.getSeriesListByIndex(char), annotated with GET of resource, class tv.series.services.webService.TV_Services, is not recognized as valid Java method annotated with @HttpMethod.
On changing the type of indexCharacter
to String
, the system starts and everything works fine.
can somebody explain why this happens?
I am using jersey 1.0.3
libraries. Maybe it was some bug in that release?
Thanks
Upvotes: 1
Views: 1149
Reputation: 1097
Here is jersey's api docs: https://jersey.java.net/apidocs/2.7/jersey/javax/ws/rs/QueryParam.html
Converting a String to char? Why don't you use just String?
Upvotes: 2