org.springframework.messaging.simp.user.DestinationUserNameProvider Java Examples

The following examples show how to use org.springframework.messaging.simp.user.DestinationUserNameProvider. 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: SendToMethodReturnValueHandler.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Nullable
protected String getUserName(Message<?> message, MessageHeaders headers) {
	Principal principal = SimpMessageHeaderAccessor.getUser(headers);
	if (principal != null) {
		return (principal instanceof DestinationUserNameProvider ?
				((DestinationUserNameProvider) principal).getDestinationUserName() : principal.getName());
	}
	return null;
}
 
Example #2
Source File: SendToMethodReturnValueHandler.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Nullable
protected String getUserName(Message<?> message, MessageHeaders headers) {
	Principal principal = SimpMessageHeaderAccessor.getUser(headers);
	if (principal != null) {
		return (principal instanceof DestinationUserNameProvider ?
				((DestinationUserNameProvider) principal).getDestinationUserName() : principal.getName());
	}
	return null;
}
 
Example #3
Source File: SendToMethodReturnValueHandler.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
protected String getUserName(Message<?> message, MessageHeaders headers) {
	Principal principal = SimpMessageHeaderAccessor.getUser(headers);
	if (principal != null) {
		return (principal instanceof DestinationUserNameProvider ?
				((DestinationUserNameProvider) principal).getDestinationUserName() : principal.getName());
	}
	return null;
}
 
Example #4
Source File: StompSubProtocolHandler.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private String getSessionRegistryUserName(Principal principal) {
	String userName = principal.getName();
	if (principal instanceof DestinationUserNameProvider) {
		userName = ((DestinationUserNameProvider) principal).getDestinationUserName();
	}
	return userName;
}