@Override public void addMapping(String rawspec, WebSocketCreator creator) { PathSpec spec = toPathSpec(rawspec); addMapping(spec, creator); }
/** * Manually add a WebSocket mapping. * * @param rawspec the pathspec to map to (see {@link MappedWebSocketCreator#addMapping(String, WebSocketCreator)} for syntax details) * @param endpointClass the endpoint class to use for new upgrade requests on the provided * pathspec (can be an {@link org.eclipse.jetty.websocket.api.annotations.WebSocket} annotated * POJO, or implementing {@link org.eclipse.jetty.websocket.api.WebSocketListener}) */ public void addMapping(String rawspec, final Class<?> endpointClass) { PathSpec pathSpec = toPathSpec(rawspec); addMapping(pathSpec, endpointClass); }
@Override public boolean removeMapping(String rawspec) { PathSpec pathSpec = toPathSpec(rawspec); boolean removed = false; for (Iterator<MappedResource<WebSocketCreator>> iterator = mappings.iterator(); iterator.hasNext(); ) { MappedResource<WebSocketCreator> mapping = iterator.next(); if (mapping.getPathSpec().equals(pathSpec)) { iterator.remove(); removed = true; } } return removed; }
@Override public WebSocketCreator getMapping(String rawspec) { PathSpec pathSpec = toPathSpec(rawspec); for (MappedResource<WebSocketCreator> mapping : mappings) { if (mapping.getPathSpec().equals(pathSpec)) return mapping.getResource(); } return null; }