本文整理匯總了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());
}