Example usage for org.springframework.security.web.util.matcher RequestHeaderRequestMatcher RequestHeaderRequestMatcher

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

Introduction

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

Prototype

public RequestHeaderRequestMatcher(String expectedHeaderName) 

Source Link

Document

Creates a new instance that will match if a header by the name of #expectedHeaderName is present.

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));
}