@Retention(value=RUNTIME)
@Target(value=PARAMETER)
public @interface PathParam
ServerEndpoint
annotation. The method parameter may be of type String, any Java
primitive type or any boxed version thereof. If a client URI matches the URI-template, but the requested path
parameter cannot be decoded, then the websocket's error handler will be called.
For example:-
@ServerEndpoint("/bookings/{guest-id}")
public class BookingServer {
@OnMessage
public void processBookingRequest(@PathParam("guest-id") String guestID, String message, Session session) {
// process booking from the given guest here
}
}
For example:-
@ServerEndpoint("/rewards/{vip-level}")
public class RewardServer {
@OnMessage
public void processReward(@PathParam("vip-level") Integer vipLevel, String message, Session session) {
// process reward here
}
}
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
value
The name of the variable used in the URI-template.
|
public abstract java.lang.String value
null
.