[OLINGO-659] API clean-up

Signed-off-by: Michael Bolz <michael.bolz@sap.com>
This commit is contained in:
Klaus Straubinger 2015-09-11 11:05:54 +02:00 committed by Michael Bolz
parent 7715006eaf
commit 11ebbb58d8
81 changed files with 266 additions and 302 deletions

View File

@ -68,6 +68,7 @@ import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.serialization.ODataDeserializer;
import org.apache.olingo.client.api.serialization.ODataSerializer;
import org.apache.olingo.client.core.serialization.AtomSerializer;
@ -78,7 +79,6 @@ import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;

View File

@ -63,11 +63,11 @@ import org.apache.cxf.interceptor.InInterceptors;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ContentType;

View File

@ -42,6 +42,7 @@ import javax.ws.rs.core.Response;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.vfs2.FileObject;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.serialization.ODataDeserializer;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.api.serialization.ODataSerializer;
@ -53,7 +54,6 @@ import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.fit.UnsupportedMediaTypeException;

View File

@ -38,11 +38,11 @@ import org.apache.commons.vfs2.FileSystemException;
import org.apache.commons.vfs2.FileSystemManager;
import org.apache.commons.vfs2.FileType;
import org.apache.commons.vfs2.VFS;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.client.core.serialization.AtomSerializer;
import org.apache.olingo.client.core.serialization.JsonSerializer;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.format.ContentType;
import org.slf4j.Logger;

View File

@ -35,6 +35,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.domain.ClientInlineEntity;
@ -43,7 +44,6 @@ import org.apache.olingo.client.api.domain.ClientLink;
import org.apache.olingo.client.api.domain.ClientLinkType;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.uri.URIBuilder;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ContentType;
import org.junit.Ignore;

View File

@ -31,12 +31,12 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySe
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.domain.ClientEntitySetIterator;
import org.apache.olingo.client.api.uri.URIBuilder;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.junit.Test;

View File

@ -29,6 +29,7 @@ import java.net.URI;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientAnnotation;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
@ -37,7 +38,6 @@ import org.apache.olingo.client.api.domain.ClientLinkType;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.format.ContentType;

View File

@ -41,12 +41,12 @@ import org.apache.olingo.client.api.communication.response.ODataBatchResponse;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.client.api.communication.response.ODataResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.format.PreferenceName;

View File

@ -18,7 +18,7 @@
*/
package org.apache.olingo.client.api.communication.response;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.client.api.data.ResWrap;
/**
* This interface represents a generic OData response.

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.commons.api.data;
package org.apache.olingo.client.api.data;
import java.net.URI;

View File

@ -30,10 +30,10 @@ import java.util.NoSuchElementException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -20,10 +20,10 @@ package org.apache.olingo.client.api.serialization;
import java.io.InputStream;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.commons.api.data.Delta;
import org.apache.olingo.commons.api.data.ResWrap;
public interface ClientODataDeserializer extends ODataDeserializer {

View File

@ -18,13 +18,13 @@
*/
package org.apache.olingo.client.api.serialization;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.commons.api.data.Delta;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientDelta;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;

View File

