/*
 * Copyright (c) 2004-2017, by Alex Leigh.
 * All rights reserved.
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 */

package lc.mecha.http.server;

import lc.mecha.fabric.HandlerStatus;

import java.util.Set;

/**
 * This example handler implements a simple fixed "Hello World!" response. It's useful
 * for performance benchmarking and testing.
 *
 * @author Alex Leigh
 */
public final class HelloWorldHandler extends PrefixedHandler {
    public HelloWorldHandler(final Set<String> pathPrefix) {
        super(pathPrefix);
    }

    @Override
    public HandlerStatus handlePrefixedWebRequest(final HttpTransaction request) throws Throwable {
        request.httpServletResponse.setContentType("text/plain");
        request.httpServletResponse.getOutputStream().write("Hello World!".getBytes());
        return HandlerStatus.BREAK;
    }
}
