Example usage for org.springframework.security.web.util.matcher MediaTypeRequestMatcher setIgnoredMediaTypes

List of usage examples for org.springframework.security.web.util.matcher MediaTypeRequestMatcher setIgnoredMediaTypes

Introduction

In this page you can find the example usage for org.springframework.security.web.util.matcher MediaTypeRequestMatcher setIgnoredMediaTypes.

Prototype

public void setIgnoredMediaTypes(Set<MediaType> ignoredMediaTypes) 

Source Link

Document

Set the MediaType to ignore from the ContentNegotiationStrategy .

Usage

From source file:sample.session.SmartHttpSessionStrategy.java

@Autowired
public SmartHttpSessionStrategy(ContentNegotiationStrategy contentNegotiationStrategy) {
    this(new CookieHttpSessionStrategy(), new HeaderHttpSessionStrategy());
    MediaTypeRequestMatcher matcher = new MediaTypeRequestMatcher(contentNegotiationStrategy,
            Arrays.asList(MediaType.TEXT_HTML));
    matcher.setIgnoredMediaTypes(Collections.singleton(MediaType.ALL));

    RequestHeaderRequestMatcher javascript = new RequestHeaderRequestMatcher("X-Requested-With");

    this.browserMatcher = new OrRequestMatcher(Arrays.asList(matcher, javascript));
}