@ -20,11 +20,11 @@ package org.apache.olingo.client.api.serialization;
import java.io.InputStream;
import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.ex.ODataError;
/**
* Interface for de-serialization.

View File

@ -21,14 +21,14 @@ package org.apache.olingo.client.api.serialization;
import java.io.InputStream;
import java.util.Map;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.domain.ClientServiceDocument;
import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.api.format.ContentType;

View File

@ -20,7 +20,7 @@ package org.apache.olingo.client.api.serialization;
import java.io.Writer;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.client.api.data.ResWrap;
/**
* Interface for serialization.

View File

@ -22,10 +22,10 @@ import java.io.InputStream;
import java.net.URI;
import java.util.Collection;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientLink;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
/**

View File

@ -33,15 +33,15 @@ import org.apache.olingo.client.api.communication.request.cud.UpdateType;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
import org.apache.olingo.client.api.communication.request.streamed.ODataStreamUpdateRequest;
import org.apache.olingo.client.core.communication.request.streamed.ODataMediaEntityCreateRequestImpl;
import org.apache.olingo.client.core.communication.request.streamed.ODataMediaEntityUpdateRequestImpl;
import org.apache.olingo.client.core.communication.request.streamed.ODataStreamUpdateRequestImpl;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientPrimitiveValue;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.domain.ClientSingleton;
import org.apache.olingo.client.core.communication.request.streamed.ODataMediaEntityCreateRequestImpl;
import org.apache.olingo.client.core.communication.request.streamed.ODataMediaEntityUpdateRequestImpl;
import org.apache.olingo.client.core.communication.request.streamed.ODataStreamUpdateRequestImpl;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.http.HttpMethod;
public class CUDRequestFactoryImpl implements CUDRequestFactory {

View File

@ -28,15 +28,15 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.commons.api.http.HttpMethod;
/**
@ -104,9 +104,6 @@ public class ODataEntityCreateRequestImpl<E extends ClientEntity>
super(odataClient, httpClient, res);
}
/**
* {@inheritDoc }
*/
@Override
@SuppressWarnings("unchecked")
public E getBody() {

View File

@ -29,15 +29,15 @@ import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.commons.api.http.HttpMethod;
/**

View File

@ -28,15 +28,15 @@ import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.cud.ODataPropertyUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataPropertyUpdateResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.commons.api.http.HttpMethod;
/**

View File

@ -28,12 +28,12 @@ import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.cud.ODataReferenceAddingRequest;
import org.apache.olingo.client.api.communication.response.ODataReferenceAddingResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.client.api.serialization.ODataWriter;
import org.apache.olingo.client.core.communication.request.AbstractODataBasicRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpMethod;

View File

@ -26,11 +26,11 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataDeltaRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientDelta;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.data.Delta;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
public class ODataDeltaRequestImpl extends AbstractODataRetrieveRequest<ClientDelta>

View File

@ -25,11 +25,11 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.format.ContentType;
/**
* This class implements an OData retrieve query request returning a single entity.

View File

@ -25,11 +25,11 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.format.ContentType;
/**
* This class implements an OData EntitySet query request.

View File

@ -26,11 +26,11 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.http.HttpClientException;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
/**

View File

@ -28,10 +28,10 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
import org.apache.olingo.client.api.communication.response.ODataRawResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.core.communication.request.AbstractODataRequest;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpMethod;

View File

@ -25,11 +25,11 @@ import org.apache.http.client.HttpClient;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.domain.ClientServiceDocument;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.format.ContentType;
/**
* This class implements an OData service document request.

View File

@ -28,12 +28,12 @@ import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityCreateStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityCreateRequest;
import org.apache.olingo.client.api.communication.response.ODataMediaEntityCreateResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.http.HttpMethod;
/**

View File

@ -28,12 +28,12 @@ import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.communication.request.streamed.MediaEntityUpdateStreamManager;
import org.apache.olingo.client.api.communication.request.streamed.ODataMediaEntityUpdateRequest;
import org.apache.olingo.client.api.communication.response.ODataMediaEntityUpdateResponse;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.core.communication.request.AbstractODataStreamManager;
import org.apache.olingo.client.core.communication.response.AbstractODataResponse;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.http.HttpMethod;
/**

View File

@ -24,11 +24,11 @@ import java.net.URI;
import java.util.Iterator;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.core.serialization.JsonDeserializer;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.ResWrap;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;

View File

@ -22,11 +22,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.core.serialization.JsonDeserializer;
import org.apache.olingo.client.core.uri.URIUtils;
import org.apache.olingo.commons.api.data.ResWrap;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;

View File

@ -21,7 +21,6 @@ package org.apache.olingo.client.core.serialization;
import java.io.InputStream;
import java.net.URI;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
@ -37,11 +36,10 @@ import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.serialization.ODataDeserializer;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.api.data.PropertyType;
import org.apache.olingo.commons.api.data.AbstractODataObject;
import org.apache.olingo.commons.api.data.Annotation;
import org.apache.olingo.commons.api.data.ComplexValue;
@ -54,13 +52,14 @@ import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Operation;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.data.PropertyType;
import org.apache.olingo.commons.api.data.Valuable;
import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
@ -367,11 +366,7 @@ public class AtomDeserializer extends AbstractAtomDealer implements ODataDeseria
final XMLEvent event = reader.nextEvent();
if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
try {
object.setCommonProperty(key, event.asCharacters().getData());
} catch (ParseException e) {
throw new XMLStreamException("While parsing Atom entry or feed common elements", e);
}
object.setCommonProperty(key, event.asCharacters().getData());
}
if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {

View File

@ -32,10 +32,10 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.serialization.ODataSerializer;
import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.data.AbstractODataObject;
import org.apache.olingo.commons.api.data.Annotation;
import org.apache.olingo.commons.api.data.ComplexValue;
@ -45,11 +45,11 @@ import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Operation;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;

View File

@ -23,6 +23,7 @@ import java.io.InputStream;
import javax.xml.stream.XMLStreamException;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.api.serialization.ClientODataDeserializer;
@ -32,14 +33,14 @@ import org.apache.olingo.client.core.data.JSONServiceDocumentDeserializer;
import org.apache.olingo.client.core.data.XMLServiceDocumentDeserializer;
import org.apache.olingo.client.core.edm.ClientCsdlXMLMetadata;
import org.apache.olingo.client.core.edm.xml.ClientCsdlEdmx;
import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.api.data.Delta;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.api.format.ContentType;
import com.fasterxml.aalto.stax.InputFactoryImpl;
import com.fasterxml.aalto.stax.OutputFactoryImpl;
import com.fasterxml.jackson.core.JsonParser;

View File

@ -23,13 +23,13 @@ import java.io.InputStream;
import java.net.URI;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.ContextURL;
import org.apache.olingo.commons.api.data.DeletedEntity;
import org.apache.olingo.commons.api.data.Delta;
import org.apache.olingo.commons.api.data.DeltaLink;
import org.apache.olingo.commons.api.data.ResWrap;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;

View File

@ -31,11 +31,10 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.serialization.ODataDeserializer;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.api.data.PropertyType;
import org.apache.olingo.commons.api.data.Annotatable;
import org.apache.olingo.commons.api.data.Annotation;
import org.apache.olingo.commons.api.data.ComplexValue;
@ -44,13 +43,14 @@ import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Linked;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.data.PropertyType;
import org.apache.olingo.commons.api.data.Valuable;
import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.geo.Geospatial;
import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;
import com.fasterxml.jackson.core.JsonFactory;

View File

@ -30,12 +30,12 @@ import java.util.Set;
import java.util.regex.Matcher;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Annotation;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Operation;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;

View File

@ -21,13 +21,13 @@ package org.apache.olingo.client.core.serialization;
import java.io.IOException;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Annotation;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Operation;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;

View File

@ -24,10 +24,10 @@ import java.util.Iterator;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Annotation;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import com.fasterxml.jackson.core.JsonParser;

View File

@ -21,11 +21,11 @@ package org.apache.olingo.client.core.serialization;
import java.io.IOException;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Annotation;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ContentType;

View File

@ -21,9 +21,9 @@ package org.apache.olingo.client.core.serialization;
import java.io.IOException;
import java.net.URI;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.ex.ODataErrorDetail;
import org.apache.olingo.commons.api.data.ResWrap;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonNode;

View File

@ -24,10 +24,10 @@ import java.util.Iterator;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Annotation;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;

View File

@ -22,10 +22,10 @@ import java.io.IOException;
import java.net.URI;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Annotation;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.edm.EdmTypeInfo;

View File

@ -28,6 +28,7 @@ import java.util.Map;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.serialization.ODataSerializer;
import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.commons.api.Constants;
@ -39,7 +40,6 @@ import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Linked;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.data.Valuable;
import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;

View File

@ -28,6 +28,7 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.EdmEnabledODataClient;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.data.ServiceDocumentItem;
import org.apache.olingo.client.api.domain.ClientAnnotatable;
@ -70,7 +71,6 @@ import org.apache.olingo.commons.api.data.Link;
import org.apache.olingo.commons.api.data.Linked;
import org.apache.olingo.commons.api.data.Operation;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.data.Valuable;
import org.apache.olingo.commons.api.data.ValueType;
import org.apache.olingo.commons.api.edm.Edm;

View File

@ -24,6 +24,7 @@ import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
@ -35,14 +36,13 @@ import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.client.api.serialization.ODataReader;
import org.apache.olingo.client.core.edm.ClientCsdlEdmProvider;
import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.Property;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.provider.CsdlSchema;
import org.apache.olingo.commons.api.ex.ODataError;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.slf4j.Logger;

View File

@ -29,14 +29,14 @@ import java.util.Collections;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientLink;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.serialization.ODataSerializerException;
import org.apache.olingo.client.api.serialization.ODataWriter;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.client.api.serialization.ODataSerializerException;
public class ODataWriterImpl implements ODataWriter {

View File

@ -27,12 +27,12 @@ import java.io.InputStream;
import java.net.URI;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientEntity;
import org.apache.olingo.client.api.domain.ClientEntitySet;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.format.ContentType;
import org.junit.Test;
public class EntitySetTest extends AbstractTest {

View File

@ -29,6 +29,7 @@ import java.util.Iterator;
import org.apache.olingo.client.api.EdmEnabledODataClient;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.domain.ClientAnnotation;
import org.apache.olingo.client.api.domain.ClientComplexValue;
import org.apache.olingo.client.api.domain.ClientEntity;
@ -38,9 +39,7 @@ import org.apache.olingo.client.api.domain.ClientLinkType;
import org.apache.olingo.client.api.domain.ClientProperty;
import org.apache.olingo.client.api.domain.ClientValuable;
import org.apache.olingo.client.api.domain.ClientValue;
import org.apache.olingo.client.core.EdmEnabledODataClientImpl;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.format.ContentType;

View File

@ -25,11 +25,11 @@ import static org.junit.Assert.assertTrue;
import java.net.URI;
import org.apache.olingo.client.api.ODataClient;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.client.api.data.ServiceDocument;
import org.apache.olingo.client.api.domain.ClientServiceDocument;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.client.api.serialization.ODataDeserializerException;
import org.apache.olingo.commons.api.format.ContentType;
import org.junit.Test;
public class ServiceDocumentTest extends AbstractTest {

View File

@ -25,10 +25,9 @@ import static org.junit.Assert.assertNull;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.apache.olingo.client.core.serialization.AtomDeserializer;
import org.apache.olingo.client.api.data.ResWrap;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.data.ResWrap;
import org.junit.Test;
public class AtomDeserializerTest {

View File

@ -19,7 +19,6 @@
package org.apache.olingo.commons.api.data;
import java.net.URI;
import java.text.ParseException;
/**
* Abstract OData object with basic values (<code>id</code>, <code>baseURI</code>, <code>title</code>).
@ -31,8 +30,7 @@ public abstract class AbstractODataObject extends Annotatable {
private String title;
/**
* Get base URI.
*
* Gets base URI.
* @return base URI
*/
public URI getBaseURI() {
@ -40,8 +38,7 @@ public abstract class AbstractODataObject extends Annotatable {
}
/**
* Set base URI.
*
* Sets base URI.
* @param baseURI new base URI
*/
public void setBaseURI(final URI baseURI) {
@ -49,8 +46,7 @@ public abstract class AbstractODataObject extends Annotatable {
}
/**
* Get ID.
*
* Gets ID.
* @return ID.
*/
public URI getId() {
@ -58,8 +54,7 @@ public abstract class AbstractODataObject extends Annotatable {
}
/**
* Set ID.
*
* Sets ID.
* @param id new ID value
*/
public void setId(final URI id) {
@ -67,8 +62,7 @@ public abstract class AbstractODataObject extends Annotatable {
}
/**
* Get tile.
*
* Gets title.
* @return title
*/
public String getTitle() {
@ -76,13 +70,11 @@ public abstract class AbstractODataObject extends Annotatable {
}
/**
* Set property with given key to given value.
*
* Sets property with given key to given value.
* @param key key of property
* @param value new value for property
* @throws ParseException if value can not be parsed
*/
public void setCommonProperty(final String key, final String value) throws ParseException {
public void setCommonProperty(final String key, final String value) {
if ("id".equals(key)) {
id = URI.create(value);
} else if ("title".equals(key)) {

View File

@ -22,14 +22,27 @@ public class ODataException extends Exception {
private static final long serialVersionUID = 3057981437954048107L;
/**
* Creates exception with <code>message</code>.
* @param msg message text for exception
*/
public ODataException(final String msg) {
super(msg);
}
/**
* Creates exception with <code>message</code> and <code>cause</code> of exception.
* @param msg message text for exception
* @param cause cause of exception
*/
public ODataException(final String msg, final Throwable cause) {
super(msg, cause);
}
/**
* Creates exception with <code>cause</code> of exception.
* @param cause cause of exception
*/
public ODataException(final Throwable cause) {
super(cause);
}

View File

@ -58,17 +58,21 @@ public final class ContentType {
public static final String VALUE_ODATA_METADATA_FULL = "full";
public static final ContentType APPLICATION_JSON = new ContentType(APPLICATION, "json", null);
public static final ContentType JSON = ContentType.create(ContentType.APPLICATION_JSON,
public static final ContentType JSON = create(ContentType.APPLICATION_JSON,
PARAMETER_ODATA_METADATA, VALUE_ODATA_METADATA_MINIMAL);
public static final ContentType JSON_NO_METADATA = ContentType.create(ContentType.APPLICATION_JSON,
public static final ContentType JSON_NO_METADATA = create(ContentType.APPLICATION_JSON,
PARAMETER_ODATA_METADATA, VALUE_ODATA_METADATA_NONE);
public static final ContentType JSON_FULL_METADATA = ContentType.create(ContentType.APPLICATION_JSON,
public static final ContentType JSON_FULL_METADATA = create(ContentType.APPLICATION_JSON,
PARAMETER_ODATA_METADATA, VALUE_ODATA_METADATA_FULL);
public static final ContentType APPLICATION_XML = new ContentType(APPLICATION, "xml", null);
public static final ContentType APPLICATION_ATOM_XML = new ContentType(APPLICATION, "atom+xml", null);
public static final ContentType APPLICATION_ATOM_XML_ENTRY = create(APPLICATION_ATOM_XML, "type", "entry");
public static final ContentType APPLICATION_ATOM_XML_ENTRY_UTF8 = create(APPLICATION_ATOM_XML_ENTRY,
PARAMETER_CHARSET, "utf-8");
public static final ContentType APPLICATION_ATOM_XML_FEED = create(APPLICATION_ATOM_XML, "type", "feed");
public static final ContentType APPLICATION_ATOM_XML_FEED_UTF8 = create(APPLICATION_ATOM_XML_FEED,
PARAMETER_CHARSET, "utf-8");
public static final ContentType APPLICATION_ATOM_SVC = new ContentType(APPLICATION, "atomsvc+xml", null);
public static final ContentType APPLICATION_OCTET_STREAM = new ContentType(APPLICATION, "octet-stream", null);

View File

@ -1,58 +0,0 @@
/*
* 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.olingo.commons.api.http;
/**
* Constants for <code>Http Content Type</code> definitions as specified in
* <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">RFC 2616 Section 14</a>.
*
*/
public interface HttpContentType {
String APPLICATION_XML = "application/xml";
String CHARSET_UTF_8 = ";charset=utf-8";
String APPLICATION_XML_UTF8 = APPLICATION_XML + CHARSET_UTF_8;
String APPLICATION_ATOM_XML = "application/atom+xml";
String APPLICATION_ATOM_XML_UTF8 = APPLICATION_ATOM_XML + CHARSET_UTF_8;
String APPLICATION_ATOM_XML_ENTRY = APPLICATION_ATOM_XML + ";type=entry";
String APPLICATION_ATOM_XML_ENTRY_UTF8 = APPLICATION_ATOM_XML_ENTRY + CHARSET_UTF_8;
String APPLICATION_ATOM_XML_FEED = APPLICATION_ATOM_XML + ";type=feed";
String APPLICATION_ATOM_XML_FEED_UTF8 = APPLICATION_ATOM_XML_FEED + CHARSET_UTF_8;
String APPLICATION_ATOM_SVC = "application/atomsvc+xml";
String APPLICATION_ATOM_SVC_UTF8 = APPLICATION_ATOM_SVC + CHARSET_UTF_8;
String APPLICATION_JSON = "application/json";
String APPLICATION_JSON_VERBOSE = APPLICATION_JSON + ";odata=verbose";
String APPLICATION_JSON_UTF8 = APPLICATION_JSON + CHARSET_UTF_8;
String APPLICATION_JSON_UTF8_VERBOSE = APPLICATION_JSON_UTF8 + ";odata=verbose";
String TEXT_PLAIN = "text/plain";
String TEXT_PLAIN_UTF8 = TEXT_PLAIN + CHARSET_UTF_8;
String TEXT_HTML = "text/html";
String APPLICATION_OCTET_STREAM = "application/octet-stream";
String APPLICATION_HTTP = "application/http";
String MULTIPART_MIXED = "multipart/mixed";
String WILDCARD = "*/*";
}

View File

@ -19,30 +19,51 @@
package org.apache.olingo.commons.api.http;
/**
* HTTP status codes as defined in RFC2616-sec10
* and additional status codes as defined in RFC6585
*
* HTTP status codes as defined in RFC 7231, section 6,
* and additional status codes as defined in RFC 6585
*/
public enum HttpStatusCode {
OK(200, "OK"), CREATED(201, "Created"), ACCEPTED(202, "Accepted"), NO_CONTENT(204, "No Content"), RESET_CONTENT(205,
"Reset Content"), PARTIAL_CONTENT(206, "Partial Content"),
OK(200, "OK"),
CREATED(201, "Created"),
ACCEPTED(202, "Accepted"),
NO_CONTENT(204, "No Content"),
RESET_CONTENT(205, "Reset Content"),
PARTIAL_CONTENT(206, "Partial Content"),
MOVED_PERMANENTLY(301, "Moved Permanently"), FOUND(302, "Found"), SEE_OTHER(303, "See Other"), NOT_MODIFIED(304,
"Not Modified"), USE_PROXY(305, "Use Proxy"), TEMPORARY_REDIRECT(307, "Temporary Redirect"),
MOVED_PERMANENTLY(301, "Moved Permanently"),
FOUND(302, "Found"),
SEE_OTHER(303, "See Other"),
NOT_MODIFIED(304, "Not Modified"),
USE_PROXY(305, "Use Proxy"),
TEMPORARY_REDIRECT(307, "Temporary Redirect"),
BAD_REQUEST(400, "Bad Request"), UNAUTHORIZED(401, "Unauthorized"), PAYMENT_REQUIRED(402, "Payment Required"),
FORBIDDEN(403, "Forbidden"), NOT_FOUND(404, "Not Found"), METHOD_NOT_ALLOWED(405, "Method Not Allowed"),
NOT_ACCEPTABLE(406, "Not Acceptable"), PROXY_AUTHENTICATION_REQUIRED(407, "Proxy Authentication Required"),
REQUEST_TIMEOUT(408, "Request Timeout"), CONFLICT(409, "Conflict"), GONE(410, "Gone"),
LENGTH_REQUIRED(411, "Length Required"), PRECONDITION_FAILED(412, "Precondition Failed"),
REQUEST_ENTITY_TOO_LARGE(413, "Request Entity Too Large"), REQUEST_URI_TOO_LONG(414, "Request-URI Too Long"),
BAD_REQUEST(400, "Bad Request"),
UNAUTHORIZED(401, "Unauthorized"),
PAYMENT_REQUIRED(402, "Payment Required"),
FORBIDDEN(403, "Forbidden"),
NOT_FOUND(404, "Not Found"),
METHOD_NOT_ALLOWED(405, "Method Not Allowed"),
NOT_ACCEPTABLE(406, "Not Acceptable"),
PROXY_AUTHENTICATION_REQUIRED(407, "Proxy Authentication Required"),
REQUEST_TIMEOUT(408, "Request Timeout"),
CONFLICT(409, "Conflict"),
GONE(410, "Gone"),
LENGTH_REQUIRED(411, "Length Required"),
PRECONDITION_FAILED(412, "Precondition Failed"),
PAYLOAD_TOO_LARGE(413, "Payload Too Large"),
URI_TOO_LONG(414, "URI Too Long"),
UNSUPPORTED_MEDIA_TYPE(415, "Unsupported Media Type"),
REQUESTED_RANGE_NOT_SATISFIABLE(416, "Requested Range Not Satisfiable"),
EXPECTATION_FAILED(417, "Expectation Failed"), PRECONDITION_REQUIRED(428, "Precondition Required"),
RANGE_NOT_SATISFIABLE(416, "Range Not Satisfiable"),
EXPECTATION_FAILED(417, "Expectation Failed"),
PRECONDITION_REQUIRED(428, "Precondition Required"), // from RFC 6585
INTERNAL_SERVER_ERROR(500, "Internal Server Error"), NOT_IMPLEMENTED(501, "Not Implemented"), BAD_GATEWAY(502,
"Bad Gateway"), SERVICE_UNAVAILABLE(503, "Service Unavailable"), GATEWAY_TIMEOUT(504, "Gateway Timeout"),
INTERNAL_SERVER_ERROR(500, "Internal Server Error"),
NOT_IMPLEMENTED(501, "Not Implemented"),
BAD_GATEWAY(502, "Bad Gateway"),
SERVICE_UNAVAILABLE(503, "Service Unavailable"),
GATEWAY_TIMEOUT(504, "Gateway Timeout"),
HTTP_VERSION_NOT_SUPPORTED(505, "HTTP Version Not Supported");
private final int code;
private final String info;
@ -52,8 +73,7 @@ public enum HttpStatusCode {
}
/**
* Convert a numerical status code into the corresponding status enum object.
*
* Converts a numerical status code into the corresponding status enum object.
* @param statusCode the numerical status code
* @return the matching status enum object or null if no matching enum is defined
*/
@ -67,8 +87,7 @@ public enum HttpStatusCode {
}
/**
* Get the associated status code.
*
* Gets the associated status code.
* @return the status code.
*/
public int getStatusCode() {
@ -76,8 +95,7 @@ public enum HttpStatusCode {
}
/**
* Get the status code info.
*
* Gets the status code info.
* @return the status code info
*/
public String getInfo() {
@ -85,9 +103,7 @@ public enum HttpStatusCode {
}
/**
* Get the status code info.
*
* @return the status code info
* The status code info is the readable form of the status code.
*/
@Override
public String toString() {

View File

@ -29,7 +29,7 @@ import org.junit.Test;
public class ContentTypeTest {
@Test
public void testCreate() {
public void create() {
assertEquals("a/b", ContentType.create("a/b").toContentTypeString());
assertEquals(ContentType.create("a/b;c=d;x=y"), ContentType.create("a/b;x=y;c=d"));
assertEquals(ContentType.create("a/b;c=d;x=y"), ContentType.create("a/b; x=y; c=d"));
@ -37,47 +37,47 @@ public class ContentTypeTest {
}
@Test(expected = IllegalArgumentException.class)
public void testCreateFail1() {
public void createFail1() {
ContentType.create("a");
}
@Test(expected = IllegalArgumentException.class)
public void testCreateFail2() {
public void createFail2() {
ContentType.create(" a / b ");
}
@Test(expected = IllegalArgumentException.class)
public void testCreateFail3() {
public void createFail3() {
ContentType.create("a/b;");
}
@Test(expected = IllegalArgumentException.class)
public void testCreateFail4() {
public void createFail4() {
ContentType.create("a/b;parameter");
}
@Test(expected = IllegalArgumentException.class)
public void testCreateFail5() {
public void createFail5() {
ContentType.create("a/b;parameter=");
}
@Test(expected = IllegalArgumentException.class)
public void testCreateFail6() {
public void createFail6() {
ContentType.create("a/b;=value");
}
@Test(expected = IllegalArgumentException.class)
public void testCreateFail7() {
public void createFail7() {
ContentType.create("a/b;the name=value");
}
@Test(expected = IllegalArgumentException.class)
public void testCreateFail8() {
public void createFail8() {
ContentType.create("a/b;name= value");
}
@Test
public void testCreateWithParameter() {
public void createWithParameter() {
assertEquals(ContentType.create("a/b;c=d"), ContentType.create(ContentType.create("a/b"), "c", "d"));
assertEquals(ContentType.create("a/b;e=f;c=d"), ContentType.create(
ContentType.create(ContentType.create("a/b"), "c", "d"), "e", "f"));
@ -86,7 +86,7 @@ public class ContentTypeTest {
}
@Test
public void testCreateAndModify() {
public void createAndModify() {
ContentType ct1 = ContentType.create("a/b");
assertEquals(ContentType.create("a/b;c=d"), ContentType.create(ct1, "c", "d"));
@ -98,7 +98,7 @@ public class ContentTypeTest {
}
@Test
public void testParse() {
public void parse() {
assertNull(ContentType.parse("a"));
assertNull(ContentType.parse("a/b;c"));
assertNull(ContentType.parse("a/b;c="));
@ -106,12 +106,12 @@ public class ContentTypeTest {
}
@Test(expected = IllegalArgumentException.class)
public void testWildcardFail() {
public void wildcardFail() {
ContentType.create("*/*");
}
@Test
public void testCharsetUtf8() {
public void charsetUtf8() {
ContentType ct1 = ContentType.create("a/b;charset=utf8");
ContentType ct2 = ContentType.create("a/b;charset=utf-8");
@ -123,4 +123,11 @@ public class ContentTypeTest {
assertTrue(ct1.isCompatible(ct2));
}
@Test
public void toContentTypeString() {
assertEquals("application/json;a=b;c=d",
ContentType.create(ContentType.create(ContentType.APPLICATION_JSON, "a", "b"), "c", "d")
.toContentTypeString());
}
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.olingo.commons.api.http;
package org.apache.olingo.server.api;
import java.util.ArrayList;
import java.util.Collection;
@ -26,6 +26,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.olingo.commons.api.http.HttpHeader;
/**
* HttpHeader container
*/

View File

@ -24,7 +24,6 @@ import java.util.List;
import java.util.Map;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpHeaders;
import org.apache.olingo.commons.api.http.HttpMethod;
/**

View File

@ -24,7 +24,6 @@ import java.util.List;
import java.util.Map;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpHeaders;
import org.apache.olingo.commons.api.http.HttpStatusCode;
/**

View File

@ -30,24 +30,25 @@ import org.apache.olingo.server.api.etag.ServiceMetadataETagSupport;
*/
public interface ServiceMetadata {
/**
*
* Gets the entity data model.
* @return entity data model of this service
*/
Edm getEdm();
/**
*
* Get the data-service version.
* @return data service version of this service
*/
ODataServiceVersion getDataServiceVersion();
/**
*
* Gets the list of references defined for this service.
* @return list of defined emdx references of this service
*/
List<EdmxReference> getReferences();
/**
* Gets the helper for ETag support of the metadata document (may be NULL).
* @return metadata ETag support
*/
ServiceMetadataETagSupport getServiceMetadataETagSupport();

View File

@ -20,10 +20,10 @@ package org.apache.olingo.server.core.responses;
import java.util.Map;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.ODataLibraryException;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
import org.apache.olingo.server.api.serializer.SerializerException;
@ -48,7 +48,7 @@ public class CountResponse extends ServiceResponse {
assert (!isClosed());
this.response.setContent(this.serializer.count(count));
writeOK(HttpContentType.TEXT_PLAIN);
writeOK(ContentType.TEXT_PLAIN);
close();
}

View File

@ -89,7 +89,7 @@ public class EntityResponse extends ServiceResponse {
// write the entity to response
this.response.setContent(this.serializer.entity(this.metadata, entityType, entity, this.options).getContent());
writeOK(this.responseContentType.toContentTypeString());
writeOK(responseContentType);
close();
}

View File

@ -72,7 +72,7 @@ public class EntitySetResponse extends ServiceResponse {
// write the whole collection to response
this.response.setContent(this.serializer.entityCollection(metadata, entityType, entitySet, this.options)
.getContent());
writeOK(this.responseContentType.toContentTypeString());
writeOK(responseContentType);
close();
}

View File

@ -51,7 +51,7 @@ public class MetadataResponse extends ServiceResponse {
public void writeMetadata()throws ODataLibraryException {
assert (!isClosed());
this.response.setContent(this.serializer.metadataDocument(this.metadata).getContent());
writeOK(this.responseContentType.toContentTypeString());
writeOK(responseContentType);
close();
}

View File

@ -24,10 +24,10 @@ import java.util.Map;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmReturnType;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.server.api.ODataApplicationException;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.ODataLibraryException;
import org.apache.olingo.server.api.ODataResponse;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
import org.apache.olingo.server.api.serializer.PrimitiveValueSerializerOptions;
@ -91,7 +91,7 @@ public class PrimitiveValueResponse extends ServiceResponse {
(EdmPrimitiveType) this.returnType.getType(), value, options));
}
writeOK(HttpContentType.TEXT_PLAIN);
writeOK(ContentType.TEXT_PLAIN);
}
public void writeEdmBinary(byte[] value) throws SerializerException {
@ -100,7 +100,7 @@ public class PrimitiveValueResponse extends ServiceResponse {
return;
}
this.response.setContent(new ByteArrayInputStream(value));
writeOK(HttpContentType.APPLICATION_OCTET_STREAM);
writeOK(ContentType.APPLICATION_OCTET_STREAM);
}
public boolean isReturnCollection() {

View File

@ -113,7 +113,7 @@ public class PropertyResponse extends ServiceResponse {
this.response.setContent(this.serializer.complex(this.metadata, type, property,
this.complexOptions).getContent());
}
writeOK(this.responseContentType.toContentTypeString());
writeOK(responseContentType);
close();
}
@ -126,7 +126,7 @@ public class PropertyResponse extends ServiceResponse {
this.response.setContent(
this.serializer.primitive(metadata, type, property, this.primitiveOptions).getContent());
}
writeOK(this.responseContentType.toContentTypeString());
writeOK(responseContentType);
close();
}

View File

@ -52,7 +52,7 @@ public class ServiceDocumentResponse extends ServiceResponse {
throws ODataLibraryException {
assert (!isClosed());
this.response.setContent(this.serializer.serviceDocument(metadata, serviceRoot).getContent());
writeOK(this.responseContentType.toContentTypeString());
writeOK(responseContentType);
close();
}

View File

@ -22,6 +22,7 @@ package org.apache.olingo.server.core.responses;
import java.io.InputStream;
import java.util.Map;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.ODataApplicationException;
@ -90,9 +91,9 @@ public abstract class ServiceResponse {
}
}
public void writeOK(String contentType) {
public void writeOK(ContentType contentType) {
this.response.setStatusCode(HttpStatusCode.OK.getStatusCode());
this.response.setHeader(HttpHeader.CONTENT_TYPE, contentType);
this.response.setHeader(HttpHeader.CONTENT_TYPE, contentType.toContentTypeString());
}
public void writeHeader(String key, String value) {

View File

@ -36,13 +36,13 @@ public class StreamResponse extends ServiceResponse {
public void writeStreamResponse(InputStream streamContent, ContentType contentType) {
this.response.setContent(streamContent);
writeOK(contentType.toContentTypeString());
writeOK(contentType);
close();
}
public void writeBinaryResponse(byte[] streamContent, ContentType contentType) {
this.response.setContent(new ByteArrayInputStream(streamContent));
writeOK(contentType.toContentTypeString());
writeOK(contentType);
close();
}

View File

@ -20,7 +20,6 @@ package org.apache.olingo.server.core.deserializer.xml;
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
@ -290,11 +289,7 @@ public class ODataXmlDeserializer implements ODataDeserializer {
final XMLEvent event = reader.nextEvent();
if (event.isCharacters() && !event.asCharacters().isWhiteSpace()) {
try {
object.setCommonProperty(key, event.asCharacters().getData());
} catch (ParseException e) {
throw new XMLStreamException("While parsing Atom entry or feed common elements", e);
}
object.setCommonProperty(key, event.asCharacters().getData());
}
if (event.isEndElement() && start.getName().equals(event.asEndElement().getName())) {

View File

@ -32,7 +32,7 @@ import java.util.Map;
import java.util.UUID;
import org.apache.olingo.commons.api.ex.ODataRuntimeException;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.ODataResponse;
@ -104,8 +104,8 @@ public class BatchResponseSerializer {
}
private void appendChangeSetHeader(final BodyBuilder builder, final String changeSetBoundary) {
appendHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED + "; boundary="
+ changeSetBoundary, builder);
appendHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED
+ "; boundary=" + changeSetBoundary, builder);
}
private void appendHeader(final String name, final String value, final BodyBuilder builder) {
@ -149,7 +149,7 @@ public class BatchResponseSerializer {
private void appendBodyPartHeader(final ODataResponse response, final BodyBuilder builder,
final boolean isChangeSet) throws BatchSerializerException {
appendHeader(HttpHeader.CONTENT_TYPE, HttpContentType.APPLICATION_HTTP, builder);
appendHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_HTTP.toContentTypeString(), builder);
appendHeader(BatchParserCommon.CONTENT_TRANSFER_ENCODING, BatchParserCommon.BINARY_ENCODING, builder);
if (isChangeSet) {

View File

@ -45,12 +45,10 @@ import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmStructuredType;
import org.apache.olingo.commons.api.edm.EdmType;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
import org.apache.olingo.commons.core.edm.primitivetype.EdmString;
import org.apache.olingo.server.api.ODataServerError;
import org.apache.olingo.server.api.ServiceMetadata;

View File

@ -31,7 +31,6 @@ import java.util.Arrays;
import java.util.List;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.server.api.ODataRequest;
import org.apache.olingo.server.api.serializer.CustomContentTypeSupport;
@ -45,13 +44,13 @@ public class ContentNegotiatorTest {
static final private String ACCEPT_CASE_MIN_UTF8 = "application/json;charset=UTF-8;odata.metadata=minimal";
static final private String ACCEPT_CASE_FULL = "application/json;odata.metadata=full";
static final private String ACCEPT_CASE_NONE = "application/json;odata.metadata=none";
static final private String ACCEPT_CASE_MIN_UTF8_IEEE754
= "application/json;charset=UTF-8;odata.metadata=minimal;IEEE754Compatible=true";
static final private String ACCEPT_CASE_MIN_IEEE754
= "application/json;odata.metadata=minimal;IEEE754Compatible=true";
static final private String ACCEPT_CASE_MIN_UTF8_IEEE754 =
"application/json;charset=UTF-8;odata.metadata=minimal;IEEE754Compatible=true";
static final private String ACCEPT_CASE_MIN_IEEE754 =
"application/json;odata.metadata=minimal;IEEE754Compatible=true";
static final private String ACCEPT_CASE_JSONQ = "application/json;q=0.2";
static final private String ACCEPT_CASE_XML = HttpContentType.APPLICATION_XML;
static final private String ACCEPT_CASE_WILDCARD1 = HttpContentType.WILDCARD;
static final private String ACCEPT_CASE_XML = ContentType.APPLICATION_XML.toContentTypeString();
static final private String ACCEPT_CASE_WILDCARD1 = "*/*";
static final private String ACCEPT_CASE_WILDCARD2 = "application/*";
//@formatter:off (Eclipse formatter)

View File

@ -35,7 +35,7 @@ import java.util.Map;
import java.util.UUID;
import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.commons.api.http.HttpStatusCode;
@ -53,8 +53,8 @@ import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
import org.apache.olingo.server.api.processor.BatchProcessor;
import org.apache.olingo.server.api.serializer.BatchSerializerException;
import org.apache.olingo.server.core.ODataHandler;
import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
import org.apache.olingo.server.core.deserializer.batch.BatchLineReader;
import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
import org.junit.Before;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
@ -619,7 +619,7 @@ public class MockedBatchHandlerTest {
odata.createFixedFormatSerializer().batchResponse(responseParts, responeBoundary);
response.setStatusCode(HttpStatusCode.ACCEPTED.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED + ";boundary=" + responeBoundary);
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary=" + responeBoundary);
response.setContent(responseStream);
}

View File

@ -25,7 +25,7 @@ import static org.junit.Assert.assertTrue;
import java.util.Arrays;
import java.util.List;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.junit.Test;
@ -34,15 +34,16 @@ public class HeaderTest {
@Test
public void test() {
Header header = new Header(1);
header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
header.addHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED.toContentTypeString(), 1);
assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeader(HttpHeader.CONTENT_TYPE));
assertEquals(ContentType.MULTIPART_MIXED.toContentTypeString(), header.getHeader(HttpHeader.CONTENT_TYPE));
assertEquals(1, header.getHeaders(HttpHeader.CONTENT_TYPE).size());
assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeaders(HttpHeader.CONTENT_TYPE).get(0));
assertEquals(ContentType.MULTIPART_MIXED.toContentTypeString(),
header.getHeaders(HttpHeader.CONTENT_TYPE).get(0));
}
@Test
public void testNotAvailable() {
public void notAvailable() {
Header header = new Header(1);
assertNull(header.getHeader(HttpHeader.CONTENT_TYPE));
@ -50,28 +51,29 @@ public class HeaderTest {
}
@Test
public void testCaseInsensitive() {
public void caseInsensitive() {
Header header = new Header(1);
header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
header.addHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED.toContentTypeString(), 1);
assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeader("cOnTenT-TyPE"));
assertEquals(ContentType.MULTIPART_MIXED.toContentTypeString(), header.getHeader("cOnTenT-TyPE"));
assertEquals(1, header.getHeaders("cOnTenT-TyPE").size());
assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeaders("cOnTenT-TyPE").get(0));
assertEquals(ContentType.MULTIPART_MIXED.toContentTypeString(), header.getHeaders("cOnTenT-TyPE").get(0));
}
@Test
public void testDuplicatedAdd() {
public void duplicatedAdd() {
Header header = new Header(1);
header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 2);
header.addHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED.toContentTypeString(), 1);
header.addHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED.toContentTypeString(), 2);
assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeader(HttpHeader.CONTENT_TYPE));
assertEquals(ContentType.MULTIPART_MIXED.toContentTypeString(), header.getHeader(HttpHeader.CONTENT_TYPE));
assertEquals(1, header.getHeaders(HttpHeader.CONTENT_TYPE).size());
assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeaders(HttpHeader.CONTENT_TYPE).get(0));
assertEquals(ContentType.MULTIPART_MIXED.toContentTypeString(),
header.getHeaders(HttpHeader.CONTENT_TYPE).get(0));
}
@Test
public void testFieldName() {
public void fieldName() {
Header header = new Header(0);
header.addHeader("MyFieldNamE", "myValue", 1);
@ -84,9 +86,9 @@ public class HeaderTest {
}
@Test
public void testDeepCopy() {
public void deepCopy() {
Header header = new Header(1);
header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED + ";boundary=123", 1);
header.addHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary=123", 1);
Header copy = header.clone();
assertEquals(header.getHeaders(HttpHeader.CONTENT_TYPE), copy.getHeaders(HttpHeader.CONTENT_TYPE));
@ -98,23 +100,26 @@ public class HeaderTest {
}
@Test
public void testDuplicatedAddList() {
public void duplicatedAddList() {
Header header = new Header(1);
header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
header.addHeader(HttpHeader.CONTENT_TYPE, Arrays.asList(new String[] { HttpContentType.MULTIPART_MIXED,
HttpContentType.APPLICATION_ATOM_SVC }), 2);
header.addHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED.toContentTypeString(), 1);
header.addHeader(HttpHeader.CONTENT_TYPE, Arrays.asList(new String[] {
ContentType.MULTIPART_MIXED.toContentTypeString(),
ContentType.APPLICATION_ATOM_SVC.toContentTypeString() }), 2);
assertEquals(HttpContentType.MULTIPART_MIXED + ", " + HttpContentType.APPLICATION_ATOM_SVC, header
assertEquals(ContentType.MULTIPART_MIXED + ", " + ContentType.APPLICATION_ATOM_SVC, header
.getHeader(HttpHeader.CONTENT_TYPE));
assertEquals(2, header.getHeaders(HttpHeader.CONTENT_TYPE).size());
assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeaders(HttpHeader.CONTENT_TYPE).get(0));
assertEquals(HttpContentType.APPLICATION_ATOM_SVC, header.getHeaders(HttpHeader.CONTENT_TYPE).get(1));
assertEquals(ContentType.MULTIPART_MIXED.toContentTypeString(),
header.getHeaders(HttpHeader.CONTENT_TYPE).get(0));
assertEquals(ContentType.APPLICATION_ATOM_SVC.toContentTypeString(),
header.getHeaders(HttpHeader.CONTENT_TYPE).get(1));
}
@Test
public void testRemove() {
public void remove() {
Header header = new Header(1);
header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
header.addHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED.toContentTypeString(), 1);
header.removeHeader(HttpHeader.CONTENT_TYPE);
assertNull(header.getHeader(HttpHeader.CONTENT_TYPE));
@ -122,25 +127,28 @@ public class HeaderTest {
}
@Test
public void testMultipleValues() {
public void multipleValues() {
Header header = new Header(1);
header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.APPLICATION_ATOM_SVC, 2);
header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.APPLICATION_ATOM_XML, 3);
header.addHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED.toContentTypeString(), 1);
header.addHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_ATOM_SVC.toContentTypeString(), 2);
header.addHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_ATOM_XML.toContentTypeString(), 3);
final String fullHeaderString =
HttpContentType.MULTIPART_MIXED + ", " + HttpContentType.APPLICATION_ATOM_SVC + ", "
+ HttpContentType.APPLICATION_ATOM_XML;
ContentType.MULTIPART_MIXED + ", " + ContentType.APPLICATION_ATOM_SVC + ", "
+ ContentType.APPLICATION_ATOM_XML;
assertEquals(fullHeaderString, header.getHeader(HttpHeader.CONTENT_TYPE));
assertEquals(3, header.getHeaders(HttpHeader.CONTENT_TYPE).size());
assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeaders(HttpHeader.CONTENT_TYPE).get(0));
assertEquals(HttpContentType.APPLICATION_ATOM_SVC, header.getHeaders(HttpHeader.CONTENT_TYPE).get(1));
assertEquals(HttpContentType.APPLICATION_ATOM_XML, header.getHeaders(HttpHeader.CONTENT_TYPE).get(2));
assertEquals(ContentType.MULTIPART_MIXED.toContentTypeString(),
header.getHeaders(HttpHeader.CONTENT_TYPE).get(0));
assertEquals(ContentType.APPLICATION_ATOM_SVC.toContentTypeString(),
header.getHeaders(HttpHeader.CONTENT_TYPE).get(1));
assertEquals(ContentType.APPLICATION_ATOM_XML.toContentTypeString(),
header.getHeaders(HttpHeader.CONTENT_TYPE).get(2));
}
@Test
public void testSplitValues() {
public void splitValues() {
final String values = "abc, def,123,77, 99, ysd";
List<String> splittedValues = Header.splitValuesByComma(values);

View File

@ -28,7 +28,6 @@ import org.apache.olingo.commons.api.data.EntityCollection;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.commons.api.http.HttpStatusCode;
@ -104,7 +103,7 @@ public class TechnicalEntityProcessor extends TechnicalProcessor
response.setContent(odata.createFixedFormatSerializer().count(
entitySet.getEntities().size()));
response.setStatusCode(HttpStatusCode.OK.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, HttpContentType.TEXT_PLAIN);
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.TEXT_PLAIN.toContentTypeString());
}
@Override

View File

@ -33,13 +33,12 @@ import java.util.Collections;
import java.util.Locale;
import org.apache.commons.io.IOUtils;
import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.apache.olingo.commons.api.edm.provider.CsdlAbstractEdmProvider;
import org.apache.olingo.commons.api.edm.provider.CsdlEntitySet;
import org.apache.olingo.commons.api.ex.ODataException;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpMethod;
import org.apache.olingo.commons.api.http.HttpStatusCode;
@ -143,7 +142,7 @@ public class ODataHandlerTest {
public void metadataDefault() throws Exception {
final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", null);
assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
assertEquals(HttpContentType.APPLICATION_XML, response.getHeader(HttpHeader.CONTENT_TYPE));
assertEquals(ContentType.APPLICATION_XML.toContentTypeString(), response.getHeader(HttpHeader.CONTENT_TYPE));
assertNotNull(response.getContent());
assertThat(IOUtils.toString(response.getContent()),

View File

@ -22,7 +22,7 @@ import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.core.Encoder;
import org.apache.olingo.commons.core.edm.EdmProviderImpl;
import org.apache.olingo.commons.core.edm.primitivetype.EdmBinary;
@ -2614,9 +2614,9 @@ public class TestFullResourcePath {
testUri.run("ESKeyNav(1)", "$format=Test_all_valid_signsSpecified_for_format_signs%26-._~$@%27/Aa123%26-._~$@%27")
.isKind(UriInfoKind.resource).goPath()
.isFormatText("Test_all_valid_signsSpecified_for_format_signs&-._~$@'/Aa123&-._~$@'");
testUri.run("ESKeyNav(1)", "$format=" + HttpContentType.APPLICATION_ATOM_XML_ENTRY_UTF8)
testUri.run("ESKeyNav(1)", "$format=" + ContentType.APPLICATION_ATOM_XML_ENTRY_UTF8)
.isKind(UriInfoKind.resource).goPath()
.isFormatText(HttpContentType.APPLICATION_ATOM_XML_ENTRY_UTF8);
.isFormatText(ContentType.APPLICATION_ATOM_XML_ENTRY_UTF8.toContentTypeString());
testUri.runEx("ESKeyNav(1)", "$format=noSlash")
.isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT);
testUri.runEx("ESKeyNav(1)", "$format=slashAtEnd/")

View File

@ -34,7 +34,6 @@ import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.http.HttpContentType;
import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.server.api.OData;
@ -216,7 +215,7 @@ public class CarsProcessor implements EntityCollectionProcessor, EntityProcessor
value.getBytes(Charset.forName("UTF-8")));
response.setContent(serializerContent);
response.setStatusCode(HttpStatusCode.OK.getStatusCode());
response.setHeader(HttpHeader.CONTENT_TYPE, HttpContentType.TEXT_PLAIN);
response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.TEXT_PLAIN.toContentTypeString());
}
}
}