users@tyrus.java.net

Re: Retrieve user data from a standalone server

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Wed, 22 Apr 2015 16:48:16 +0200

Hey Ly,

please see @ServerEndpointConfig [1] chapter (4.1.1.5) in our user
guide. You can register your ServerEndpointConfig.Configurator and
override method #getEndpointInstance(Class<T> endpointClass), which
gives you absolute control in terms of endpoint instantiation.

Regards,
Pavel

[1] https://tyrus.java.net/documentation/1.10/user-guide.html#d0e464


On 22/04/15 16:38, lywilliam.chhim_at_murex.com wrote:
> Hi,
>
> I'm currently trying to write a websocket server using tyrus'
> standalone server (i.e. org.glassfish.tyrus.server.Server). I also want
> the server to be linked to the rest of my application. Tyrus takes the
> class of my ServerEndpoint as an argument and instantiates it
> internally. It doesn't seem possible to give arguments to the created
> object.
>
> How can I give the instance of one of my custom class to the endpoint ?
>
> I also tried to create a properties map that I gave to the constructor
> but when I retrieved it on the OnOpen callback (using
> config.getUserProperties) the map always appeared to be empty...
>
> Thanks in advance,
> Regard.
>
> Ly William