Spring Framework YamlMapFactoryBean - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework YamlMapFactoryBean class.

This code example shows how to use the following methods:getObject, setResources
	public SecurityChannelInterceptor(UserService userService) {
		this.userService = userService;
	} 
 
	public void loadConfiguration(String filename) {
		YamlMapFactoryBean factory = new YamlMapFactoryBean();
		factory.setResources(new ClassPathResource[]{new ClassPathResource(filename)});
		this.securityDefinitions = factory.getObject();
	} 
 
	@Override 
	public Message<?> preSend(Message<?> message, MessageChannel channel) {
		UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken)message.getHeaders().get(SimpMessageHeaderAccessor.USER_HEADER);
		String destination = (String)message.getHeaders().get(SimpMessageHeaderAccessor.DESTINATION_HEADER);
		if((destination == null) || isAllowed(destination, authentication.getName())) {
			return message; 
		} 
		throw new AccessDeniedException("Message to destination " + destination + " not allowed for user " + authentication.getName());
 
	} 
6
CodeRank
See Code Examples for Spring Framework YamlMapFactoryBean Methods: