Chiuccolo
Chiuccolo

Reputation: 53

Params from @ManagedService path are null

actually I would to retrieve two params from the @ManagedService path, but i get only null value. The code is something like:

...
import org.atmosphere.config.service.PathParam;
import org.atmosphere.config.service.ManagedService;
import org.atmosphere.config.service.Singleton;

@Singleton
@ManagedService(path = "/chat/{myId}/{destId}")
public class Chat {

  @PathParam("myId")
  private String mittId;

  @PathParam("destId")
  private String destId;

  @Ready
  public void onReady(AtmosphereResource r) {
    logger.info("User {} want to chat with {}", mittId,destId);
  }

Debugging "mittId" and "destId" are null. There's some error on the code or something that I forget? Actually I'm using Atmosphere-runtime 2.3.0.

Thanks to anybody that will help!

Upvotes: 1

Views: 421

Answers (2)

Chiuccolo
Chiuccolo

Reputation: 53

The client is correct. I resolve removing @Singleton annotation. Now while I'm debugging I can see the value of the two params.

Upvotes: 1

Heikki
Heikki

Reputation: 209

Either you are not sharing the enough or the original back-end code or your client application is calling the chat resource incorrectly.

I tested your example and both path parameters are populated. Please have a look at the example in the Atmosphere Github page about the the multichatroom, especially the client implementation.

Upvotes: 0

Related Questions