org.apache.coyote.RequestInfo Java Examples
The following examples show how to use
org.apache.coyote.RequestInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractAccessLogValve.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Override public void addElement(CharArrayWriter buf, Date date, Request request, Response response, long time) { RequestInfo info = request.getCoyoteRequest().getRequestProcessor(); if(info != null) { buf.append(info.getWorkerThreadName()); } else { buf.append("-"); } }
Example #2
Source File: AccessLogValve.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
@Override public void addElement(StringBuilder buf, Date date, Request request, Response response, long time) { RequestInfo info = request.getCoyoteRequest().getRequestProcessor(); if(info != null) { buf.append(info.getWorkerThreadName()); } else { buf.append("-"); } }
Example #3
Source File: AbstractHttp11Processor.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
@Override public SocketState asyncDispatch(SocketStatus status) { RequestInfo rp = request.getRequestProcessor(); try { rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE); if (!getAdapter().asyncDispatch(request, response, status)) { setErrorState(ErrorState.CLOSE_NOW, null); } resetTimeouts(); } catch (InterruptedIOException e) { setErrorState(ErrorState.CLOSE_NOW, e); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); setErrorState(ErrorState.CLOSE_NOW, t); getLog().error(sm.getString("http11processor.request.process"), t); } finally { if (getErrorState().isError()) { // 500 - Internal Server Error response.setStatus(500); adapter.log(request, response, 0); } } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); if (getErrorState().isError()) { return SocketState.CLOSED; } else if (isAsync()) { return SocketState.LONG; } else { if (!keepAlive) { return SocketState.CLOSED; } else { getInputBuffer().nextRequest(); getOutputBuffer().nextRequest(); return SocketState.OPEN; } } }
Example #4
Source File: Http11AprProcessor.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
/** * Process pipelined HTTP requests using the specified input and output * streams. * * @throws IOException error during an I/O operation */ @Override public SocketState event(SocketStatus status) throws IOException { RequestInfo rp = request.getRequestProcessor(); try { rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE); if (!getAdapter().event(request, response, status)) { setErrorState(ErrorState.CLOSE_NOW, null); } } catch (InterruptedIOException e) { setErrorState(ErrorState.CLOSE_NOW, e); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); // 500 - Internal Server Error response.setStatus(500); setErrorState(ErrorState.CLOSE_NOW, t); getAdapter().log(request, response, 0); log.error(sm.getString("http11processor.request.process"), t); } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); if (getErrorState().isError() || status==SocketStatus.STOP) { return SocketState.CLOSED; } else if (!comet) { inputBuffer.nextRequest(); outputBuffer.nextRequest(); return SocketState.OPEN; } else { return SocketState.LONG; } }
Example #5
Source File: AccessLogValve.java From tomcatsrc with Apache License 2.0 | 5 votes |
@Override public void addElement(StringBuilder buf, Date date, Request request, Response response, long time) { RequestInfo info = request.getCoyoteRequest().getRequestProcessor(); if(info != null) { buf.append(info.getWorkerThreadName()); } else { buf.append("-"); } }
Example #6
Source File: Http11AprProcessor.java From tomcatsrc with Apache License 2.0 | 5 votes |
/** * Process pipelined HTTP requests using the specified input and output * streams. * * @throws IOException error during an I/O operation */ @Override public SocketState event(SocketStatus status) throws IOException { RequestInfo rp = request.getRequestProcessor(); try { rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE); if (!getAdapter().event(request, response, status)) { setErrorState(ErrorState.CLOSE_NOW, null); } } catch (InterruptedIOException e) { setErrorState(ErrorState.CLOSE_NOW, e); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); // 500 - Internal Server Error response.setStatus(500); setErrorState(ErrorState.CLOSE_NOW, t); getAdapter().log(request, response, 0); log.error(sm.getString("http11processor.request.process"), t); } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); if (getErrorState().isError() || status==SocketStatus.STOP) { return SocketState.CLOSED; } else if (!comet) { inputBuffer.nextRequest(); outputBuffer.nextRequest(); return SocketState.OPEN; } else { return SocketState.LONG; } }
Example #7
Source File: MongoAccessLogValve.java From tomcat-mongo-access-log with Apache License 2.0 | 5 votes |
@Override public void addElement(StringBuilder buf, DBObject result, Date date, Request request, Response response, long time) { RequestInfo info = request.getCoyoteRequest().getRequestProcessor(); if(info != null) { result.put("thread", info.getWorkerThreadName()); } else { result.put("thread","-"); } }
Example #8
Source File: AsyncContextImpl.java From Tomcat8-Source-Read with MIT License | 4 votes |
private void logDebug(String method) { String rHashCode; String crHashCode; String rpHashCode; String stage; StringBuilder uri = new StringBuilder(); if (request == null) { rHashCode = "null"; crHashCode = "null"; rpHashCode = "null"; stage = "-"; uri.append("N/A"); } else { rHashCode = Integer.toHexString(request.hashCode()); org.apache.coyote.Request coyoteRequest = request.getCoyoteRequest(); if (coyoteRequest == null) { crHashCode = "null"; rpHashCode = "null"; stage = "-"; } else { crHashCode = Integer.toHexString(coyoteRequest.hashCode()); RequestInfo rp = coyoteRequest.getRequestProcessor(); if (rp == null) { rpHashCode = "null"; stage = "-"; } else { rpHashCode = Integer.toHexString(rp.hashCode()); stage = Integer.toString(rp.getStage()); } } uri.append(request.getRequestURI()); if (request.getQueryString() != null) { uri.append('?'); uri.append(request.getQueryString()); } } String threadName = Thread.currentThread().getName(); int len = threadName.length(); if (len > 20) { threadName = threadName.substring(len - 20, len); } String msg = String.format( "Req: %1$8s CReq: %2$8s RP: %3$8s Stage: %4$s " + "Thread: %5$20s State: %6$20s Method: %7$11s URI: %8$s", rHashCode, crHashCode, rpHashCode, stage, threadName, "N/A", method, uri); if (log.isTraceEnabled()) { log.trace(msg, new DebugException()); } else { log.debug(msg); } }
Example #9
Source File: AsyncContextImpl.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
private void logDebug(String method) { String rHashCode; String crHashCode; String rpHashCode; String stage; StringBuilder uri = new StringBuilder(); if (request == null) { rHashCode = "null"; crHashCode = "null"; rpHashCode = "null"; stage = "-"; uri.append("N/A"); } else { rHashCode = Integer.toHexString(request.hashCode()); org.apache.coyote.Request coyoteRequest = request.getCoyoteRequest(); if (coyoteRequest == null) { crHashCode = "null"; rpHashCode = "null"; stage = "-"; } else { crHashCode = Integer.toHexString(coyoteRequest.hashCode()); RequestInfo rp = coyoteRequest.getRequestProcessor(); if (rp == null) { rpHashCode = "null"; stage = "-"; } else { rpHashCode = Integer.toHexString(rp.hashCode()); stage = Integer.toString(rp.getStage()); } } uri.append(request.getRequestURI()); if (request.getQueryString() != null) { uri.append('?'); uri.append(request.getQueryString()); } } String threadName = Thread.currentThread().getName(); int len = threadName.length(); if (len > 20) { threadName = threadName.substring(len - 20, len); } String msg = String.format( "Req: %1$8s CReq: %2$8s RP: %3$8s Stage: %4$s " + "Thread: %5$20s State: %6$20s Method: %7$11s URI: %8$s", rHashCode, crHashCode, rpHashCode, stage, threadName, "N/A", method, uri); if (log.isTraceEnabled()) { log.trace(msg, new DebugException()); } else { log.debug(msg); } }
Example #10
Source File: AbstractAjpProcessor.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Override public SocketState asyncDispatch(SocketStatus status) { RequestInfo rp = request.getRequestProcessor(); try { rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE); if(!getAdapter().asyncDispatch(request, response, status)) { setErrorState(ErrorState.CLOSE_NOW, null); } resetTimeouts(); } catch (InterruptedIOException e) { setErrorState(ErrorState.CLOSE_NOW, e); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); setErrorState(ErrorState.CLOSE_NOW, t); getLog().error(sm.getString("http11processor.request.process"), t); } finally { if (getErrorState().isError()) { // 500 - Internal Server Error response.setStatus(500); adapter.log(request, response, 0); } } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); if (isAsync()) { if (getErrorState().isError()) { request.updateCounters(); return SocketState.CLOSED; } else { return SocketState.LONG; } } else { request.updateCounters(); if (getErrorState().isError()) { return SocketState.CLOSED; } else { return SocketState.OPEN; } } }
Example #11
Source File: Http11NioProcessor.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
/** * Process pipelined HTTP requests using the specified input and output * streams. * * @throws IOException error during an I/O operation */ @Override public SocketState event(SocketStatus status) throws IOException { long soTimeout = endpoint.getSoTimeout(); RequestInfo rp = request.getRequestProcessor(); final NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment(); try { rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE); if (!getAdapter().event(request, response, status)) { setErrorState(ErrorState.CLOSE_NOW, null); } if (!getErrorState().isError()) { if (attach != null) { attach.setComet(comet); if (comet) { Integer comettimeout = (Integer) request.getAttribute( org.apache.coyote.Constants.COMET_TIMEOUT_ATTR); if (comettimeout != null) { attach.setTimeout(comettimeout.longValue()); } } else { //reset the timeout if (keepAlive) { attach.setTimeout(keepAliveTimeout); } else { attach.setTimeout(soTimeout); } } } } } catch (InterruptedIOException e) { setErrorState(ErrorState.CLOSE_NOW, e); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); // 500 - Internal Server Error response.setStatus(500); setErrorState(ErrorState.CLOSE_NOW, t); log.error(sm.getString("http11processor.request.process"), t); getAdapter().log(request, response, 0); } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); if (getErrorState().isError() || status==SocketStatus.STOP) { return SocketState.CLOSED; } else if (!comet) { if (keepAlive) { inputBuffer.nextRequest(); outputBuffer.nextRequest(); return SocketState.OPEN; } else { return SocketState.CLOSED; } } else { return SocketState.LONG; } }
Example #12
Source File: AsyncContextImpl.java From tomcatsrc with Apache License 2.0 | 4 votes |
private void logDebug(String method) { String rHashCode; String crHashCode; String rpHashCode; String stage; StringBuilder uri = new StringBuilder(); if (request == null) { rHashCode = "null"; crHashCode = "null"; rpHashCode = "null"; stage = "-"; uri.append("N/A"); } else { rHashCode = Integer.toHexString(request.hashCode()); org.apache.coyote.Request coyoteRequest = request.getCoyoteRequest(); if (coyoteRequest == null) { crHashCode = "null"; rpHashCode = "null"; stage = "-"; } else { crHashCode = Integer.toHexString(coyoteRequest.hashCode()); RequestInfo rp = coyoteRequest.getRequestProcessor(); if (rp == null) { rpHashCode = "null"; stage = "-"; } else { rpHashCode = Integer.toHexString(rp.hashCode()); stage = Integer.toString(rp.getStage()); } } uri.append(request.getRequestURI()); if (request.getQueryString() != null) { uri.append('?'); uri.append(request.getQueryString()); } } String threadName = Thread.currentThread().getName(); int len = threadName.length(); if (len > 20) { threadName = threadName.substring(len - 20, len); } String msg = String.format( "Req: %1$8s CReq: %2$8s RP: %3$8s Stage: %4$s " + "Thread: %5$20s State: %6$20s Method: %7$11s URI: %8$s", rHashCode, crHashCode, rpHashCode, stage, threadName, "N/A", method, uri); if (log.isTraceEnabled()) { log.trace(msg, new DebugException()); } else { log.debug(msg); } }
Example #13
Source File: AbstractAjpProcessor.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Override public SocketState asyncDispatch(SocketStatus status) { RequestInfo rp = request.getRequestProcessor(); try { rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE); if(!getAdapter().asyncDispatch(request, response, status)) { setErrorState(ErrorState.CLOSE_NOW, null); } resetTimeouts(); } catch (InterruptedIOException e) { setErrorState(ErrorState.CLOSE_NOW, e); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); setErrorState(ErrorState.CLOSE_NOW, t); getLog().error(sm.getString("http11processor.request.process"), t); } finally { if (getErrorState().isError()) { // 500 - Internal Server Error response.setStatus(500); adapter.log(request, response, 0); } } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); if (isAsync()) { if (getErrorState().isError()) { request.updateCounters(); return SocketState.CLOSED; } else { return SocketState.LONG; } } else { request.updateCounters(); if (getErrorState().isError()) { return SocketState.CLOSED; } else { recycle(false); return SocketState.OPEN; } } }
Example #14
Source File: Http11NioProcessor.java From tomcatsrc with Apache License 2.0 | 4 votes |
/** * Process pipelined HTTP requests using the specified input and output * streams. * * @throws IOException error during an I/O operation */ @Override public SocketState event(SocketStatus status) throws IOException { long soTimeout = endpoint.getSoTimeout(); RequestInfo rp = request.getRequestProcessor(); final NioEndpoint.KeyAttachment attach = (NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment(); try { rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE); if (!getAdapter().event(request, response, status)) { setErrorState(ErrorState.CLOSE_NOW, null); } if (!getErrorState().isError()) { if (attach != null) { attach.setComet(comet); if (comet) { Integer comettimeout = (Integer) request.getAttribute( org.apache.coyote.Constants.COMET_TIMEOUT_ATTR); if (comettimeout != null) { attach.setTimeout(comettimeout.longValue()); } } else { //reset the timeout if (keepAlive) { attach.setTimeout(keepAliveTimeout); } else { attach.setTimeout(soTimeout); } } } } } catch (InterruptedIOException e) { setErrorState(ErrorState.CLOSE_NOW, e); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); // 500 - Internal Server Error response.setStatus(500); setErrorState(ErrorState.CLOSE_NOW, t); log.error(sm.getString("http11processor.request.process"), t); getAdapter().log(request, response, 0); } rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); if (getErrorState().isError() || status==SocketStatus.STOP) { return SocketState.CLOSED; } else if (!comet) { if (keepAlive) { inputBuffer.nextRequest(); outputBuffer.nextRequest(); return SocketState.OPEN; } else { return SocketState.CLOSED; } } else { return SocketState.LONG; } }