Example usage for org.springframework.web.accept HeaderContentNegotiationStrategy HeaderContentNegotiationStrategy

List of usage examples for org.springframework.web.accept HeaderContentNegotiationStrategy HeaderContentNegotiationStrategy

Introduction

In this page you can find the example usage for org.springframework.web.accept HeaderContentNegotiationStrategy HeaderContentNegotiationStrategy.

Prototype

HeaderContentNegotiationStrategy

Source Link

Usage

From source file:cz.jirutka.spring.exhandler.RestHandlerExceptionResolver.java

@Override
public void afterPropertiesSet() {
    if (contentNegotiationManager == null) {
        contentNegotiationManager = new ContentNegotiationManager(new HeaderContentNegotiationStrategy(),
                new FixedContentNegotiationStrategy(defaultContentType));
    }//w ww.j a  v  a2s  .co m
    responseProcessor = new HttpEntityMethodProcessor(messageConverters, contentNegotiationManager);
    fallbackResponseProcessor = new HttpEntityMethodProcessor(messageConverters,
            new ContentNegotiationManager(new FixedContentNegotiationStrategy(defaultContentType)));
}

From source file:cn.newgxu.lab.core.config.SpringBeans.java

@Bean
public ContentNegotiationManager contentNegotiationManager() {
    Map<String, MediaType> mediaTypes = new HashMap<String, MediaType>(2);
    mediaTypes.put("json", MediaType.APPLICATION_JSON);
    mediaTypes.put("jsonp", MediaType.parseMediaType("application/javascript"));
    PathExtensionContentNegotiationStrategy extension = new PathExtensionContentNegotiationStrategy(mediaTypes);
    HeaderContentNegotiationStrategy header = new HeaderContentNegotiationStrategy();
    ContentNegotiationManager contentNegotiationManager = new ContentNegotiationManager(extension, header);
    return contentNegotiationManager;
}

From source file:org.springframework.security.web.util.matcher.MediaTypeRequestMatcher.java

/**
 * Creates an instance//from   w w  w .j  a  va 2s.c om
 * @param matchingMediaTypes the {@link MediaType} that will make the http request.
 * @since 5.2
 */
public MediaTypeRequestMatcher(MediaType... matchingMediaTypes) {
    this(new HeaderContentNegotiationStrategy(), Arrays.asList(matchingMediaTypes));
}

From source file:org.springframework.security.web.util.matcher.MediaTypeRequestMatcher.java

/**
 * Creates an instance/*  w  w w . java2  s  . co m*/
 * @param matchingMediaTypes the {@link MediaType} that will make the http request.
 * @since 5.2
 */
public MediaTypeRequestMatcher(Collection<MediaType> matchingMediaTypes) {
    this(new HeaderContentNegotiationStrategy(), matchingMediaTypes);
}