Java 类org.springframework.http.converter.ResourceHttpMessageConverter 实例源码

项目:class-guard    文件:WebMvcConfigurationSupport.java   
/**
 * Adds a set of default HttpMessageConverter instances to the given list.
 * Subclasses can call this method from {@link #configureMessageConverters(List)}.
 * @param messageConverters the list to add the default message converters to
 */
protected final void addDefaultHttpMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
    StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
    stringConverter.setWriteAcceptCharset(false);

    messageConverters.add(new ByteArrayHttpMessageConverter());
    messageConverters.add(stringConverter);
    messageConverters.add(new ResourceHttpMessageConverter());
    messageConverters.add(new SourceHttpMessageConverter<Source>());
    messageConverters.add(new AllEncompassingFormHttpMessageConverter());

    if (romePresent) {
        messageConverters.add(new AtomFeedHttpMessageConverter());
        messageConverters.add(new RssChannelHttpMessageConverter());
    }
    if (jaxb2Present) {
        messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
    }
    if (jackson2Present) {
        messageConverters.add(new MappingJackson2HttpMessageConverter());
    }
    else if (jacksonPresent) {
        messageConverters.add(new MappingJacksonHttpMessageConverter());
    }
}
项目:lams    文件:RestTemplate.java   
/**
 * Create a new instance of the {@link RestTemplate} using default settings.
 * Default {@link HttpMessageConverter}s are initialized.
 */
