Skip to content

Commit

Permalink
Fix for #1367
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed Nov 8, 2013
1 parent fceae1c commit e512717
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,28 @@ public String getHeader(String s, boolean checkCase) {
}

if (s.startsWith(X_ATMOSPHERE) && isNotNoOps()) {
name = (String) b.request.getAttribute(s);
// Craziness with Struts 2 who wraps String attribute as BigDecimal
// https://github.com/Atmosphere/atmosphere/issues/1367
Object o = b.request.getAttribute(s);
if (o == null || String.class.isAssignableFrom(o.getClass())) {
name = String.class.cast(o);
} else {
try {
if (HttpServletRequestWrapper.class.isAssignableFrom(b.request.getClass())) {
HttpServletRequest hsr = HttpServletRequestWrapper.class.cast(b.request);
while (hsr instanceof HttpServletRequestWrapper) {
hsr = (HttpServletRequest) ((HttpServletRequestWrapper) hsr).getRequest();
o = hsr.getAttribute(s);
if (o == null || String.class.isAssignableFrom(o.getClass())) {
name = String.class.cast(o);
break;
}
}
}
} catch (Exception ex) {
logger.warn("", ex);
}
}
}
}

Expand Down

0 comments on commit e512717

Please sign in to comment.