tags:

views:

36

answers:

1

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)

A: 

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"/>
shipmaster
Thanks for the help!The web.xml currently says: <servlet-mapping> <servlet-name>Seam Resource Servlet</servlet-name> <url-pattern>/resource/*</url-pattern> </servlet-mapping>So I take it that changing the `<url-pattern>` to /* is what you mean.My components.xml doesn't have any `<resteasy>` tag, so I will introduce what you have above and report back.One worry would be side-effects: I played with these settings once before and lost the ability to use the remoting tag in xhtml as it always resolved to a wrong path. Solved this by using the right javascript directly.
kongo09
Ok, I just tried it but the effect is, that I now can't even see the starting xhtml page of the application anymore. It gives me a 404.For the Seam Resource Servlet, I use `/*` and for Resteasy I use `/media`Any ideas?
kongo09
Hmm I dont think you can serve xhtml off the same pattern that you serve REST urls from, as xhtml has to go through the faces servlet, they cant both be simultaneously mapped to /*
shipmaster