@Override public boolean restRequest(HTTPRequestReader request) { if (request.structured().isEqual(keyFieldId, PASS1)) { if (channel.publishHTTPResponse(request, 200)) { channel.requestShutdown(); hasFirstKey = true; System.out.println("first key"); return true; } } else if (hasFirstKey && request.structured().isEqual(keyFieldId, PASS2)) { if (channel.publishHTTPResponse(request, 200)) { hasSecondKey = true; System.out.println("second key"); return true; } } else { return channel.publishHTTPResponse(request, 404); } return false; }
/** * Checks to see if passed bytes are equal to field * @param association field association showing where to read * @param utf8EncodedBytes bytes to compare * @return <code>true</code> if equal, else <code>false</code> */ public boolean isEqual(Object association, byte[] utf8EncodedBytes) { return isEqual(Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).fieldLookupByIdentity(association, DataInputBlobReader.getStructType(channelReader)), utf8EncodedBytes); }
/** * Checks to see if passed bytes are equal to field * @param association field association showing where to read * @param utf8EncodedBytes bytes to compare * @return <code>true</code> if equal, else <code>false</code> */ public boolean isEqual(Object association, byte[] utf8EncodedBytes) { return isEqual(Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).fieldLookupByIdentity(association, DataInputBlobReader.getStructType(channelReader)), utf8EncodedBytes); }
/** * Checks to see if passed bytes are equal to field * @param association field association showing where to read * @param utf8EncodedBytes bytes to compare * @return <code>true</code> if equal, else <code>false</code> */ public boolean isEqual(Object association, byte[] utf8EncodedBytes) { return isEqual(Pipe.structRegistry(DataInputBlobReader.getBackingPipe(channelReader)).fieldLookupByIdentity(association, DataInputBlobReader.getStructType(channelReader)), utf8EncodedBytes); }
@Override public boolean restRequest(HTTPRequestReader request) { if (request.structured().isEqual(keyFieldId, pass)) { if (!responseService.hasRoomFor(2)) {//reponse then shutdown return false; } if (responseService.publishHTTPResponse(request, 200)) { responseService.requestShutdown(); return true; } return false; } else { if (responseService.publishHTTPResponse(request, 404)) { return true; } return false; } }
@Override public boolean restRequest(HTTPRequestReader request) { if (request.structured().isEqual(Field.KEY, pass)) { if (!responseService.hasRoomFor(2)) {//reponse then shutdown return false; } if (responseService.publishHTTPResponse(request, 200)) { responseService.requestShutdown(); return true; } return false; } else { if (responseService.publishHTTPResponse(request, 404)) { return true; } return false; } }