Hi team,

I've implemented a WebSocket server endpoint inside a Tapestry application
by placing its class inside the 'services' folder, and adding its path to
'contributeIgnoredPathsFilter()' as below.

    public static void contributeIgnoredPathsFilter(Configuration<String>
configuration) {
        configuration.add("/websocket/.*");
    }

Tomcat successfully connects client apps calling this web socket URI. 
Having the server endpoint as a Tapestry service ought to work well,
allowing me to PUSH messages out to connected clients.  So far so good. 
The slight hiccup is that this server endpoint (service) depends on
another service, which I've tried injecting into a field of the endpoint
class:

    @InjectService("VesselStateTracker")
    private VesselStateTracker vesselStateTracker;

The problem is that when Tomcat invokes this endpoint class, the injected
service is not instantiated (makes sense, as Tapestry is configured to
ignore calls to the endpoint).  So a null pointer exception occurs as soon
as the endpoint tries to use 'vesselStateTracker' internally.

In AppModule I've tried eagerly loading both services after binding them,
and making the VesselStateTracker field a static field inside the
endpoint, but this wasn't successful.

Is there a simple solution or work-around to this almost expected problem?

Thanks & regards,

Chris.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to