Skip to content

Commit

Permalink
Port fix for 596, #611
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed Sep 20, 2012
1 parent 3ae8b42 commit f6e8480
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ public void loadAtmosphereHandlersFromPath(URLClassLoader classloader, String re
for (String className : possibleComponentsCandidate) {
try {
className = className.replace('\\', '/');
className = className.replaceFirst("^.*/(WEB-INF|target)/(test-)?classes/(.*)\\.class", "$3").replace("/", ".");
className = className.replaceFirst("^.*/(WEB-INF|target)(?:/scala-[^/]+)?/(test-)?classes/(.*)\\.class", "$3").replace("/", ".");
Class<?> clazz = classloader.loadClass(className);

if (AtmosphereHandler.class.isAssignableFrom(clazz)) {
Expand Down Expand Up @@ -1275,8 +1275,19 @@ public Action doCometSupport(AtmosphereRequest req, AtmosphereResponse res) thro

s = req.getHeader(X_ATMOSPHERE_TRACKING_ID);
if (s == null || s.equals("0")) {
s = UUID.randomUUID().toString();
res.setHeader(X_ATMOSPHERE_TRACKING_ID, s);
s = HeaderConfig.UUID.randomUUID().toString();
res.setHeader(WebSocket, s);
} else {
// This may breaks 1.0.0 application because the WebSocket's associated AtmosphereResource will
// all have the same UUID, and retrieving the original one for WebSocket, so we don't set it at all.
// Null means it is not an HTTP request.
if (req.resource() == null) {
res.setHeader(X_ATMOSPHERE_TRACKING_ID, s);
} else if (req.getAttribute(WebSocket.WEBSOCKET_INITIATED) == null){
// WebSocket reconnect, in case an application manually set the header
// (impossible to retrieve the headers normally with WebSocket or SSE)
res.setHeader(X_ATMOSPHERE_TRACKING_ID, s);
}
}

if (req.getAttribute(SUSPENDED_ATMOSPHERE_RESOURCE_UUID) == null) {
Expand Down

0 comments on commit f6e8480

Please sign in to comment.