Author: ivol37 at gmail.com
Date: Fri Dec 24 11:16:31 2010
New Revision: 545
Log:
[AMDATU-233] The problem was that a max-age cache header was set on the
retrieve all gadgets REST url. These gadgets contain the security token of the
user. As the result of this call was cached, log out/log in would have no
effect on the security tokens in these gadgets. Fixed by changing cache header
to no-cache.
Modified:
trunk/amdatu-opensocial/gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/service/GadgetManagementServiceImpl.java
Modified:
trunk/amdatu-opensocial/gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/service/GadgetManagementServiceImpl.java
==============================================================================
---
trunk/amdatu-opensocial/gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/service/GadgetManagementServiceImpl.java
(original)
+++
trunk/amdatu-opensocial/gadgetmanagement/src/main/java/org/amdatu/opensocial/gadgetmanagement/service/GadgetManagementServiceImpl.java
Fri Dec 24 11:16:31 2010
@@ -88,7 +88,7 @@
// Timeout for retrieving gadget specs
private final static int GADGETSPEC_READ_TIMEOUT = 5000;
- // Timeout of the gadgetspec cache in milleseconds; when the gadgetspec in
the cache is older then this it will
+ // Timeout of the gadgetspec cache in milliseconds; when the gadgetspec in
the cache is older then this it will
// be removed from the cache. Default is 15 minutes.
private final static int GADGETSPEC_CACHE_TIMEOUT = 15 * 60 * 1000;
@@ -164,7 +164,7 @@
@Produces({MediaType.TEXT_PLAIN})
public String status() {
return "Gadget management service online";
- }
+ }
public boolean addGadget(GadgetDefinition gadget) {
return m_gadgetStore.addGadget(gadget);
@@ -268,7 +268,7 @@
catch (BlobCrypterException e) {
m_logService.log(LogService.LOG_ERROR, errorMsg, e);
}
- return Response.ok(jsonObject.toString(),
MediaType.APPLICATION_JSON_TYPE).cacheControl(m_maxAgeCacheControl).build();
+ return Response.ok(jsonObject.toString(),
MediaType.APPLICATION_JSON_TYPE).cacheControl(m_noCacheControl).build();
}
/**
@@ -684,7 +684,7 @@
public GadgetCategory[] getCategories() {
return m_gadgetStore.getCategories();
}
-
+
private String getUserNameFromRequest(HttpServletRequest request) {
String token = m_tokenProvider.getTokenFromRequest(request);
if (token != null) {
@@ -692,7 +692,7 @@
Map<String, String> attributes =
m_tokenProvider.verifyToken(token);
if (attributes.containsKey(TokenProvider.USERNAME)) {
return attributes.get(TokenProvider.USERNAME);
- }
+ }
}
catch (TokenProviderException e) {
// Ignore invalid tokens