Upgrade to Servlet 3.1, Tomcat 8 and Jetty 9
Upgrade to latest versions of Tomcat and Jetty and to the latest Servlet API whilst will remaining compatible with Tomcat 7 and Jetty 8. Fixes gh-1832, gh-369
This commit is contained in:
@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.ObjectError;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
@@ -121,10 +122,10 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException
|
||||
}
|
||||
}
|
||||
Object message = getAttribute(requestAttributes, "javax.servlet.error.message");
|
||||
if ((message != null || errorAttributes.get("message") == null)
|
||||
if ((!StringUtils.isEmpty(message) || errorAttributes.get("message") == null)
|
||||
&& !(error instanceof BindingResult)) {
|
||||
errorAttributes.put("message", message == null ? "No message available"
|
||||
: message);
|
||||
errorAttributes.put("message",
|
||||
StringUtils.isEmpty(message) ? "No message available" : message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ public class BasicErrorControllerIntegrationTests {
|
||||
public void testErrorForMachineClient() throws Exception {
|
||||
ResponseEntity<Map> entity = new TestRestTemplate().getForEntity(
|
||||
"http://localhost:" + this.port, Map.class);
|
||||
assertThat(entity.getBody().toString(), endsWith("status=500, "
|
||||
+ "error=Internal Server Error, "
|
||||
+ "exception=java.lang.IllegalStateException, "
|
||||
+ "message=Server Error, " + "path=/}"));
|
||||
String body = entity.getBody().toString();
|
||||
assertThat(body, endsWith("status=500, " + "error=Internal Server Error, "
|
||||
+ "exception=java.lang.IllegalStateException, " + "message=Expected!, "
|
||||
+ "path=/}"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -128,7 +128,8 @@ public class BasicErrorControllerMockMvcTests {
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.class,
|
||||
@Import({ EmbeddedServletContainerAutoConfiguration.EmbeddedTomcat.class,
|
||||
EmbeddedServletContainerAutoConfiguration.class,
|
||||
ServerPropertiesAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class,
|
||||
|
||||
Reference in New Issue
Block a user