mirror of https://github.com/jacekkow/keycloak-protocol-cas

Matthias Piepkorn
2017-02-05 5ba0b037031c3b1afc89a419d432c5f1d8748aa2
src/main/java/org/keycloak/protocol/cas/utils/ContentTypeHelper.java
@@ -19,7 +19,8 @@
    public MediaType selectResponseType() {
        String format = uriInfo.getQueryParameters().getFirst(CASLoginProtocol.FORMAT_PARAM);
        if (format != null && !format.isEmpty()) {
            request.getMutableHeaders().add(HttpHeaders.ACCEPT, "application/" + format);
            //if parameter is set, it overrides all header values (see spec section 2.5.1)
            request.getMutableHeaders().putSingle(HttpHeaders.ACCEPT, "application/" + format.toLowerCase());
        }
        Variant variant = restRequest.selectVariant(Variant.mediaTypes(MediaType.APPLICATION_XML_TYPE, MediaType.APPLICATION_JSON_TYPE).build());
        return variant == null ? MediaType.APPLICATION_XML_TYPE : variant.getMediaType();