Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jaxrs-dev] @PathParam not picking value ?

Also, check the PathParam you are using. 

It should be : 
import javax.ws.rs.PathParam;
Not the one from the websocket.

Thanks,
Edwin.

On Tue, 26 Jan 2021, 8:08 am Ivar Grimstad, <ivar.grimstad@xxxxxxxxxxxxxxxxxxxxxx> wrote:
I don't think you can have your resource methods in the Application class.
You should move your resource to a separate class. E.g.:

@Path("MyRestService")
public class ConvertResource {
@GET
@Produces("text/plain")
@Path("convert/{inNum : .*}")
    public String add(
            @PathParam("inNum") String inNum) {

   return ""+ inNum;
   
      }
}

And:

@ApplicationPath("/resources")
public class Julian  extends Application {
}

That should work.

On Tue, Jan 26, 2021 at 8:01 AM Som Lima <somplasticllc@xxxxxxxxx> wrote:
return value is blank in this simplified program to pass a value .

What is the issue  ?


import javax.websocket.server.
PathParam;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
/**
 *
 * Rest Web Service
 *
 */
@ApplicationPath("/resources")
@Path("MyRestService")
public class Julian  extends Application {

// curl -X GET
// http://localhost:8080/julian/resources/MyRestService/convert/0123
@GET
@Produces("text/plain")
@Path("convert/{inNum : .*}")
    public String add(
            @PathParam("inNum") String inNum) {

   return ""+ inNum;
   
      }
}

_______________________________________________
jaxrs-dev mailing list
jaxrs-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jaxrs-dev


--

Ivar Grimstad

Jakarta EE Developer Advocate | Eclipse Foundation

Eclipse Foundation - Community. Code. Collaboration. 

_______________________________________________
jaxrs-dev mailing list
jaxrs-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jaxrs-dev

Back to the top