1

Tomcat 7.0无法启动以下方法定义

@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;
    }

带有错误消息

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.

更改 to 的类型后indexCharacterString系统启动并且一切正常。

有人可以解释为什么会这样吗?

我正在使用jersey 1.0.3库。也许这是该版本中的一些错误?

谢谢

4

1 回答 1

2

这是球衣的 api 文档:https ://jersey.java.net/apidocs/2.7/jersey/javax/ws/rs/QueryParam.html

将字符串转换为字符?为什么不只使用字符串?

于 2014-04-04T06:29:35.763 回答