List of usage examples for javax.servlet.http HttpServletRequest hashCode
@HotSpotIntrinsicCandidate public native int hashCode();
From source file:org.piraso.web.base.PirasoFilter.java
@Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { boolean requestIsWatched = getRegistry().isWatched(new PirasoHttpServletRequest(request)); HttpResponseEntry responseEntry = new HttpResponseEntry(); try {/* w w w . j ava2s.c o m*/ if (requestIsWatched) { responseEntry.getElapseTime().start(); ReferenceRequestEntry ref = null; try { if (request.getHeader(REQUEST_ID_HEADER) != null && request.getHeader(GROUP_ID_HEADER) != null) { ref = new ReferenceRequestEntry(); ref.setRemoteAddress(request.getRemoteAddr()); ref.setRequestId(Long.valueOf(request.getHeader(REQUEST_ID_HEADER))); ref.setGroupId(request.getHeader(GROUP_ID_HEADER)); ref.setServerName(request.getRemoteHost()); } } catch (RuntimeException e) { ref = null; } response = new PirasoResponseWrapper(response, responseEntry); PirasoContext context = new PirasoContext(new PirasoHttpServletRequest(request), getRegistry(), ref); PirasoContextHolder.setContext(context); // forward a scoped context log for request entry point ContextLogDispatcher.forward(Level.SCOPED, new GroupChainId("request", request.hashCode()), WebEntryUtils.toEntry(request)); } } catch (Exception e) { LOG.warn(e.getMessage(), e); } try { chain.doFilter(request, response); } finally { if (requestIsWatched) { responseEntry.getElapseTime().stop(); // forward a scoped context log for response exit point ContextLogDispatcher.forward(Level.SCOPED, new GroupChainId("response", request.hashCode()), responseEntry); PirasoContextHolder.removeContext(); } } }
From source file:net.lightbody.bmp.proxy.jetty.jetty.servlet.AbstractSessionManager.java
private String newSessionId(HttpServletRequest request, long created) { synchronized (__allSessions) { // A requested session ID can only be used if it is in the global map of // ID but not in this contexts map. Ie it is an ID in use by another context // in this server and thus we are doing a cross context dispatch. if (_crossContextSessionIDs) { String requested_id = (String) request.getAttribute(__NEW_SESSION_ID); if (requested_id == null) requested_id = request.getRequestedSessionId(); if (requested_id != null && requested_id != null && __allSessions.containsKey(requested_id) && !_sessions.containsKey(requested_id)) return requested_id; }/*w w w .j a v a2s . c om*/ // pick a new unique ID! String id = null; while (id == null || id.length() == 0 || __allSessions.containsKey(id)) { long r = _weakRandom ? (hashCode() ^ Runtime.getRuntime().freeMemory() ^ _random.nextInt() ^ (((long) request.hashCode()) << 32)) : _random.nextLong(); r ^= created; if (request != null && request.getRemoteAddr() != null) r ^= request.getRemoteAddr().hashCode(); if (r < 0) r = -r; id = Long.toString(r, 36); String worker = (String) request.getAttribute("net.lightbody.bmp.proxy.jetty.http.ajp.JVMRoute"); if (worker != null) id += "." + worker; else if (_workerName != null) id += "." + _workerName; } return id; } }
From source file:org.browsermob.proxy.jetty.jetty.servlet.AbstractSessionManager.java
private String newSessionId(HttpServletRequest request, long created) { synchronized (__allSessions) { // A requested session ID can only be used if it is in the global map of // ID but not in this contexts map. Ie it is an ID in use by another context // in this server and thus we are doing a cross context dispatch. if (_crossContextSessionIDs) { String requested_id = (String) request.getAttribute(__NEW_SESSION_ID); if (requested_id == null) requested_id = request.getRequestedSessionId(); if (requested_id != null && requested_id != null && __allSessions.containsKey(requested_id) && !_sessions.containsKey(requested_id)) return requested_id; }// w w w . j a v a2s. c o m // pick a new unique ID! String id = null; while (id == null || id.length() == 0 || __allSessions.containsKey(id)) { long r = _weakRandom ? (hashCode() ^ Runtime.getRuntime().freeMemory() ^ _random.nextInt() ^ (((long) request.hashCode()) << 32)) : _random.nextLong(); r ^= created; if (request != null && request.getRemoteAddr() != null) r ^= request.getRemoteAddr().hashCode(); if (r < 0) r = -r; id = Long.toString(r, 36); String worker = (String) request.getAttribute("org.browsermob.proxy.jetty.http.ajp.JVMRoute"); if (worker != null) id += "." + worker; else if (_workerName != null) id += "." + _workerName; } return id; } }
From source file:org.openqa.jetty.jetty.servlet.AbstractSessionManager.java
private String newSessionId(HttpServletRequest request, long created) { synchronized (__allSessions) { // A requested session ID can only be used if it is in the global map of // ID but not in this contexts map. Ie it is an ID in use by another context // in this server and thus we are doing a cross context dispatch. if (_crossContextSessionIDs) { String requested_id = (String) request.getAttribute(__NEW_SESSION_ID); if (requested_id == null) requested_id = request.getRequestedSessionId(); if (requested_id != null && requested_id != null && __allSessions.containsKey(requested_id) && !_sessions.containsKey(requested_id)) return requested_id; }// ww w . j a v a2s . c o m // pick a new unique ID! String id = null; while (id == null || id.length() == 0 || __allSessions.containsKey(id)) { long r = _weakRandom ? (hashCode() ^ Runtime.getRuntime().freeMemory() ^ _random.nextInt() ^ (((long) request.hashCode()) << 32)) : _random.nextLong(); r ^= created; if (request != null && request.getRemoteAddr() != null) r ^= request.getRemoteAddr().hashCode(); if (r < 0) r = -r; id = Long.toString(r, 36); String worker = (String) request.getAttribute("org.openqa.jetty.http.ajp.JVMRoute"); if (worker != null) id += "." + worker; else if (_workerName != null) id += "." + _workerName; } return id; } }