@Override
    public void handleRequest(HttpServerExchange exchange) throws Exception {
        if ( exchange.getRequestMethod() != Methods.POST ) {
            exchange.setResponseCode(404);
            exchange.endExchange();
            return;
        }
        String rpath = exchange.getRelativePath();

        StreamSourceChannel requestChannel = exchange.getRequestChannel();
        String first = exchange.getRequestHeaders().getFirst(Headers.CONTENT_LENGTH);
        int len = Integer.parseInt(first);

        // read post data.
        ByteBuffer buf = ByteBuffer.allocate(len);
        requestChannel.getReadSetter().set( streamSourceChannel -> {
                try {
                    streamSourceChannel.read(buf);
                } catch (IOException e) {
                    Log.Warn(this,e);
                }
                if ( buf.remaining() == 0 ) {
                    try {
                        requestChannel.shutdownReads();
                    } catch (IOException e) {
                        Log.Warn(this,e);
                    }
                    facade.execute( () -> requestReceived( exchange, buf.array(), rpath ) );
                }
            }
        );
        requestChannel.resumeReads();
    }
@ Override public void handleRequest ( HttpServerExchange exchange ) throws Exception { if ( exchange . getRequestMethod ( ) != Methods . POST ) { exchange . setResponseCode ( 404 ) ; exchange . endExchange ( ) ; return ; } String rpath = exchange . getRelativePath ( ) ; StreamSourceChannel requestChannel = exchange . getRequestChannel ( ) ; String first = exchange . getRequestHeaders ( ) . getFirst ( Headers . CONTENT_LENGTH ) ; int len = Integer . parseInt ( first ) ; ByteBuffer buf = ByteBuffer . allocate ( len ) ; requestChannel . getReadSetter ( ) . set ( streamSourceChannel -> { try { streamSourceChannel . read ( buf ) ; } catch ( IOException e ) { Log . Warn ( this , e ) ; } if ( buf . remaining ( ) == 0 ) { try { requestChannel . shutdownReads ( ) ; } catch ( IOException e ) { Log . Warn ( this , e ) ; } facade . execute ( ( ) -> requestReceived ( exchange , buf . array ( ) , rpath ) ) ; } } ) ; requestChannel . resumeReads ( ) ; }
if relpath is empty, this is considered as a connect/open and a session id is sent back.
Else /sessionId/sequ or just /sessionId is expected
posted content might contain an authentication information related object

@param exchange
@throws Exception