@SuppressWarnings("deprecation")
public RestTemplate() {
    this.messageConverters.add(new ByteArrayHttpMessageConverter());
    this.messageConverters.add(new StringHttpMessageConverter());
    this.messageConverters.add(new ResourceHttpMessageConverter());
    this.messageConverters.add(new SourceHttpMessageConverter<Source>());
    this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());

    if (romePresent) {
        this.messageConverters.add(new AtomFeedHttpMessageConverter());
        this.messageConverters.add(new RssChannelHttpMessageConverter());
    }
    if (jaxb2Present) {
        this.messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
    }
    if (jackson2Present) {
        this.messageConverters.add(new MappingJackson2HttpMessageConverter());
    }
    else if (jacksonPresent) {
        this.messageConverters.add(new org.springframework.http.converter.json.MappingJacksonHttpMessageConverter());
    }
}
项目:spring-rest-basis    文件:AbstractZg2proRestTemplate.java   
protected AbstractZg2proRestTemplate(SimpleModule sm) {
    super();
    //converters
    List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
    messageConverters.add(new FormHttpMessageConverter());
    messageConverters.add(new StringHttpMessageConverter());
    messageConverters.add(new ByteArrayHttpMessageConverter());
    messageConverters.add(new ResourceHttpMessageConverter());
    ObjectMapper jsonMapper = camelToKebabObjectMapper(sm);
    messageConverters.add(new MappingJackson2HttpMessageConverter(jsonMapper));
    this.setMessageConverters(messageConverters);
    //errors handling
    setErrorHandler(new RestTemplateErrorHandler());
    /*
    //interceptors
    LoggingRequestInterceptor lri = new LoggingRequestInterceptor();
    this.setInterceptors(new ArrayList<>());
    this.getInterceptors().add(lri);
    this.setRequestFactory(LoggingRequestFactoryFactory.build(lri));
    */
}
项目:oma-riista-web    文件:WebMVCConfig.java   
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
    final MappingJackson2HttpMessageConverter jsonMessageConverter = jacksonMessageConverter();

    final StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
    stringHttpMessageConverter.setWriteAcceptCharset(false);

    messageConverters.add(new CSVMessageConverter());
    messageConverters.add(new ByteArrayHttpMessageConverter());
    messageConverters.add(stringHttpMessageConverter);
    messageConverters.add(new ResourceHttpMessageConverter());
    messageConverters.add(new SourceHttpMessageConverter<>());
    messageConverters.add(new AllEncompassingFormHttpMessageConverter());
    messageConverters.add(jsonMessageConverter);
    messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
}
项目:spring4-understanding    文件:RequestPartIntegrationTests.java   
@Before
public void setUp() {
    ByteArrayHttpMessageConverter emptyBodyConverter = new ByteArrayHttpMessageConverter();
    emptyBodyConverter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON));

    List<HttpMessageConverter<?>> converters = new ArrayList<>(3);
    converters.add(emptyBodyConverter);
    converters.add(new ByteArrayHttpMessageConverter());
    converters.add(new ResourceHttpMessageConverter());
    converters.add(new MappingJackson2HttpMessageConverter());

    AllEncompassingFormHttpMessageConverter converter = new AllEncompassingFormHttpMessageConverter();
    converter.setPartConverters(converters);

    restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory());
    restTemplate.setMessageConverters(Collections.singletonList(converter));
}
项目:contestparser    文件:HttpMessageConvertersTests.java   
@Test
public void containsDefaults() throws Exception {
    HttpMessageConverters converters = new HttpMessageConverters();
    List<Class<?>> converterClasses = new ArrayList<Class<?>>();
    for (HttpMessageConverter<?> converter : converters) {
        converterClasses.add(converter.getClass());
    }
    assertThat(converterClasses,
            equalTo(Arrays.<Class<?>>asList(ByteArrayHttpMessageConverter.class,
                    StringHttpMessageConverter.class,
                    ResourceHttpMessageConverter.class,
                    SourceHttpMessageConverter.class,
                    AllEncompassingFormHttpMessageConverter.class,
                    MappingJackson2HttpMessageConverter.class,
                    MappingJackson2XmlHttpMessageConverter.class)));
}
项目:orchidae    文件:_PictureController.java   
@Before
public void setup() {
    controller = new PictureController();
    controller.userUtil = userUtil;
    controller.factory = factory;
    controller.fileUtil = fileUtil;
    controller.latestPictureLimit = 10;
    controller.hookHandler = hookHandler;

    mvc = MockMvcBuilders.standaloneSetup(controller).setMessageConverters(new EntityConverter(factory),
            new StringHttpMessageConverter(), new ResourceHttpMessageConverter()).build();

    setAuthentication(owner);

    // TODO this information should be pulled out from somewhere else
    factory.create(User.class).setUsername(ownr).setPassword("1").setMemberSince(DateTime.now()).setPictureCount(
            new AtomicInteger(0)).save();

    session = new MockHttpSession();
    session.setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY,
            SecurityContextHolder.getContext());
}
项目:xm-uaa    文件:TwitterEscapingFormHttpMessageConverter.java   
TwitterEscapingFormHttpMessageConverter() {
    setCharset(Charset.forName("UTF-8"));
    List<HttpMessageConverter<?>> partConverters = new ArrayList<>();
    partConverters.add(new ByteArrayHttpMessageConverter());
    StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(
        Charset.forName("UTF-8"));
    stringHttpMessageConverter.setWriteAcceptCharset(false);
    partConverters.add(stringHttpMessageConverter);
    partConverters.add(new ResourceHttpMessageConverter());
    setPartConverters(partConverters);
}
项目:cf-java-client-sap    文件:RestUtil.java   
private List<HttpMessageConverter<?>> getFormPartsMessageConverters() {
    List<HttpMessageConverter<?>> partConverters = new ArrayList<HttpMessageConverter<?>>();
    StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
    stringConverter.setSupportedMediaTypes(Collections.singletonList(JsonUtil.JSON_MEDIA_TYPE));
    stringConverter.setWriteAcceptCharset(false);
    partConverters.add(stringConverter);
    partConverters.add(new ResourceHttpMessageConverter());
    partConverters.add(new UploadApplicationPayloadHttpMessageConverter());
    return partConverters;
}
项目:cf-java-client-sap    文件:RestUtil.java   
private List<HttpMessageConverter<?>> getHttpMessageConverters() {
    List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
    messageConverters.add(new ByteArrayHttpMessageConverter());
    messageConverters.add(new StringHttpMessageConverter());
    messageConverters.add(new ResourceHttpMessageConverter());
    messageConverters.add(new UploadApplicationPayloadHttpMessageConverter());
    messageConverters.add(getFormHttpMessageConverter());
    messageConverters.add(new MappingJackson2HttpMessageConverter());
    messageConverters.add(new LoggregatorHttpMessageConverter());
    return messageConverters;
}
项目:xm-ms-entity    文件:MultipartMixedConverter.java   
public MultipartMixedConverter() {
    this.supportedMediaTypes.add(MediaType.APPLICATION_FORM_URLENCODED);
    this.supportedMediaTypes.add(MediaType.MULTIPART_FORM_DATA);
    this.supportedMediaTypes.add(mixed);
    this.supportedMediaTypes.add(related);

    this.partConverters.add(new ByteArrayHttpMessageConverter());
    StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
    stringHttpMessageConverter.setWriteAcceptCharset(false);
    this.partConverters.add(stringHttpMessageConverter);
    this.partConverters.add(new ResourceHttpMessageConverter());
    this.partConverters.add(new MappingJackson2HttpMessageConverter());
}
项目:FastBootWeixin    文件:WxInvokerConfiguration.java   
/**
 * 只考虑微信的消息转换,后期可以优化
 * 其实这里完全可以使用系统的Bean,但是这里我想特殊处理,只对微信消息做转换,所以定制化了几个converter
 *
 * @return dummy
 */
