Polishing

This commit is contained in:
Juergen Hoeller
2015-05-11 18:05:09 +02:00
parent 0cd7fed050
commit ce4e795f09
17 changed files with 133 additions and 115 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 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.
@@ -33,12 +33,13 @@ public interface StreamingHttpOutputMessage extends HttpOutputMessage {
*/
void setBody(Body body);
/**
* Defines the contract for bodies that can be written directly to a
* {@link OutputStream}. It is useful with HTTP client libraries that provide indirect
* access to an {@link OutputStream} via a callback mechanism.
* Defines the contract for bodies that can be written directly to an {@link OutputStream}.
* It is useful with HTTP client libraries that provide indirect access to an
* {@link OutputStream} via a callback mechanism.
*/
public interface Body {
interface Body {
/**
* Writes this body to the given {@link OutputStream}.
@@ -46,7 +47,6 @@ public interface StreamingHttpOutputMessage extends HttpOutputMessage {
* @throws IOException in case of errors
*/
void writeTo(OutputStream outputStream) throws IOException;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2015 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.
@@ -52,7 +52,7 @@ public class MaxUploadSizeExceededException extends MultipartException {
* Return the maximum upload size allowed.
*/
public long getMaxUploadSize() {
return maxUploadSize;
return this.maxUploadSize;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2015 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.
@@ -147,6 +147,28 @@ public class WebRequestDataBinderTests {
assertFalse(target.isPostProcessed());
}
@Test
public void testFieldDefaultWithNestedProperty() throws Exception {
TestBean target = new TestBean();
target.setSpouse(new TestBean());
WebRequestDataBinder binder = new WebRequestDataBinder(target);
MockHttpServletRequest request = new MockHttpServletRequest();
request.addParameter("!spouse.postProcessed", "on");
request.addParameter("_spouse.postProcessed", "visible");
request.addParameter("spouse.postProcessed", "on");
binder.bind(new ServletWebRequest(request));
assertTrue(((TestBean) target.getSpouse()).isPostProcessed());
request.removeParameter("spouse.postProcessed");
binder.bind(new ServletWebRequest(request));
assertTrue(((TestBean) target.getSpouse()).isPostProcessed());
request.removeParameter("!spouse.postProcessed");
binder.bind(new ServletWebRequest(request));
assertFalse(((TestBean) target.getSpouse()).isPostProcessed());
}
@Test
public void testFieldDefaultNonBoolean() throws Exception {
TestBean target = new TestBean();