protected AjpAprProcessor createProcessor() { AjpAprProcessor processor = new AjpAprProcessor(proto.packetSize, proto.endpoint); processor.setAdapter(proto.adapter); processor.setTomcatAuthentication(proto.tomcatAuthentication); processor.setRequiredSecret(proto.requiredSecret); register(processor); return processor; }
if (!readMessage(requestHeaderMessage, true, keptAlive)) { prepareRequest(); } catch (Throwable t) { log.debug(sm.getString("ajpprocessor.request.prepare"), t); finish(); } catch (Throwable t) { error = true; recycle(); recycle(); return SocketState.CLOSED; } else { recycle(); return SocketState.CLOSED;
prepareResponse(); } catch (IOException e) { prepareResponse(); } catch (IOException e) { flush(); finish(); } catch (IOException e) {
/** Receive a chunk of data. Called to implement the * 'special' packet in ajp13 and to receive the data * after we send a GET_BODY packet */ public boolean receive() throws IOException { first = false; bodyMessage.reset(); readMessage(bodyMessage, false, false); // No data received. if (bodyMessage.getLen() == 0) { // just the header // Don't mark 'end of stream' for the first chunk. return false; } int blen = bodyMessage.peekInt(); if (blen == 0) { return false; } bodyMessage.getBytes(bodyBytes); empty = false; return true; }
/** * Expected to be used by the handler once the processor is no longer * required. */ @Override public void release(SocketWrapper<Long> socket, AjpAprProcessor processor, boolean isSocketClosing, boolean addToPoller) { processor.recycle(isSocketClosing); recycledProcessors.offer(processor); if (addToPoller) { ((AprEndpoint)proto.endpoint).getPoller().add( socket.getSocket().longValue(), true); } }
if (!readMessage(requestHeaderMessage, true, keptAlive)) { prepareRequest(); } catch (Throwable t) { CoyoteLogger.AJP_LOGGER.errorPreparingAjpRequest(t); finish(); } catch (Throwable t) { error = true; recycle(); recycle(); return SocketState.CLOSED; } else { recycle(); return (openSocket) ? SocketState.OPEN : SocketState.CLOSED;
prepareResponse(); } catch (IOException e) { prepareResponse(); } catch (IOException e) { flush(); finish(); } catch (IOException e) {
/** Receive a chunk of data. Called to implement the * 'special' packet in ajp13 and to receive the data * after we send a GET_BODY packet */ public boolean receive() throws IOException { first = false; bodyMessage.reset(); readMessage(bodyMessage, false, false); // No data received. if (bodyMessage.getLen() == 0) { // just the header // Don't mark 'end of stream' for the first chunk. return false; } int blen = bodyMessage.peekInt(); if (blen == 0) { return false; } bodyMessage.getBytes(bodyBytes); empty = false; return true; }
protected AjpAprProcessor createProcessor() { AjpAprProcessor processor = new AjpAprProcessor(proto.packetSize, proto.endpoint); processor.setAdapter(proto.adapter); processor.setTomcatAuthentication(proto.tomcatAuthentication); processor.setRequiredSecret(proto.requiredSecret); register(processor); return processor; }
if (!readMessage(requestHeaderMessage, true, keptAlive)) { prepareRequest(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); if (isAsync() && !error) { break; finish(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); recycle(); if (!isAsync()) { ((AprEndpoint)endpoint).getPoller().add(socketRef); recycle(); return SocketState.CLOSED; } else if (isAsync()) { return SocketState.LONG; } else { recycle(); return SocketState.OPEN;
/** * Read an AJP message. * * @param first is true if the message is the first in the request, which * will cause a short duration blocking read * @return true if the message has been read, false if the short read * didn't return anything * @throws IOException any other failure, including incomplete reads */ protected boolean readMessage(AjpMessage message, boolean first, boolean useAvailableData) throws IOException { byte[] buf = message.getBuffer(); int headerLength = message.getHeaderLength(); if (first) { if (!readt(headerLength, useAvailableData)) { return false; } } else { read(headerLength); } inputBuffer.get(message.getBuffer(), 0, headerLength); message.processHeader(); read(message.getLen()); inputBuffer.get(message.getBuffer(), headerLength, message.getLen()); return true; }
prepareResponse(); } catch (IOException e) { prepareResponse(); } catch (IOException e) { flush(); finish(); } catch (IOException e) {
/** Receive a chunk of data. Called to implement the * 'special' packet in ajp13 and to receive the data * after we send a GET_BODY packet */ public boolean receive() throws IOException { first = false; bodyMessage.reset(); readMessage(bodyMessage, false, false); // No data received. if (bodyMessage.getLen() == 0) { // just the header // Don't mark 'end of stream' for the first chunk. return false; } int blen = bodyMessage.peekInt(); if (blen == 0) { return false; } bodyMessage.getBytes(bodyBytes); empty = false; return true; }
protected AjpAprProcessor createProcessor() { AjpAprProcessor processor = new AjpAprProcessor(proto.packetSize, (AprEndpoint)proto.endpoint); processor.setAdapter(proto.adapter); processor.setTomcatAuthentication(proto.tomcatAuthentication); processor.setRequiredSecret(proto.requiredSecret); register(processor); return processor; }
if (!readMessage(requestHeaderMessage, true, keptAlive)) { if (type == Constants.JK_AJP13_CPING_REQUEST) { if (endpoint.isPaused()) { recycle(true); break; prepareRequest(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); if (isAsync() && !error) { break; finish(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); recycle(false); if (isAsync()) { return SocketState.LONG; } else {
/** * Read an AJP message. * * @param first is true if the message is the first in the request, which * will cause a short duration blocking read * @return true if the message has been read, false if the short read * didn't return anything * @throws IOException any other failure, including incomplete reads */ protected boolean readMessage(AjpMessage message, boolean first, boolean useAvailableData) throws IOException { int headerLength = message.getHeaderLength(); if (first) { if (!readt(headerLength, useAvailableData)) { return false; } } else { read(headerLength); } inputBuffer.get(message.getBuffer(), 0, headerLength); if (message.processHeader() < 0) { throw new IOException(MESSAGES.invalidAjpMessage()); } read(message.getLen()); inputBuffer.get(message.getBuffer(), headerLength, message.getLen()); return true; }