private HttpMessageConverters getDefaultWxMessageConverters() {
    StringHttpMessageConverter stringConverter = new StringHttpMessageConverter(StandardCharsets.UTF_8);
    stringConverter.setWriteAcceptCharset(false);
    MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter();
    Jaxb2RootElementHttpMessageConverter xmlConverter = new Jaxb2RootElementHttpMessageConverter();
    AllEncompassingFormHttpMessageConverter formConverter = new AllEncompassingFormHttpMessageConverter();
    ResourceHttpMessageConverter resourceConverter = new ResourceHttpMessageConverter();
    HttpMessageConverters wxMessageConverters = new HttpMessageConverters(stringConverter, jsonConverter, xmlConverter, formConverter, resourceConverter);
    return wxMessageConverters;
}
项目:spring4-understanding    文件:RequestResponseBodyMethodProcessorTests.java   
@Test
public void handleReturnValueImage() throws Exception {
    this.servletRequest.addHeader("Accept", "*/*");

    Method method = getClass().getDeclaredMethod("getImage");
    MethodParameter returnType = new MethodParameter(method, -1);

    List<HttpMessageConverter<?>> converters = Collections.singletonList(new ResourceHttpMessageConverter());
    RequestResponseBodyMethodProcessor processor = new RequestResponseBodyMethodProcessor(converters);

    ClassPathResource resource = new ClassPathResource("logo.jpg", getClass());
    processor.writeWithMessageConverters(resource, returnType, this.webRequest);

    assertEquals("image/jpeg", this.servletResponse.getHeader("Content-Type"));
}
项目:spring4-understanding    文件:AnnotationDrivenBeanDefinitionParserTests.java   
@SuppressWarnings("unchecked")
private void verifyMessageConverters(Object bean, boolean hasDefaultRegistrations) {
    assertNotNull(bean);
    Object value = new DirectFieldAccessor(bean).getPropertyValue("messageConverters");
    assertNotNull(value);
    assertTrue(value instanceof List);
    List<HttpMessageConverter<?>> converters = (List<HttpMessageConverter<?>>) value;
    if (hasDefaultRegistrations) {
        assertTrue("Default converters are registered in addition to custom ones", converters.size() > 2);
    } else {
        assertTrue("Default converters should not be registered", converters.size() == 2);
    }
    assertTrue(converters.get(0) instanceof StringHttpMessageConverter);
    assertTrue(converters.get(1) instanceof ResourceHttpMessageConverter);
}
项目:spring4-understanding    文件:RestTemplate.java   
/**
 * Create a new instance of the {@link RestTemplate} using default settings.
 * Default {@link HttpMessageConverter}s are initialized.
 */
