-
1. Re: Errai REST Service call
csa Dec 16, 2013 6:01 PM (in response to cristianmiranda)1 of 1 people found this helpfulHi Cristian,
An easy way to find out what's wrong is to take a look at the request your browser sends when listAllEnabledStrategies() is invoked on the client. You can use FireBug (click on the Net tab) or in Chrome (View->Developer Tools->Network tab).
You can also try to type the URL directly in your browser and check for the response.
A mistake I can think of is not configuring the root path of your REST endpoint properly (see here for more details).
Cheers,
Christian
-
2. Re: Errai REST Service call
cristianmiranda Dec 16, 2013 6:09 PM (in response to csa)Cool, so after setting my REST endpoint this way:
RestClient.setApplicationRoot("/MyJaxRsEndpointPath");
the URL would be: www.myapp.com/MyJaxRsEndpointPath/myServicePath??
Should I add some additional configuration on my web.xml?
Thanks!
-
3. Re: Errai REST Service call
csa Dec 16, 2013 6:24 PM (in response to cristianmiranda)Yes. If you've started from the errai-tutorial project you will already have a configuration in there that registers all REST endpoints under /rest:
https://github.com/errai/errai-tutorial/blob/master/src/main/webapp/WEB-INF/web.xml#L10
There are multiple ways to configure RestEasy depending on what server you intend to use:
Cheers,
Christian
-
4. Re: Re: Errai REST Service call
cristianmiranda Dec 16, 2013 11:12 PM (in response to csa)Thanks! added the following to my web.xml and is working now... The only issue I'm having is that all the injected beans in my service are null. Is this because service is not being retrieved from the container? How could I solve this?
<!-- Auto scan REST service --> <context-param> <param-name>resteasy.scan</param-name> <param-value>true</param-value> </context-param> <!-- this need same with resteasy servlet url-pattern --> <context-param> <param-name>resteasy.servlet.mapping.prefix</param-name> <param-value>/rest</param-value> </context-param> <listener> <listener-class> org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap </listener-class> </listener> <servlet> <servlet-name>resteasy-servlet</servlet-name> <servlet-class> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher </servlet-class> </servlet> <servlet-mapping> <servlet-name>resteasy-servlet</servlet-name> <url-pattern>/rest/*</url-pattern> </servlet-mapping>
Thank you again for replying so fast! you guys rock!