public static void proxyResponseHeaders(Map<String, String> respHeaders, SimpleHttpResp resp) { for (Map.Entry<String, String> hdr : respHeaders.entrySet()) { String name = hdr.getKey(); String value = hdr.getValue(); if (name.equalsIgnoreCase("Content-type")) { resp.contentType = MediaType.of(value); } else if (name.equalsIgnoreCase("Set-Cookie")) { String[] parts = value.split("=", 2); U.must(parts.length == 2, "Invalid value of the Set-Cookie header!"); if (resp.cookies == null) { resp.cookies = U.map(); } resp.cookies.put(parts[0], parts[1]); } else if (!ignoreResponseHeaderInProxy(name)) { if (resp.headers == null) { resp.headers = U.map(); } resp.headers.put(name, value); } } }
public static void proxyResponseHeaders(Map<String, String> respHeaders, SimpleHttpResp resp) { for (Map.Entry<String, String> hdr : respHeaders.entrySet()) { String name = hdr.getKey(); String value = hdr.getValue(); if (name.equalsIgnoreCase("Content-type")) { resp.contentType = MediaType.of(value); } else if (name.equalsIgnoreCase("Set-Cookie")) { String[] parts = value.split("=", 2); U.must(parts.length == 2, "Invalid value of the Set-Cookie header!"); if (resp.cookies == null) { resp.cookies = U.map(); } resp.cookies.put(parts[0], parts[1]); } else if (!ignoreResponseHeaderInProxy(name)) { if (resp.headers == null) { resp.headers = U.map(); } resp.headers.put(name, value); } } }
private void addRoute(T config, HttpVerb verb, String uri) { OnRoute route = addRoute(verb, uri); if (config.contentType != null) route.contentType(MediaType.of(config.contentType)); if (config.managed != null) route.managed(config.managed); if (config.transaction != null) route.transaction(config.transaction); if (config.cacheTTL != null) route.cacheTTL(config.cacheTTL); if (config.cacheCapacity != null) route.cacheCapacity(config.cacheCapacity); if (config.roles != null) { route.roles(config.roles); App.boot().auth(); } addHandler(config, uri, route); }