当前位置: 首页>>代码示例>>Java>>正文


Java StringHttpMessageConverter.setWriteAcceptCharset方法代码示例

本文整理汇总了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());
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:30,代码来源:WebMvcConfigurationSupport.java

示例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());
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:17,代码来源:WebMVCConfig.java

示例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);
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:12,代码来源:TwitterEscapingFormHttpMessageConverter.java

示例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;
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:11,代码来源:RestUtil.java

示例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());
}
 
开发者ID:helloworldtang,项目名称:sns-todo,代码行数:11,代码来源:WebMvcConfig.java

示例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;
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:13,代码来源:SpringParameterProvider.java

示例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());
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:14,代码来源:MultipartMixedConverter.java

示例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);
}
 
开发者ID:AwesomeTickets,项目名称:ServiceServer,代码行数:19,代码来源:SmsService.java

示例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;
}
 
开发者ID:FastBootWeixin,项目名称:FastBootWeixin,代码行数:17,代码来源:WxInvokerConfiguration.java

示例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() };
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:AnnotationMethodHandlerAdapter.java

示例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());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:ExceptionHandlerExceptionResolver.java

示例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());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:RequestMappingHandlerAdapter.java

示例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;
}
 
开发者ID:katharsis-project,项目名称:katharsis-framework,代码行数:13,代码来源:SpringParameterProvider.java

示例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());
}
 
开发者ID:xiangxik,项目名称:java-platform,代码行数:12,代码来源:WebConfiguration.java


注:本文中的org.springframework.http.converter.StringHttpMessageConverter.setWriteAcceptCharset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。