Package org.springframework.http.converter

Examples of org.springframework.http.converter.ByteArrayHttpMessageConverter


    super(false);

    // See SPR-7316
    StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
    stringHttpMessageConverter.setWriteAcceptCharset(false);
    this.messageConverters = new HttpMessageConverter[]{new ByteArrayHttpMessageConverter(), stringHttpMessageConverter,
        new SourceHttpMessageConverter(), new XmlAwareFormHttpMessageConverter()};
  }
View Full Code Here


   * @return a RestTemplate that is able of retrieving raw byte streams and authenticating
   * via NTLM.
   */
    @Bean
    public RestTemplate getRestTemplate(List<HttpMessageConverter<?>> messageConverters) {
      messageConverters.add(new ByteArrayHttpMessageConverter());
      final CredentialsProvider credsProv = new BasicCredentialsProvider();
      credsProv.setCredentials(
          AuthScope.ANY,
          new NTCredentials(username, password, null, null)
      );
View Full Code Here

    }
  }

  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());
View Full Code Here

    MockHttpServletResponse response = new MockHttpServletResponse();
    ServletWebRequest webRequest = new ServletWebRequest(request, response);

    MethodParameter returnType = new MethodParameter(this.getClass().getMethod("handle"), -1);

    List<HttpMessageConverter<?>> converters = Arrays.<HttpMessageConverter<?>>asList(new ByteArrayHttpMessageConverter());
    HttpEntityMethodProcessor processor = new HttpEntityMethodProcessor(converters);
    processor.handleReturnValue(responseEntity, returnType, new ModelAndViewContainer(), webRequest);

    assertEquals("no-cache", response.getHeader("Cache-Control"));
  }
View Full Code Here

  /**
   * 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());

View Full Code Here

    StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
    stringHttpMessageConverter.setWriteAcceptCharset(false); // See SPR-7316

    this.messageConverters = new ArrayList<HttpMessageConverter<?>>();
    this.messageConverters.add(new ByteArrayHttpMessageConverter());
    this.messageConverters.add(stringHttpMessageConverter);
    this.messageConverters.add(new SourceHttpMessageConverter<Source>());
    this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
  }
View Full Code Here

  public ExceptionHandlerExceptionResolver() {
    StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
    stringHttpMessageConverter.setWriteAcceptCharset(false); // See SPR-7316

    this.messageConverters = new ArrayList<HttpMessageConverter<?>>();
    this.messageConverters.add(new ByteArrayHttpMessageConverter());
    this.messageConverters.add(stringHttpMessageConverter);
    this.messageConverters.add(new SourceHttpMessageConverter<Source>());
    this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
  }
View Full Code Here

    // See SPR-7316
    StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
    stringHttpMessageConverter.setWriteAcceptCharset(false);
    this.messageConverters = new HttpMessageConverter<?>[] {
      new ByteArrayHttpMessageConverter(), stringHttpMessageConverter,
      new SourceHttpMessageConverter<Source>(),
      new org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter() };
  }
View Full Code Here

   */
  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());

View Full Code Here

  }

  @Test
  public void handleReturnValueString() throws Exception {
    List<HttpMessageConverter<?>>converters = new ArrayList<HttpMessageConverter<?>>();
    converters.add(new ByteArrayHttpMessageConverter());
    converters.add(new StringHttpMessageConverter());

    RequestResponseBodyMethodProcessor processor = new RequestResponseBodyMethodProcessor(converters);
    processor.handleReturnValue("Foo", returnTypeString, mavContainer, webRequest);
View Full Code Here

TOP

Related Classes of org.springframework.http.converter.ByteArrayHttpMessageConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.