缩短JBoss Seam应用程序中REST服务的路径 [英] Shorten path of REST service in JBoss Seam application

查看:68
本文介绍了缩短JBoss Seam应用程序中REST服务的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是JBoss和Seam的新手.我的项目具有REST风格的服务

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();
   }
}

我可以在http://localhost:8080/application/resource/rest/media/test到达.但是,我根本不喜欢此URL,而是希望使用更短的内容,例如http://localhost:8080/application/test.

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.

您能为我指出正确配置应用程序的正确方向吗? (使用Eclipse开发)

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

推荐答案

web.xml将包含seam资源servlet映射,应将其修改为/*,如果对路径的配置更多,它将在组件中. xml,如果配置为resteasy,则将其配置为使用

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"/>

这篇关于缩短JBoss Seam应用程序中REST服务的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