Author: hlship
Date: Fri Sep 26 01:57:29 2008
New Revision: 699227
URL: http://svn.apache.org/viewvc?rev=699227&view=rev
Log:
TAP5-235: The Tapestry Exception Report page should set a response status of
SC_INTERNAL_SERVER_ERROR
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResponseImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/test/TestableResponseImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Response.java
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java?rev=699227&r1=699226&r2=699227&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
Fri Sep 26 01:57:29 2008
@@ -22,8 +22,10 @@
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
import org.apache.tapestry5.services.ExceptionReporter;
import org.apache.tapestry5.services.Request;
+import org.apache.tapestry5.services.Response;
import org.apache.tapestry5.services.Session;
+import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -62,6 +64,14 @@
private final String pathSeparator =
System.getProperty(PATH_SEPARATOR_PROPERTY);
+ @Inject
+ private Response response;
+
+ void setupRender()
+ {
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+
public void reportException(Throwable exception)
{
rootException = exception;
@@ -108,5 +118,4 @@
return getPropertyValue().split(pathSeparator);
}
-
}
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResponseImpl.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResponseImpl.java?rev=699227&r1=699226&r2=699227&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResponseImpl.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ResponseImpl.java
Fri Sep 26 01:57:29 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -71,6 +71,11 @@
sendRedirect(redirectURL);
}
+ public void setStatus(int sc)
+ {
+ response.setStatus(sc);
+ }
+
public OutputStream getOutputStream(String contentType) throws IOException
{
notBlank(contentType, "contentType");
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/test/TestableResponseImpl.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/test/TestableResponseImpl.java?rev=699227&r1=699226&r2=699227&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/test/TestableResponseImpl.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/test/TestableResponseImpl.java
Fri Sep 26 01:57:29 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -85,6 +85,10 @@
this.link = link;
}
+ public void setStatus(int sc)
+ {
+ }
+
public String encodeRedirectURL(String URL)
{
return URL;
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Response.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Response.java?rev=699227&r1=699226&r2=699227&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Response.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Response.java
Fri Sep 26 01:57:29 2008
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2008 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -57,6 +57,15 @@
void sendRedirect(Link link) throws IOException;
/**
+ * Sets the status code for this response. This method is used to set the
return status code when there is no error
+ * (for example, for the status codes SC_OK or SC_MOVED_TEMPORARILY). If
there is an error, and the caller wishes
+ * to invoke an error-page defined in the web applicaion, the
<code>sendError</code> method should be used instead.
+ *
+ * @param sc the status code
+ */
+ public void setStatus(int sc);
+
+ /**
* Sends an error response to the client using the specified status. The
server defaults to creating the response to
* look like an HTML-formatted server error page containing the specified
message, setting the content type to
* "text/html", leaving cookies and other headers unmodified. If an
error-page declaration has been made for the web