public RestTemplate() {
    this.messageConverters.add(new ByteArrayHttpMessageConverter());
    this.messageConverters.add(new StringHttpMessageConverter());
    this.messageConverters.add(new ResourceHttpMessageConverter());
    this.messageConverters.add(new SourceHttpMessageConverter<Source>());
    this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());

    if (romePresent) {
        this.messageConverters.add(new AtomFeedHttpMessageConverter());
        this.messageConverters.add(new RssChannelHttpMessageConverter());
    }

    if (jackson2XmlPresent) {
        this.messageConverters.add(new MappingJackson2XmlHttpMessageConverter());
    }
    else if (jaxb2Present) {
        this.messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
    }

    if (jackson2Present) {
        this.messageConverters.add(new MappingJackson2HttpMessageConverter());
    }
    else if (gsonPresent) {
        this.messageConverters.add(new GsonHttpMessageConverter());
    }
}
项目:WebIDE-Backend    文件:WebConfig.java   
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    converters.add(new ResourceHttpMessageConverter());

    GsonHttpMessageConverter converter = new GsonHttpMessageConverter();

    converter.setGson(gson());
    converters.add(converter);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RestTemplateBuilderTests.java   
@Test
public void messageConvertersShouldReplaceExisting() throws Exception {
    RestTemplate template = this.builder
            .messageConverters(new ResourceHttpMessageConverter())
            .messageConverters(Collections.singleton(this.messageConverter)).build();
    assertThat(template.getMessageConverters()).containsOnly(this.messageConverter);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RestTemplateBuilderTests.java   
@Test
public void additionalMessageConvertersShouldAddToExisting() throws Exception {
    HttpMessageConverter<?> resourceConverter = new ResourceHttpMessageConverter();
    RestTemplate template = this.builder.messageConverters(resourceConverter)
            .additionalMessageConverters(this.messageConverter).build();
    assertThat(template.getMessageConverters()).containsOnly(resourceConverter,
            this.messageConverter);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:HttpMessageConvertersTests.java   
@Test
public void containsDefaults() throws Exception {
    HttpMessageConverters converters = new HttpMessageConverters();
    List<Class<?>> converterClasses = new ArrayList<Class<?>>();
    for (HttpMessageConverter<?> converter : converters) {
        converterClasses.add(converter.getClass());
    }
    assertThat(converterClasses).containsExactly(ByteArrayHttpMessageConverter.class,
            StringHttpMessageConverter.class, ResourceHttpMessageConverter.class,
            SourceHttpMessageConverter.class,
            AllEncompassingFormHttpMessageConverter.class,
            MappingJackson2HttpMessageConverter.class,
            MappingJackson2XmlHttpMessageConverter.class);
}
项目:java-platform    文件:WebConfiguration.java   
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    StringHttpMessageConverter stringConverter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
    stringConverter.setWriteAcceptCharset(false);

    converters.add(new ByteArrayHttpMessageConverter());
    converters.add(stringConverter);
    converters.add(new ResourceHttpMessageConverter());
    converters.add(new SourceHttpMessageConverter<Source>());
    converters.add(new AllEncompassingFormHttpMessageConverter());
}
项目:spring-boot-concourse    文件:RestTemplateBuilderTests.java   
@Test
public void messageConvertersShouldReplaceExisting() throws Exception {
    RestTemplate template = this.builder
            .messageConverters(new ResourceHttpMessageConverter())
            .messageConverters(Collections.singleton(this.messageConverter)).build();
    assertThat(template.getMessageConverters()).containsOnly(this.messageConverter);
}
项目:spring-boot-concourse    文件:RestTemplateBuilderTests.java   
@Test
public void additionalMessageConvertersShouldAddToExisting() throws Exception {
    HttpMessageConverter<?> resourceConverter = new ResourceHttpMessageConverter();
    RestTemplate template = this.builder.messageConverters(resourceConverter)
            .additionalMessageConverters(this.messageConverter).build();
    assertThat(template.getMessageConverters()).containsOnly(resourceConverter,
            this.messageConverter);
}
项目:spring-boot-concourse    文件:HttpMessageConvertersTests.java   
@Test
public void containsDefaults() throws Exception {
    HttpMessageConverters converters = new HttpMessageConverters();
    List<Class<?>> converterClasses = new ArrayList<Class<?>>();
    for (HttpMessageConverter<?> converter : converters) {
        converterClasses.add(converter.getClass());
    }
    assertThat(converterClasses).containsExactly(ByteArrayHttpMessageConverter.class,
            StringHttpMessageConverter.class, ResourceHttpMessageConverter.class,
            SourceHttpMessageConverter.class,
            AllEncompassingFormHttpMessageConverter.class,
            MappingJackson2HttpMessageConverter.class,
            MappingJackson2XmlHttpMessageConverter.class);
}
项目:cft    文件:ExternalRestTemplate.java   
protected List<HttpMessageConverter<?>> getHttpMessageConverters() {
    List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
    messageConverters.add(new ByteArrayHttpMessageConverter());
    messageConverters.add(new StringHttpMessageConverter());
    messageConverters.add(new ResourceHttpMessageConverter());
    messageConverters.add(new MappingJackson2HttpMessageConverter());
    return messageConverters;
}
项目:ShoppingMall    文件:RestTemplate.java   
public static void init(List<HttpMessageConverter<?>> messageConverters) {
    messageConverters.add(new ByteArrayHttpMessageConverter());
    messageConverters.add(new StringHttpMessageConverter());
    messageConverters.add(new ResourceHttpMessageConverter());

    // if javax.xml.transform is not available, fall back to standard Form message converter
    if (javaxXmlTransformPresent) {
        messageConverters.add(new SourceHttpMessageConverter<Source>());
        messageConverters.add(new XmlAwareFormHttpMessageConverter());
    } else {
        messageConverters.add(new FormHttpMessageConverter());
    }

    if (simpleXmlPresent) {
        messageConverters.add(new SimpleXmlHttpMessageConverter());
    }

    if (jackson2Present) {
        messageConverters.add(new MappingJackson2HttpMessageConverter());
    } else if (jacksonPresent) {
        messageConverters.add(new MappingJacksonHttpMessageConverter());
    }

    if (romePresent) {
        messageConverters.add(new SyndFeedHttpMessageConverter());
    }
}
项目:nakadi    文件:WebConfig.java   
@Override
protected void configureMessageConverters(final List<HttpMessageConverter<?>> converters) {
    final StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
    stringConverter.setWriteAcceptCharset(false);

    converters.add(new ByteArrayHttpMessageConverter());
    converters.add(stringConverter);
    converters.add(new ResourceHttpMessageConverter());
    converters.add(new SourceHttpMessageConverter<>());

    converters.add(mappingJackson2HttpMessageConverter());
    super.configureMessageConverters(converters);
}
项目:onboard    文件:NetServiceImpl.java   
@PostConstruct
public void init() {
    restTemplate = new RestTemplate();

    restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
    restTemplate.getMessageConverters().add(new FormHttpMessageConverter());
    restTemplate.getMessageConverters().add(new ResourceHttpMessageConverter());
    requestConfig = RequestConfig.custom().setSocketTimeout(TIME_OUT).setConnectTimeout(TIME_OUT).build();
}
项目:wit-java-client    文件:WitTemplate.java   
@Override
protected List<HttpMessageConverter<?>> getMessageConverters() {
    List<HttpMessageConverter<?>> messageConverters = super
            .getMessageConverters();
    messageConverters.add(new ResourceHttpMessageConverter());
    return messageConverters;
}
项目:sdk-rest    文件:RestTemplateFactory.java   
private static RestTemplate createRestTemplate() {
    List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
    messageConverters.add(new ByteArrayHttpMessageConverter());
    messageConverters.add(new StringHttpMessageConverter(Charset.forName("UTF-8")));
    messageConverters.add(new ResourceHttpMessageConverter());
    messageConverters.add(new SourceHttpMessageConverter<Source>());
    messageConverters.add(new AllEncompassingFormHttpMessageConverter());
    messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
    messageConverters.add(new MappingJackson2HttpMessageConverter());

    return new RestTemplate(messageConverters);
}
项目:mybus    文件:WebApplicationConfig.java   
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
    stringConverter.setWriteAcceptCharset(false);
    converters.add(new ByteArrayHttpMessageConverter());
    converters.add(stringConverter);
    converters.add(new ResourceHttpMessageConverter());
    converters.add(new SourceHttpMessageConverter<Source>());
    converters.add(new AllEncompassingFormHttpMessageConverter());

    converters.add(mappingJackson2HttpMessageConverter());
    super.configureMessageConverters(converters);
}
项目:orchidae    文件:WebMvcConfig.java   
@Override
public void configureMessageConverters( List<HttpMessageConverter<?>> converters )
{
    converters.add( entityConverter( factory ) );
    converters.add( new StringHttpMessageConverter( Charsets.UTF_8 ) );
    converters.add( new ResourceHttpMessageConverter() );
    // converters.add(new ByteArrayHttpMessageConverter());
    super.configureMessageConverters( converters );
}
项目:class-guard    文件:AnnotationDrivenBeanDefinitionParser.java   
private ManagedList<?> getMessageConverters(Element element, Object source, ParserContext parserContext) {
    Element convertersElement = DomUtils.getChildElementByTagName(element, "message-converters");
    ManagedList<? super Object> messageConverters = new ManagedList<Object>();
    if (convertersElement != null) {
        messageConverters.setSource(source);
        for (Element beanElement : DomUtils.getChildElementsByTagName(convertersElement, "bean", "ref")) {
            Object object = parserContext.getDelegate().parsePropertySubElement(beanElement, null);
            messageConverters.add(object);
        }
    }

    if (convertersElement == null || Boolean.valueOf(convertersElement.getAttribute("register-defaults"))) {
        messageConverters.setSource(source);
        messageConverters.add(createConverterDefinition(ByteArrayHttpMessageConverter.class, source));

        RootBeanDefinition stringConverterDef = createConverterDefinition(StringHttpMessageConverter.class, source);
        stringConverterDef.getPropertyValues().add("writeAcceptCharset", false);
        messageConverters.add(stringConverterDef);

        messageConverters.add(createConverterDefinition(ResourceHttpMessageConverter.class, source));
        messageConverters.add(createConverterDefinition(SourceHttpMessageConverter.class, source));
        messageConverters.add(createConverterDefinition(AllEncompassingFormHttpMessageConverter.class, source));

        if (romePresent) {
            messageConverters.add(createConverterDefinition(AtomFeedHttpMessageConverter.class, source));
            messageConverters.add(createConverterDefinition(RssChannelHttpMessageConverter.class, source));
        }
        if (jaxb2Present) {
            messageConverters.add(createConverterDefinition(Jaxb2RootElementHttpMessageConverter.class, source));
        }
        if (jackson2Present) {
            messageConverters.add(createConverterDefinition(MappingJackson2HttpMessageConverter.class, source));
        }
        else if (jacksonPresent) {
            messageConverters.add(createConverterDefinition(MappingJacksonHttpMessageConverter.class, source));
        }
    }
    return messageConverters;
}
项目:class-guard    文件:RequestPartIntegrationTests.java   
@Before
public void setUp() {
    AllEncompassingFormHttpMessageConverter converter = new AllEncompassingFormHttpMessageConverter();
    converter.setPartConverters(Arrays.<HttpMessageConverter<?>>asList(
            new ResourceHttpMessageConverter(), new MappingJacksonHttpMessageConverter()));

    restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory());
    restTemplate.setMessageConverters(Arrays.<HttpMessageConverter<?>>asList(converter));
}
项目:class-guard    文件:AnnotationDrivenBeanDefinitionParserTests.java   
@SuppressWarnings("unchecked")
private void verifyMessageConverters(Object bean, boolean hasDefaultRegistrations) {
    assertNotNull(bean);
    Object value = new DirectFieldAccessor(bean).getPropertyValue("messageConverters");
    assertNotNull(value);
    assertTrue(value instanceof List);
    List<HttpMessageConverter<?>> converters = (List<HttpMessageConverter<?>>) value;
    if (hasDefaultRegistrations) {
        assertTrue("Default converters are registered in addition to custom ones", converters.size() > 2);
    } else {
        assertTrue("Default converters should not be registered", converters.size() == 2);
    }
    assertTrue(converters.get(0) instanceof StringHttpMessageConverter);
    assertTrue(converters.get(1) instanceof ResourceHttpMessageConverter);
}
项目:class-guard    文件:RestTemplate.java   
/**
 * Create a new instance of the {@link RestTemplate} using default settings.
 * Default {@link HttpMessageConverter}s are initialized.
 */
