Shorten path of REST service in JBoss Seam application

会有一股神秘感。 提交于 2019-12-12 18:17:30

问题


I'm pretty new to JBoss and Seam. My project has a REST service of the style

@Path("/media")
@Name("mediaService")
public class MediaService {

    @GET()
    @Path("/test")
    public Response getTest() throws Exception {
        String result = "this works";
        ResponseBuilder builder = Response.ok(result);
        return builder.build();
   }
}

I can reach this at http://localhost:8080/application/resource/rest/media/test. However, I don't like this URL at all and would prefer something much shorter like http://localhost:8080/application/test.

Can you please point me in the right direction on how to configure the application correctly? (Developing using Eclipse)


回答1:


web.xml will contain seam resource servlet mapping , this should be modified to /*, and if you have more configuration to the path it will be in components.xml ,if it is resteasy seam is configured to use, it will look like the following

<resteasy:application resource-path-prefix="/rest"/>


来源:https://stackoverflow.com/questions/3248814/shorten-path-of-rest-service-in-jboss-seam-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!