Skip to content

Instantly share code, notes, and snippets.

@jcrossley3
Created August 10, 2015 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcrossley3/36f9509c9d3375ed39c8 to your computer and use it in GitHub Desktop.
Save jcrossley3/36f9509c9d3375ed39c8 to your computer and use it in GitHub Desktop.
(defn ^ServerContainer server-container [^ServletContext context]
(.getAttribute context "javax.websocket.server.ServerContainer"))
(defn add-endpoint
"Adds an endpoint to a container obtained from the servlet-context"
[^ServletContext servlet-context {:keys [path handshake] :or {path "/"}}]
(.addEndpoint (server-container servlet-context)
(.. ServerEndpointConfig$Builder
(create DelegatingJavaxEndpoint path)
(configurator (proxy [ServerEndpointConfig$Configurator] []
(getEndpointInstance [_] (DelegatingJavaxEndpoint.))
(modifyHandshake [_ _ _]
(when handshake
(handshake
(.get WebSocketHelpyHelpertonFilter/requestTL))))))
build)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment