Skip to content

Commit

Permalink
Avoiding a second call to request.getHeader()
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcio Lima committed Nov 21, 2014
1 parent d63f531 commit 58eac50
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ private void validateIfCdiIsFound() throws ServletException {
* 5. The request MUST contain an |Upgrade| header field whose value MUST include the "websocket" keyword.
*/
private boolean isWebsocketRequest(HttpServletRequest request) {
return request.getHeader("Upgrade") != null && request.getHeader("Upgrade").toLowerCase().contains("websocket");
String upgradeHeader = request.getHeader("Upgrade");
return upgradeHeader != null && upgradeHeader.toLowerCase().contains("websocket");
}

}

0 comments on commit 58eac50

Please sign in to comment.