Java Code Examples for com.networknt.body.BodyHandler#setNext()

The following examples show how to use com.networknt.body.BodyHandler#setNext() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValidatorHandlerTest.java    From light-rest-4j with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
    if(server == null) {
        logger.info("starting server");

        HttpHandler handler = getPetStoreHandler();
        ValidatorHandler validatorHandler = new ValidatorHandler();
        validatorHandler.setNext(handler);
        handler = validatorHandler;

        BodyHandler bodyHandler = new BodyHandler();
        bodyHandler.setNext(handler);
        handler = bodyHandler;

        SwaggerHandler swaggerHandler = new SwaggerHandler();
        swaggerHandler.setNext(handler);
        handler = swaggerHandler;

        server = Undertow.builder()
                .addHttpListener(8080, "localhost")
                .setHandler(handler)
                .build();
        server.start();
    }
}
 
Example 2
Source File: ResponseValidatorTest.java    From light-rest-4j with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
    if(server == null) {
        logger.info("starting server");
        TestValidateResponseHandler testValidateResponseHandler = new TestValidateResponseHandler();
        HttpHandler handler = Handlers.routing()
                .add(Methods.GET, "/v1/todoItems", testValidateResponseHandler);
        ValidatorHandler validatorHandler = new ValidatorHandler();
        validatorHandler.setNext(handler);
        handler = validatorHandler;

        BodyHandler bodyHandler = new BodyHandler();
        bodyHandler.setNext(handler);
        handler = bodyHandler;

        OpenApiHandler openApiHandler = new OpenApiHandler();
        openApiHandler.setNext(handler);
        handler = openApiHandler;

        server = Undertow.builder()
                .addHttpListener(8080, "localhost")
                .setHandler(handler)
                .build();
        server.start();
    }
}
 
Example 3
Source File: ValidatorHandlerTest.java    From light-rest-4j with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() {
    if(server == null) {
        logger.info("starting server");

        HttpHandler handler = getPetStoreHandler();
        ValidatorHandler validatorHandler = new ValidatorHandler();
        validatorHandler.setNext(handler);
        handler = validatorHandler;

        BodyHandler bodyHandler = new BodyHandler();
        bodyHandler.setNext(handler);
        handler = bodyHandler;

        OpenApiHandler openApiHandler = new OpenApiHandler();
        openApiHandler.setNext(handler);
        handler = openApiHandler;

        server = Undertow.builder()
                .addHttpListener(8080, "localhost")
                .setHandler(handler)
                .build();
        server.start();
        clearLogFile();
    }
}
 
Example 4
Source File: ServerBuilder.java    From light-4j with Apache License 2.0 6 votes vote down vote up
public Undertow build() {
    HttpHandler handler = HandlerBuilder.build();

    SanitizerHandler sanitizerHandler = new SanitizerHandler(configName);
    sanitizerHandler.setNext(handler);
    handler = sanitizerHandler;

    BodyHandler bodyHandler = new BodyHandler();
    bodyHandler.setNext(handler);
    handler = bodyHandler;

    instance = null;

    return Undertow.builder()
            .addHttpListener(8080, "localhost")
            .setHandler(handler)
            .build();
}
 
Example 5
Source File: RequestValidatorTest.java    From light-rest-4j with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUp() {
    if(server == null) {
        logger.info("starting server");
        HttpHandler handler = setupRoutings();
        
        ValidatorHandler validatorHandler = new ValidatorHandler();
        validatorHandler.setNext(handler);
        handler = validatorHandler;

        BodyHandler bodyHandler = new BodyHandler();
        bodyHandler.setNext(handler);
        handler = bodyHandler;            
        
        OpenApiHandler openApiHandler = new OpenApiHandler();
        openApiHandler.setNext(handler);
        handler = openApiHandler;
        
        ParameterHandler parameterHandler = new ParameterHandler();
        parameterHandler.setNext(handler);
        handler = parameterHandler;
        
        server = Undertow.builder()
                .addHttpListener(8080, "localhost")
                .setHandler(handler)
                .build();
        server.start();
    }
    
    PETS_HEADERS.put("accessId", "001");
    PETS_HEADERS.put("requestId", "1");
}