org.apache.cxf.jaxrs.impl.RequestImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cxf-bundle-jaxrs Show documentation
Show all versions of cxf-bundle-jaxrs Show documentation
Apache CXF JAX-RS Bundle Jar
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cxf.jaxrs.impl;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import javax.ws.rs.core.EntityTag;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.core.Variant;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.jaxrs.utils.HttpUtils;
import org.apache.cxf.jaxrs.utils.JAXRSUtils;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.PhaseInterceptorChain;
/**
* TODO : deal with InvalidStateExceptions
*
*/
public class RequestImpl implements Request {
private final Message m;
private final HttpHeaders headers;
public RequestImpl(Message m) {
this.m = m;
this.headers = new HttpHeadersImpl(m);
}
public Variant selectVariant(List vars) throws IllegalArgumentException {
if (vars == null || vars.isEmpty()) {
throw new IllegalArgumentException("List of Variants is either null or empty");
}
List acceptMediaTypes = headers.getAcceptableMediaTypes();
List acceptLangs = headers.getAcceptableLanguages();
List acceptEncs = parseAcceptEnc(
headers.getRequestHeaders().getFirst(HttpHeaders.ACCEPT_ENCODING));
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy