All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazon.redshift.plugin.httpserver.ValidHttpRequestHandler Maven / Gradle / Ivy

There is a newer version: 2.1.0.30
Show newest version
package com.amazon.redshift.plugin.httpserver;

import org.apache.http.*;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.HttpRequestHandler;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * Return valid HTML for all requests.
 */
public class ValidHttpRequestHandler implements HttpRequestHandler
{
    private static final String VALID_RESPONSE = "" +
            "

" + "Thank you for using Amazon Redshift! You can now close this window.

" + ""; @Override public void handle(HttpRequest request, HttpResponse response, HttpContext context) throws HttpException, IOException { response.setEntity(new StringEntity(VALID_RESPONSE, StandardCharsets.UTF_8)); response.setHeader(HttpHeaders.CONTENT_TYPE, ContentType.TEXT_HTML.withCharset(StandardCharsets.UTF_8).toString()); response.setStatusCode(HttpStatus.SC_OK); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy