Browse Source

Add accessor methods to HttpPutFormContentFilter

Issue: SPR-14503
pull/1316/head
Rossen Stoyanchev 9 years ago
parent
commit
77bb7e6030
  1. 20
      spring-web/src/main/java/org/springframework/web/filter/HttpPutFormContentFilter.java

20
spring-web/src/main/java/org/springframework/web/filter/HttpPutFormContentFilter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -39,6 +39,7 @@ import org.springframework.http.MediaType; @@ -39,6 +39,7 @@ import org.springframework.http.MediaType;
import org.springframework.http.converter.FormHttpMessageConverter;
import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter;
import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.util.Assert;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
@ -59,11 +60,26 @@ import org.springframework.util.MultiValueMap; @@ -59,11 +60,26 @@ import org.springframework.util.MultiValueMap;
*/
public class HttpPutFormContentFilter extends OncePerRequestFilter {
private final FormHttpMessageConverter formConverter = new AllEncompassingFormHttpMessageConverter();
private FormHttpMessageConverter formConverter = new AllEncompassingFormHttpMessageConverter();
/**
* Set the converter to use for parsing form content.
* <p>By default this is an instnace of {@link AllEncompassingFormHttpMessageConverter}.
*/
public void setFormConverter(FormHttpMessageConverter converter) {
Assert.notNull(converter, "FormHttpMessageConverter is required.");
this.formConverter = converter;
}
public FormHttpMessageConverter getFormConverter() {
return this.formConverter;
}
/**
* The default character set to use for reading form data.
* This is a shortcut for:<br>
* {@code getFormConverter.setCharset(charset)}.
*/
public void setCharset(Charset charset) {
this.formConverter.setCharset(charset);

Loading…
Cancel
Save