Example usage for javax.xml.ws.spi.http HttpExchange getResponseHeaders

List of usage examples for javax.xml.ws.spi.http HttpExchange getResponseHeaders

Introduction

In this page you can find the example usage for javax.xml.ws.spi.http HttpExchange getResponseHeaders.

Prototype

public abstract Map<String, List<String>> getResponseHeaders();

Source Link

Document

Returns a mutable Map into which the HTTP response headers can be stored and which will be transmitted as part of this response.

Usage

From source file:io.hummer.util.ws.AbstractNode.java

private static void addCORSHeaders(com.sun.net.httpserver.HttpExchange ex) {
    // Allow CORS policy (cross-domain requests, from Web browsers)
    ex.getResponseHeaders().add("Access-Control-Allow-Origin", "*");
    ex.getResponseHeaders().add("Access-Control-Allow-Headers",
            "Origin, Content-Type, Accept, Transfer-Encoding, "
                    + "Accept-Encoding, Accept-Language, Connection, Cookie, Host, "
                    + "Referer, User-Agent, Server, Authorization, x-requested-with");
    ex.getResponseHeaders().add("Access-Control-Allow-Credentials", "true");
    ex.getResponseHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD");
    ex.getResponseHeaders().add("Access-Control-Max-Age", "1209600");
    ex.getResponseHeaders().add("Access-Control-Expose-Headers", "Location");
}