private void exceptionKey(Context context, Exception e) { context.setAttribute(ProtocolFilter.SUCCESSFUL_READ, Boolean.FALSE); context.setAttribute(Context.THROWABLE, e); cancelKey(context); }
private void exceptionKey(Context context, Exception e) { context.setAttribute(ProtocolFilter.SUCCESSFUL_READ, Boolean.FALSE); context.setAttribute(Context.THROWABLE, e); cancelKey(context); }
private void exceptionKey(Context context, Exception e) { context.setAttribute(ProtocolFilter.SUCCESSFUL_READ, Boolean.FALSE); context.setAttribute(Context.THROWABLE, e); cancelKey(context); }
/** * Invoke the {@link ProtocolParser}. If more bytes are required, * register the {@link SelectionKey} back to its associated * {@link SelectorHandler} * @param ctx the Context object. * @return <tt>true</tt> if no more bytes are needed. */ protected boolean invokeProtocolParser(Context ctx, ProtocolParser parser) { if (parser == null) { throw new IllegalStateException("ProcotolParser cannot be null"); } Object o = parser.getNextMessage(); ctx.setAttribute(ProtocolParser.MESSAGE, o); return true; }
public void postProcess(Context context, PUProtocolRequest protocolRequest) { // 1) Copy decoded data to a temporary buffer ByteBuffer srcBuffer = protocolRequest.getByteBuffer(); srcBuffer.flip(); if (srcBuffer.hasRemaining()) { ByteBuffer tmpBuffer = ByteBuffer.allocate(srcBuffer.remaining()); tmpBuffer.put(srcBuffer); tmpBuffer.flip(); context.setAttribute(TMP_DECODED_BUFFER, tmpBuffer); } // 2) Copy remaining secured input bytes to the main buffer ByteBuffer inputBB = protocolRequest.getSecuredInputByteBuffer(); inputBB.flip(); srcBuffer.clear(); srcBuffer.put(inputBB); inputBB.clear(); }
public void postProcess(Context context, PUProtocolRequest protocolRequest) { // 1) Copy decoded data to a temporary buffer ByteBuffer srcBuffer = protocolRequest.getByteBuffer(); srcBuffer.flip(); if (srcBuffer.hasRemaining()) { ByteBuffer tmpBuffer = ByteBuffer.allocate(srcBuffer.remaining()); tmpBuffer.put(srcBuffer); tmpBuffer.flip(); context.setAttribute(TMP_DECODED_BUFFER, tmpBuffer); } // 2) Copy remaining secured input bytes to the main buffer ByteBuffer inputBB = protocolRequest.getSecuredInputByteBuffer(); inputBB.flip(); srcBuffer.clear(); srcBuffer.put(inputBB); inputBB.clear(); }
public void postProcess(Context context, PUProtocolRequest protocolRequest) { // 1) Copy decoded data to a temporary buffer ByteBuffer srcBuffer = protocolRequest.getByteBuffer(); srcBuffer.flip(); if (srcBuffer.hasRemaining()) { ByteBuffer tmpBuffer = ByteBuffer.allocate(srcBuffer.remaining()); tmpBuffer.put(srcBuffer); tmpBuffer.flip(); context.setAttribute(TMP_DECODED_BUFFER, tmpBuffer); } // 2) Copy remaining secured input bytes to the main buffer ByteBuffer inputBB = protocolRequest.getSecuredInputByteBuffer(); inputBB.flip(); srcBuffer.clear(); srcBuffer.put(inputBB); inputBB.clear(); }
public boolean postExecute(Context ctx) throws IOException { if (isInitilizedOk) { final ProtocolChain chain = ctx.getProtocolChain(); chain.removeFilter(this); ctx.setAttribute(ProtocolChain.PROTOCOL_CHAIN_POST_INSTRUCTION, ProtocolChainInstruction.REINVOKE); } return true; } }
byte[] requestURI = new byte[end - start]; byteBuffer.get(requestURI); context.setAttribute(HTTP_REQUEST_URL, requestURI);
byte[] requestURI = new byte[end - start]; byteBuffer.get(requestURI); context.setAttribute(HTTP_REQUEST_URL, requestURI);
} finally { if (exception != null){ ctx.setAttribute(Context.THROWABLE,exception); result = false; } else if (socketAddress == null){ result = false; } else { ctx.setAttribute(UDP_SOCKETADDRESS,socketAddress);
context.setAttribute(SSLReadFilter.SSL_PREREAD_DATA, Boolean.TRUE);
context.setAttribute(SSLReadFilter.SSL_PREREAD_DATA, Boolean.TRUE);
} finally { if (exception != null){ ctx.setAttribute(Context.THROWABLE,exception); result = false; } else {
if (ctx.getKeyRegistrationState() != Context.KeyRegistrationState.NONE){ ctx.setAttribute(ProtocolFilter.SUCCESSFUL_READ, Boolean.FALSE); invokeNextFilter = false; } finally { if (exception != null){ ctx.setAttribute(Context.THROWABLE,exception); if (protocol != UDP){ ctx.setKeyRegistrationState( invokeNextFilter = false; } else if (protocol == UDP) { ctx.setAttribute(UDP_SOCKETADDRESS,socketAddress);
} finally { if (exception != null || count == -1){ ctx.setAttribute(Context.THROWABLE,exception); ctx.setKeyRegistrationState( Context.KeyRegistrationState.CANCEL);
ctx.setAttribute(ProtocolParser.PARSER, parser); ctx.setAttribute(ProtocolParser.PARSER, parser);
if (inputStream == null){ inputStream = new ByteBufferInputStream(); ctx.setAttribute(BYTEBUFFER_INPUTSTREAM,inputStream); ctx.setAttribute(BYTE_BUFFER,byteBuffer); ctx.setAttribute(INVOKE_NEXT,"true"); copyContext.setPipeline(pipeline); } catch (Throwable t){ ctx.setAttribute(Context.THROWABLE,t); ctx.setKeyRegistrationState( Context.KeyRegistrationState.CANCEL);
&& Boolean.FALSE != (Boolean)ctx.getAttribute(ProtocolFilter.SUCCESSFUL_READ)){ ctx.setAttribute(ProtocolFilter.SUCCESSFUL_READ, Boolean.TRUE); } else {
context.setAttribute(ProtocolChain.PROTOCOL_CHAIN_POST_INSTRUCTION, ProtocolChainInstruction.REINVOKE); return true;