0

I've been looking at this for two hours, but I don't see how the batchid variable can be coming up as "" (empty String rather than null) in the debugger.

I have tried removing the @Produces/@Consumes annotations, but no luck.

I am using a linux command line POST that looks like this:

http POST http://localhost:8080/cr/feed/send-batch/550f9ef7-b586-4029-bf7d-4d0659a08707 

Can someone spot my error?

import javax.enterprise.context.RequestScoped; import javax.websocket.server.PathParam; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; @Path("/feed") @RequestScoped public class FeedHandler { @POST @Path("/send-batch/{batchid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response sendBatch(@PathParam("batchid") String batchid) { } 
5
  • Can you post also the imported tags? Perhaps you use not checked annotations. Sth. like: import javax.ws.rs.Path; import javax.ws.rs.PathParam; And I dont think you need the first '/' in the path :-) Commented Oct 14, 2014 at 13:51
  • import statements added. Which '/' are you referring to? The class or the method annotation. Commented Oct 14, 2014 at 13:55
  • Does the method needs POST? If you just need the PathParam you could also try GET. Commented Oct 14, 2014 at 14:02
  • GET doesn't get me any further :( Commented Oct 14, 2014 at 14:15
  • You were right about the imports. javax.ws.rs.PathParam is the right source for PathParam. My IDE pulled in javax.websocket.server.PathParam. Blame it on the IDE :) Commented Oct 14, 2014 at 14:22

1 Answer 1

3

The problem is your import.

You are using

import javax.websocket.server.PathParam;

but you should be using

import javax.ws.rs.PathParam;

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.