public RestTemplate() {
    this.messageConverters.add(new ByteArrayHttpMessageConverter());
    this.messageConverters.add(new StringHttpMessageConverter());
    this.messageConverters.add(new ResourceHttpMessageConverter());
    this.messageConverters.add(new SourceHttpMessageConverter<Source>());
    this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());

    if (romePresent) {
        this.messageConverters.add(new AtomFeedHttpMessageConverter());
        this.messageConverters.add(new RssChannelHttpMessageConverter());
    }
    if (jaxb2Present) {
        this.messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
    }
    if (jackson2Present) {
        this.messageConverters.add(new MappingJackson2HttpMessageConverter());
    }
    else if (jacksonPresent) {
        this.messageConverters.add(new MappingJacksonHttpMessageConverter());
    }
}
项目:XPagesExtensionLibrary    文件:RestUtil.java   
private List<HttpMessageConverter<?>> getHttpMessageConverters() {
    List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
    messageConverters.add(new ByteArrayHttpMessageConverter());
    messageConverters.add(new StringHttpMessageConverter());
    messageConverters.add(new ResourceHttpMessageConverter());
    messageConverters.add(new UploadApplicationPayloadHttpMessageConverter());
    messageConverters.add(getFormHttpMessageConverter());
    messageConverters.add(new MappingJacksonHttpMessageConverter());
    return messageConverters;
}
项目:XPagesExtensionLibrary    文件:RestUtil.java   
private List<HttpMessageConverter<?>> getFormPartsMessageConverters() {
    List<HttpMessageConverter<?>> partConverters = new ArrayList<HttpMessageConverter<?>>();
    StringHttpMessageConverter stringConverter = new StringHttpMessageConverter();
    stringConverter.setSupportedMediaTypes(Collections.singletonList(JsonUtil.JSON_MEDIA_TYPE));
    stringConverter.setWriteAcceptCharset(false);
    partConverters.add(stringConverter);
    partConverters.add(new ResourceHttpMessageConverter());
    partConverters.add(new UploadApplicationPayloadHttpMessageConverter());
    return partConverters;
}
项目:spring-social-slideshare    文件:SlideShareTemplate.java   
protected List<HttpMessageConverter<?>> getMessageConverters() {
    List<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
    messageConverters.add(new StringHttpMessageConverter());
    messageConverters.add(new ResourceHttpMessageConverter());
    messageConverters.add(new AllEncompassingFormHttpMessageConverter());  // for multipart upload
    messageConverters.add(getXmlConverter());
    return messageConverters;
}
项目:molgenis    文件:HttpClientConfig.java   
private List<HttpMessageConverter<?>> converters()
{
    List<HttpMessageConverter<?>> result = Lists.newArrayList();
    result.add(new ByteArrayHttpMessageConverter());
    result.add(new StringHttpMessageConverter());
    result.add(new ResourceHttpMessageConverter());
    result.add(new SourceHttpMessageConverter<>());
    result.add(new AllEncompassingFormHttpMessageConverter());
    result.add(new Jaxb2RootElementHttpMessageConverter());
    result.add(gsonHttpMessageConverter);
    return result;
}
项目:molgenis    文件:MolgenisWebAppConfig.java   
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters)
{
    converters.add(gsonHttpMessageConverter);
    converters.add(new BufferedImageHttpMessageConverter());
    converters.add(new CsvHttpMessageConverter());
    converters.add(new ResourceHttpMessageConverter());
    converters.add(new StringHttpMessageConverter());
    converters.add(rdfConverter);
}