Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * JBoss, Home of Professional Open Source.
   * Copyright 2015, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site:
 package org.wildfly.test.undertow;
A default service activator which will create an Undertow service and send a default response to port 8080.

You can override the address with the jboss.bind.address or management.address system properties.

To override the port use the jboss.http.port system property.

Override any of the getter methods to customize the desired behavior.

James R. Perkins
 public class UndertowServiceActivator implements ServiceActivator {

Class dependencies required to use the UndertowService.
     public static final Class<?>[] DEPENDENCIES = {
     public static final String DEFAULT_RESPONSE = "Response sent";
     private static final HttpHandler DEFAULT_HANDLER = new HttpHandler() {
         public void handleRequest(final HttpServerExchange exchangethrows Exception {
     public final void activate(final ServiceActivatorContext serviceActivatorContextthrows ServiceRegistryException {
         final String address = getAddress();
         assert address != null : "address cannot be null";
         final int port = getPort();
         assert port > 0 : "port must be greater than 0";
         final HttpHandler handler = getHttpHandler();
         assert handler != null : "A handler is required";
         final UndertowService service = new UndertowService(addressporthandler);
         serviceActivatorContext.getServiceTarget().addService(getServiceName(), service).install();

Returns the service name to use when adding the UndertowService.

the undertow service name
     protected ServiceName getServiceName() {
         return .;

Returns the handler used to process the request

the handler to use
     protected HttpHandler getHttpHandler() {
         return ;

Returns the address for Undertow to bind to.

the address
     protected String getAddress() {
        return TestSuiteEnvironment.getHttpAddress();

Returns the port for Undertow to bind to.

the port
    protected int getPort() {
        return TestSuiteEnvironment.getHttpPort();
New to GrepCode? Check out our FAQ X