Java Code Examples for org.springframework.web.socket.server.support.WebSocketHandlerMapping#setUrlMap()

The following examples show how to use org.springframework.web.socket.server.support.WebSocketHandlerMapping#setUrlMap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServletWebSocketHandlerRegistry.java    From spring-analysis-note with MIT License 6 votes vote down vote up
public AbstractHandlerMapping getHandlerMapping() {
	Map<String, Object> urlMap = new LinkedHashMap<>();
	for (ServletWebSocketHandlerRegistration registration : this.registrations) {
		MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings();
		mappings.forEach((httpHandler, patterns) -> {
			for (String pattern : patterns) {
				urlMap.put(pattern, httpHandler);
			}
		});
	}
	WebSocketHandlerMapping hm = new WebSocketHandlerMapping();
	hm.setUrlMap(urlMap);
	hm.setOrder(this.order);
	if (this.urlPathHelper != null) {
		hm.setUrlPathHelper(this.urlPathHelper);
	}
	return hm;
}
 
Example 2
Source File: WebMvcStompEndpointRegistry.java    From spring-analysis-note with MIT License 6 votes vote down vote up
/**
 * Return a handler mapping with the mapped ViewControllers.
 */
public AbstractHandlerMapping getHandlerMapping() {
	Map<String, Object> urlMap = new LinkedHashMap<>();
	for (WebMvcStompWebSocketEndpointRegistration registration : this.registrations) {
		MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings();
		mappings.forEach((httpHandler, patterns) -> {
			for (String pattern : patterns) {
				urlMap.put(pattern, httpHandler);
			}
		});
	}
	WebSocketHandlerMapping hm = new WebSocketHandlerMapping();
	hm.setUrlMap(urlMap);
	hm.setOrder(this.order);
	if (this.urlPathHelper != null) {
		hm.setUrlPathHelper(this.urlPathHelper);
	}
	return hm;
}
 
Example 3
Source File: ServletWebSocketHandlerRegistry.java    From java-technology-stack with MIT License 6 votes vote down vote up
public AbstractHandlerMapping getHandlerMapping() {
	Map<String, Object> urlMap = new LinkedHashMap<>();
	for (ServletWebSocketHandlerRegistration registration : this.registrations) {
		MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings();
		mappings.forEach((httpHandler, patterns) -> {
			for (String pattern : patterns) {
				urlMap.put(pattern, httpHandler);
			}
		});
	}
	WebSocketHandlerMapping hm = new WebSocketHandlerMapping();
	hm.setUrlMap(urlMap);
	hm.setOrder(this.order);
	if (this.urlPathHelper != null) {
		hm.setUrlPathHelper(this.urlPathHelper);
	}
	return hm;
}
 
Example 4
Source File: WebMvcStompEndpointRegistry.java    From java-technology-stack with MIT License 6 votes vote down vote up
/**
 * Return a handler mapping with the mapped ViewControllers.
 */
public AbstractHandlerMapping getHandlerMapping() {
	Map<String, Object> urlMap = new LinkedHashMap<>();
	for (WebMvcStompWebSocketEndpointRegistration registration : this.registrations) {
		MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings();
		mappings.forEach((httpHandler, patterns) -> {
			for (String pattern : patterns) {
				urlMap.put(pattern, httpHandler);
			}
		});
	}
	WebSocketHandlerMapping hm = new WebSocketHandlerMapping();
	hm.setUrlMap(urlMap);
	hm.setOrder(this.order);
	if (this.urlPathHelper != null) {
		hm.setUrlPathHelper(this.urlPathHelper);
	}
	return hm;
}
 
Example 5
Source File: ServletWebSocketHandlerRegistry.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Return a {@link HandlerMapping} with mapped {@link HttpRequestHandler}s.
 */
public AbstractHandlerMapping getHandlerMapping() {
	Map<String, Object> urlMap = new LinkedHashMap<String, Object>();
	for (ServletWebSocketHandlerRegistration registration : this.registrations) {
		MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings();
		for (HttpRequestHandler httpHandler : mappings.keySet()) {
			for (String pattern : mappings.get(httpHandler)) {
				urlMap.put(pattern, httpHandler);
			}
		}
	}
	WebSocketHandlerMapping hm = new WebSocketHandlerMapping();
	hm.setUrlMap(urlMap);
	hm.setOrder(this.order);
	if (this.urlPathHelper != null) {
		hm.setUrlPathHelper(this.urlPathHelper);
	}
	return hm;
}
 
Example 6
Source File: WebMvcStompEndpointRegistry.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Return a handler mapping with the mapped ViewControllers; or {@code null}
 * in case of no registrations.
 */
public AbstractHandlerMapping getHandlerMapping() {
	Map<String, Object> urlMap = new LinkedHashMap<String, Object>();
	for (WebMvcStompWebSocketEndpointRegistration registration : this.registrations) {
		MultiValueMap<HttpRequestHandler, String> mappings = registration.getMappings();
		for (HttpRequestHandler httpHandler : mappings.keySet()) {
			for (String pattern : mappings.get(httpHandler)) {
				urlMap.put(pattern, httpHandler);
			}
		}
	}
	WebSocketHandlerMapping hm = new WebSocketHandlerMapping();
	hm.setUrlMap(urlMap);
	hm.setOrder(this.order);
	if (this.urlPathHelper != null) {
		hm.setUrlPathHelper(this.urlPathHelper);
	}
	return hm;
}