Re: Simple REST doesn't work

Markus Jung <[email protected]> Tue, 1 Oct 2024 08:49:59 +0200
Newsgroups gmane.comp.java.openejb.user
Message-ID <[email protected]>
Hi Fernando,

as Kean already pointed out, the spaces in @Path(" articuloservice ") do 
look odd. The Application class Benedict mentioned is not necessary as 
far as I'm aware.

What do the logs look like when you deploy the application in TomEE? 
Normally you'd see the active REST endpoints like this 
(https://github.com/apache/tomee/tree/main/examples/rest-example):

INFO - REST Application: http://localhost:40169/rest-example/ -> 
org.apache.openejb.server.rest.InternalApplication@184e5c44
INFO -      Service URI: http://localhost:40169/rest-example/api/comment 
-> Pojo org.superbiz.rest.service.CommentService
INFO -            DELETE 
http://localhost:40169/rest-example/api/comment/delete/{id} ->      void 
delete(long)
...


On 30.09.24 22:28, Fernando wrote:
> Hi all!,
> I am trying to implement a very simple rest web service following the guide:
> https://tomee.apache.org/tomee-8.0/examples/simple-rest.html
>
> and this is my code:
>
> @Path(" articuloservice ")
> public class ArticulosService {
>
>      @Inject
>      private ArticuloDao articuloDao;
>
>      @GET
>      @Path("/saludar")
>      @Produces(MediaType.TEXT_PLAIN)
>      public String Saludo() {
>          return "Helloooo!";
>      }
> }
>
> I am trying to test the code using postman  (GET) :
> *http://localhost:8080/Hiper/articuloservice/saludar
> <http://localhost:8080/Hiper/articuloservice/saludar>*
>
> getting the following response: "*The required resource is not available*"
>
> Maybe I am missing something?...any idea?
> Thanks in advance!
> Fernando
>