On 26/10/2013 16:44, Johan Compagner wrote:
> I've just started looking at the javax.websocket implementation in tomcat 8
>> and I have a question about how one integrates an endpoint with application
>> code.  Using servlets as an analogy, web.xml allows configuration
>> information to be passed to servlets when they are initialized.  Is there
>> an equivalent in the javax.websocket world?  If not, are there any
>> suggested practices for achieving this?

There is no direct link from web.xml since WebSockets were designed to
be implementable independently from a J2EE container.

You can provide EndpointConfig instance that contain user defined
properties.

> and i have a follow up question about this, with a servlet or a filter you
> can do: getServletContext() then you have access to the resources of the
> web application and stuff like that
> How is that possible in an websocket endpoint?

The ServerEndpointConfig will have the modifyHandshake() method called
where you have access to elements of the request and response. You need
to copy any data you need at this point.

> If i want to load in a file that is in the current webapps WEB-INF dir how
> do i do that? How do i get an url or inputstream (getResource() call) to
> that file?

Calls via the class loader will continue to work.

Mark


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

Reply via email to