You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2011/07/11 10:22:14 UTC
svn commit: r1145063 -
/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
Author: mgrigorov
Date: Mon Jul 11 08:22:13 2011
New Revision: 1145063
URL: http://svn.apache.org/viewvc?rev=1145063&view=rev
Log:
WICKET-3880 Reference to a non-existing images causes IllegalStateException "ResourceResponse#setWriteCallback() must be set."
Code formatting.
No functional changes.
Modified:
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java?rev=1145063&r1=1145062&r2=1145063&view=diff
==============================================================================
--- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java (original)
+++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java Mon Jul 11 08:22:13 2011
@@ -47,8 +47,8 @@ public abstract class AbstractResource i
private static final long serialVersionUID = 1L;
/** header values that are managed internally and must not be set directly */
- public static final Set<String> INTERNAL_HEADERS;
-
+ public static final Set<String> INTERNAL_HEADERS;
+
static
{
INTERNAL_HEADERS = new HashSet<String>();
@@ -63,7 +63,7 @@ public abstract class AbstractResource i
INTERNAL_HEADERS.add("connection");
INTERNAL_HEADERS.add("content-disposition");
}
-
+
/**
* Construct.
*/
@@ -109,7 +109,7 @@ public abstract class AbstractResource i
// setting it to [PUBLIC] seems to be sexy but could potentially cache confidential
// data on public proxies for users migrating to 1.5
cacheScope = WebResponse.CacheScope.PRIVATE;
-
+
// collection of directly set response headers
headers = new HttpHeaderCollection();
}
@@ -424,6 +424,8 @@ public abstract class AbstractResource i
/**
* get custom headers
+ *
+ * @return collection of the response headers
*/
public HttpHeaderCollection getHeaders()
{
@@ -482,13 +484,13 @@ public abstract class AbstractResource i
}
/**
- * check if header is directly modifyable
+ * check if header is directly modifyable
*
* @param name
- * header name
- *
- * @throws IllegalArgumentException
- * if access is forbidden
+ * header name
+ *
+ * @throws IllegalArgumentException
+ * if access is forbidden
*/
private void checkHeaderAccess(String name)
{
@@ -496,13 +498,12 @@ public abstract class AbstractResource i
if (INTERNAL_HEADERS.contains(name))
{
- throw new IllegalArgumentException(
- "you are not allowed to directly access header [" + name + "], " +
- "use one of the other specialized methods of " + getClass().getSimpleName() +
- " to get or modify its value");
+ throw new IllegalArgumentException("you are not allowed to directly access header [" +
+ name + "], " + "use one of the other specialized methods of " +
+ getClass().getSimpleName() + " to get or modify its value");
}
}
-
+
/**
* @param data
* @param attributes
@@ -579,17 +580,17 @@ public abstract class AbstractResource i
// add custom headers and values
final HttpHeaderCollection headers = data.getHeaders();
-
+
for (String name : headers.getHeaderNames())
{
checkHeaderAccess(name);
-
+
for (String value : headers.getHeaderValues(name))
{
webResponse.addHeader(name, value);
}
}
-
+
// 6. Flush the response
// This is necessary for firefox if this resource is an image, otherwise it messes up
// other images on page