本文整理汇总了Java中org.springframework.http.converter.StringHttpMessageConverter.setWriteAcceptCharset方法的典型用法代码示例。如果您正苦于以下问题:Java StringHttpMessageConverter.setWriteAcceptCharset方法的具体用法?Java StringHttpMessageConverter.setWriteAcceptCharset怎么用?Java StringHttpMessageConverter.setWriteAcceptCharset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.http.converter.StringHttpMessageConverter
的用法示例。
在下文中一共展示了StringHttpMessageConverter.setWriteAcceptCharset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDefaultHttpMessageConverters
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
/**
* 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());
}
}
示例2: configureMessageConverters
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
@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());
}
示例3: TwitterEscapingFormHttpMessageConverter
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
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);
}
示例4: getFormPartsMessageConverters
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
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;
}
示例5: configureMessageConverters
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
// See SPR-7316,for weixin token verify.fastjson will convert string 123 to "123"
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
stringHttpMessageConverter.setWriteAcceptCharset(false);
converters.add(stringHttpMessageConverter);
converters.add(new ByteArrayHttpMessageConverter());
converters.add(fastJsonHttpMessageConverter());
}
示例6: getHttpMessageConverters
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
private List<HttpMessageConverter<?>> getHttpMessageConverters() {
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
stringHttpMessageConverter.setWriteAcceptCharset(false); // see SPR-7316
List<HttpMessageConverter<?>> converters = new ArrayList<>(4);
converters.add(new ByteArrayHttpMessageConverter());
converters.add(stringHttpMessageConverter);
converters.add(new SourceHttpMessageConverter<>());
converters.add(new AllEncompassingFormHttpMessageConverter());
return converters;
}
示例7: MultipartMixedConverter
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
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());
}
示例8: init
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
/**
* Initialize a {@code SmsService} instance.
*
* @param id The LC id
* @param key The LC key
*/
public void init(String id, String key) {
StringHttpMessageConverter converter = new StringHttpMessageConverter(Charset.forName("UTF-8"));
converter.setWriteAcceptCharset(false);
restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(0, converter);
mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
headers = new HttpHeaders();
headers.add("X-LC-Id", id);
headers.add("X-LC-Key", key);
headers.setContentType(MediaType.APPLICATION_JSON);
}
示例9: getDefaultWxMessageConverters
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
/**
* 只考虑微信的消息转换,后期可以优化
* 其实这里完全可以使用系统的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;
}
示例10: AnnotationMethodHandlerAdapter
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
public AnnotationMethodHandlerAdapter() {
// no restriction of HTTP methods by default
super(false);
// 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() };
}
示例11: ExceptionHandlerExceptionResolver
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
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());
}
示例12: RequestMappingHandlerAdapter
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
public RequestMappingHandlerAdapter() {
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
stringHttpMessageConverter.setWriteAcceptCharset(false); // see SPR-7316
this.messageConverters = new ArrayList<HttpMessageConverter<?>>(4);
this.messageConverters.add(new ByteArrayHttpMessageConverter());
this.messageConverters.add(stringHttpMessageConverter);
this.messageConverters.add(new SourceHttpMessageConverter<Source>());
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
}
示例13: getHttpMessageConverters
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
private List<HttpMessageConverter<?>> getHttpMessageConverters() {
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
stringHttpMessageConverter.setWriteAcceptCharset(false); // see SPR-7316
List<HttpMessageConverter<?>> converters = new ArrayList<>(4);
converters.add(new ByteArrayHttpMessageConverter());
converters.add(stringHttpMessageConverter);
converters.add(new SourceHttpMessageConverter<>());
converters.add(new AllEncompassingFormHttpMessageConverter());
return converters;
}
示例14: stringHttpMessageConverter
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
@Bean
@ConditionalOnMissingBean
public StringHttpMessageConverter stringHttpMessageConverter() {
StringHttpMessageConverter converter = new StringHttpMessageConverter(
this.encodingProperties.getCharset());
converter.setWriteAcceptCharset(false);
return converter;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:HttpMessageConvertersAutoConfiguration.java
示例15: configureMessageConverters
import org.springframework.http.converter.StringHttpMessageConverter; //导入方法依赖的package包/类
@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());
}