public OriginHandler setNext(final HttpHandler next) { Handlers.handlerNotNull(next); this.next = next; return this; }
private void queue(final ByteBuffer[] byteBuffers, final IoCallback ioCallback) { //if data is sent from withing the callback we queue it, to prevent the stack growing indefinitely if (next != null) { throw UndertowMessages.MESSAGES.dataAlreadyQueued(); } next = byteBuffers; queuedCallback = ioCallback; }
public SessionAttachmentHandler(final SessionManager sessionManager, final SessionConfig sessionConfig) { this.sessionConfig = sessionConfig; if (sessionManager == null) { throw UndertowMessages.MESSAGES.sessionManagerMustNotBeNull(); } this.sessionManager = sessionManager; }
@Override protected void initServer() throws Exception { this.server = Undertow.builder().addHttpListener(getPort(), getHost()) .setHandler(initHttpHandlerAdapter()) .build(); }
@Override public void start() throws Exception { this.server.start(); Undertow.ListenerInfo info = this.server.getListenerInfo().get(0); this.port = ((InetSocketAddress) info.getAddress()).getPort(); }
@Override public void stop() throws Exception { this.server.stop(); this.port = 0; }
public Builder setIdempotentRequestPredicate(Predicate idempotentRequestPredicate) { if(idempotentRequestPredicate == null) { throw UndertowMessages.MESSAGES.argumentCannotBeNull("idempotentRequestPredicate"); } this.idempotentRequestPredicate = idempotentRequestPredicate; return this; }
private void checkForNewlines() { for(byte b : bytes) { if(b == '\r' || b == '\n') { throw UndertowMessages.MESSAGES.newlineNotSupportedInHttpString(string); } } }
public static void handlerNotNull(final HttpHandler handler) { if (handler == null) { throw UndertowMessages.MESSAGES.handlerCannotBeNull(); } } }
private void checkClosed() throws IOException { if (closed) { throw UndertowMessages.MESSAGES.streamIsClosed(); } } }
@Override public String getValue() { if (value == null) { throw UndertowMessages.MESSAGES.formValueIsAFile(); } return value; }
@Override public FileItem getFileItem() { if (fileItem == null) { throw UndertowMessages.MESSAGES.formValueIsAString(); } return fileItem; }
/** * @return A builder that can be used to create an Undertow server instance */ public static Builder builder() { return new Builder(); }
@Override protected void startInternal() { this.server.start(); Undertow.ListenerInfo info = this.server.getListenerInfo().get(0); setPort(((InetSocketAddress) info.getAddress()).getPort()); }
@Override protected void stopInternal() { this.server.stop(); }
public EagerFormParsingHandler setNext(final HttpHandler next) { Handlers.handlerNotNull(next); this.next = next; return this; }
public SessionAttachmentHandler(final HttpHandler next, final SessionManager sessionManager, final SessionConfig sessionConfig) { this.sessionConfig = sessionConfig; if (sessionManager == null) { throw UndertowMessages.MESSAGES.sessionManagerMustNotBeNull(); } this.next = next; this.sessionManager = sessionManager; }
public CanonicalPathHandler setNext(final HttpHandler next) { Handlers.handlerNotNull(next); this.next = next; return this; }
public AuthenticationMechanismsHandler setNext(final HttpHandler next) { Handlers.handlerNotNull(next); this.next = next; return this; }
public EncodingHandler setNoEncodingHandler(HttpHandler noEncodingHandler) { Handlers.handlerNotNull(noEncodingHandler); this.noEncodingHandler = noEncodingHandler; return this; }