A question about websocket API-- Annotation ServerEndpoint

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

A question about websocket API-- Annotation ServerEndpoint

王琳
Hi friend:
 i have a question. use Tomcat 8.5.15
@ServerEndpoint API has 'value' summary. This value mapping url.When the url has parameter,use {}.
for example:
@ServerEndpoint(value = "/websocket/fmsWebsocket/{userId}/{companyId}/{groupId}")

js:var url = "ws://192.168.0.6:8080/note/websocket/fmsWebsocket/1/1/1";

My question is when {userId} is null or {companyId} is null or {groupId} is null . How  write @ ServerEndpoint(value=??????).
and
js: var url = "ws://192.168.0.6:8080/note/websocket/fmsWebsocket///1";
is right?

Thank you very much!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: A question about websocket API-- Annotation ServerEndpoint

Mark Thomas-2
On 08/06/17 02:06, 王琳 wrote:

> Hi friend:
>  i have a question. use Tomcat 8.5.15
> @ServerEndpoint API has 'value' summary. This value mapping url.When the url has parameter,use {}.
> for example:
> @ServerEndpoint(value = "/websocket/fmsWebsocket/{userId}/{companyId}/{groupId}")
>
> js:var url = "ws://192.168.0.6:8080/note/websocket/fmsWebsocket/1/1/1";
>
> My question is when {userId} is null or {companyId} is null or {groupId} is null . How  write @ ServerEndpoint(value=??????).
> and
> js: var url = "ws://192.168.0.6:8080/note/websocket/fmsWebsocket///1";
> is right?

No. That will get normalized to:#
ws://192.168.0.6:8080/note/websocket/fmsWebsocket/1

which then won't match your template. You'll need to define an explicit
value for unspecified - e.g. 0.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: A question about websocket API-- Annotation ServerEndpoint

王琳
Thank you
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: A question about websocket API-- Annotation ServerEndpoint

kmaxwilliams43
Fifgfdyfyi

Envoyé de mon smartphone BlackBerry 10.
  Message d'origine  
De: 王琳
Envoyé: vendredi 9 juin 2017 01:37
À: [hidden email]
Répondre à: Tomcat Users List
Objet: Re: A question about websocket API-- Annotation ServerEndpoint

Thank you



--
View this message in context: http://tomcat.10.x6.nabble.com/A-question-about-websocket-API-Annotation-ServerEndpoint-tp5064163p5064200.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: A question about websocket API-- Annotation ServerEndpoint

kmaxwilliams43
In reply to this post by 王琳
Fictdyhcu

Envoyé de mon smartphone BlackBerry 10.
  Message d'origine  
De: 王琳
Envoyé: vendredi 9 juin 2017 01:37
À: [hidden email]
Répondre à: Tomcat Users List
Objet: Re: A question about websocket API-- Annotation ServerEndpoint

Thank you



--
View this message in context: http://tomcat.10.x6.nabble.com/A-question-about-websocket-API-Annotation-ServerEndpoint-tp5064163p5064200.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...