/** * Get message converters to use for supporting legacy Micro Cloud Foundry 1.1 and older * * @return List of message converters */ private List<HttpMessageConverter<?>> getLegacyMessageConverters() { List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>(); messageConverters.add(new ByteArrayHttpMessageConverter()); messageConverters.add(new StringHttpMessageConverter()); messageConverters.add(new ResourceHttpMessageConverter()); messageConverters.add(new UploadApplicationPayloadHttpMessageConverter()); FormHttpMessageConverter formPartsMessageConverter = new CloudFoundryFormHttpMessageConverter(); List<HttpMessageConverter<?>> partConverters = new ArrayList<HttpMessageConverter<?>>(); StringHttpMessageConverter stringConverter = new StringHttpMessageConverterWithoutMediaType(); stringConverter.setWriteAcceptCharset(false); partConverters.add(stringConverter); partConverters.add(new ResourceHttpMessageConverter()); partConverters.add(new UploadApplicationPayloadHttpMessageConverter()); formPartsMessageConverter.setPartConverters(partConverters); messageConverters.add(formPartsMessageConverter); messageConverters.add(new MappingJacksonHttpMessageConverter()); return messageConverters; }
public Map<String, String> read( Class<? extends Map<String, String>> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { LinkedMultiValueMap<String, String> lmvm = new LinkedMultiValueMap<String, String>(); @SuppressWarnings("unchecked") Class<LinkedMultiValueMap<String, String>> mvmClazz = (Class<LinkedMultiValueMap<String, String>>) lmvm.getClass(); MultiValueMap<String, String> mvm = delegate.read(mvmClazz, inputMessage); return mvm.toSingleValueMap(); }
@Override protected List<HttpMessageConverter<?>> getMessageConverters() { MappingJackson2HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter(); ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(WRITE_DATES_AS_TIMESTAMPS, false); objectMapper.configure(FAIL_ON_EMPTY_BEANS, false); objectMapper.setSerializationInclusion(NON_NULL); jsonConverter.setObjectMapper(objectMapper); FormHttpMessageConverter formHttpMessageConverter = new FormHttpMessageConverter(); formHttpMessageConverter.addPartConverter(jsonConverter); List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>(); messageConverters.add(jsonConverter); messageConverters.add(new ByteArrayHttpMessageConverter()); messageConverters.add(formHttpMessageConverter); messageConverters.add(new ResourceHttpMessageConverter()); return messageConverters; }
private FormHttpMessageConverter getFormHttpMessageConverter() { FormHttpMessageConverter formPartsMessageConverter = new CloudFoundryFormHttpMessageConverter(); formPartsMessageConverter.setPartConverters(getFormPartsMessageConverters()); return formPartsMessageConverter; }
public void write(Map<String, String> t, MediaType contentType, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { MultiValueMap<String, String> mvm = new LinkedMultiValueMap<String, String>(); mvm.setAll(t); delegate.write(mvm, contentType, outputMessage); }
public List<MediaType> getSupportedMediaTypes() { return delegate.getSupportedMediaTypes(); }