Add accessor methods to HttpPutFormContentFilter

Issue: SPR-14503
This commit is contained in:
Rossen Stoyanchev 2017-01-17 17:18:03 -05:00
parent 2e414ab25a
commit 8417831602
1 changed files with 18 additions and 2 deletions

View File

@ -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;
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;
*/
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);