Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* 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.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.ResponseProcessingException;
import javax.ws.rs.core.EntityTag;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Link;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.NewCookie;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status.Family;
import javax.ws.rs.ext.ReaderInterceptor;
import javax.ws.rs.ext.RuntimeDelegate.HeaderDelegate;
import javax.xml.stream.XMLStreamReader;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.jaxrs.provider.ProviderFactory;
import org.apache.cxf.jaxrs.utils.HttpUtils;
import org.apache.cxf.jaxrs.utils.InjectionUtils;
import org.apache.cxf.jaxrs.utils.JAXRSUtils;
import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageUtils;
public final class ResponseImpl extends Response {
private int status;
private Object entity;
private Annotation[] entityAnnotations;
private MultivaluedMap metadata;
private Message outMessage;
private boolean entityClosed;
private boolean entityBufferred;
private Object lastEntity;
ResponseImpl(int s) {
this.status = s;
}
ResponseImpl(int s, Object e) {
this.status = s;
this.entity = e;
}
public void addMetadata(MultivaluedMap meta) {
this.metadata = meta;
}
public void setStatus(int s) {
this.status = s;
}
public void setEntity(Object e, Annotation[] anns) {
this.entity = e;
this.entityAnnotations = anns;
}
public void setEntityAnnotations(Annotation[] anns) {
this.entityAnnotations = anns;
}
public Annotation[] getEntityAnnotations() {
return entityAnnotations;
}
public void setOutMessage(Message message) {
this.outMessage = message;
}
public Message getOutMessage() {
return this.outMessage;
}
public int getStatus() {
return status;
}
public StatusType getStatusInfo() {
return new Response.StatusType() {
public Family getFamily() {
return Response.Status.Family.familyOf(ResponseImpl.this.status);
}
public String getReasonPhrase() {
Response.Status statusEnum = Response.Status.fromStatusCode(ResponseImpl.this.status);
return statusEnum != null ? statusEnum.getReasonPhrase() : "";
}
public int getStatusCode() {
return ResponseImpl.this.status;
}
};
}
public Object getActualEntity() {
checkEntityIsClosed();
return lastEntity != null ? lastEntity : entity;
}
public Object getEntity() {
return InjectionUtils.getEntity(getActualEntity());
}
public boolean hasEntity() {
return getActualEntity() != null;
}
public MultivaluedMap getMetadata() {
return getHeaders();
}
public MultivaluedMap getHeaders() {
return metadata;
}
public MultivaluedMap getStringHeaders() {
MetadataMap headers = new MetadataMap(metadata.size());
for (Map.Entry> entry : metadata.entrySet()) {
String headerName = entry.getKey();
headers.put(headerName, toListOfStrings(headerName, entry.getValue()));
}
return headers;
}
public String getHeaderString(String header) {
List