當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。