Examples of toContentTypeString()


Examples of org.apache.olingo.odata2.core.commons.ContentType.toContentTypeString()

          context.getRequestHeader(HttpHeaders.IF_MODIFIED_SINCE),
          context.getRequestHeader(HttpHeaders.IF_UNMODIFIED_SINCE));

      timingHandle2 = context.startRuntimeMeasurement("Dispatcher", "dispatch");
      odataResponse =
          dispatcher.dispatch(method, uriInfo, request.getBody(), request.getContentType(), acceptContentType
              .toContentTypeString());
      context.stopRuntimeMeasurement(timingHandle2);

      ODataResponseBuilder extendedResponse = ODataResponse.fromResponse(odataResponse);
      final UriType uriType = uriInfo.getUriType();
View Full Code Here

Examples of org.apache.olingo.odata2.core.commons.ContentType.toContentTypeString()

      if (!odataResponse.containsHeader(ODataHttpHeaders.DATASERVICEVERSION)) {
        extendedResponse = extendedResponse.header(ODataHttpHeaders.DATASERVICEVERSION, serverDataServiceVersion);
      }
      if (!HttpStatusCodes.NO_CONTENT.equals(s) && !odataResponse.containsHeader(HttpHeaders.CONTENT_TYPE)) {
        extendedResponse.header(HttpHeaders.CONTENT_TYPE, acceptContentType.toContentTypeString());
      }

      odataResponse = extendedResponse.build();
    } catch (final Exception e) {
      exception = e;
View Full Code Here

Examples of org.apache.olingo.odata2.core.commons.ContentType.toContentTypeString()

public class ContentNegotiatorTest {

  private void negotiateContentType(final List<ContentType> contentTypes, final List<ContentType> supportedTypes,
      final String expected) throws ODataException {
    final ContentType contentType = new ContentNegotiator().contentNegotiation(contentTypes, supportedTypes);
    assertEquals(expected, contentType.toContentTypeString());
  }

  @Test
  public void defaultContentTypeForEmptyList() throws ODataException {
    List<ContentType> contentTypes = Arrays.asList();
View Full Code Here

Examples of org.apache.olingo.odata2.core.commons.ContentType.toContentTypeString()

        ContentType tmpContentType = acceptHeader2ContentType.get(acceptHeader);
        if (tmpContentType == null) {
          tmpContentType = ContentType.create(ContentType.create(acceptHeader),
              ContentType.PARAMETER_CHARSET, ContentType.CHARSET_UTF_8);
        }
        expectedContentType = tmpContentType.toContentTypeString();
      }
      return expectedContentType;
    }
  }
View Full Code Here

Examples of org.apache.olingo.odata2.core.commons.ContentType.toContentTypeString()

public class ContentNegotiatorTest {

  private void negotiateContentType(final List<ContentType> contentTypes, final List<ContentType> supportedTypes,
      final String expected) throws ODataException {
    final ContentType contentType = new ContentNegotiator().contentNegotiation(contentTypes, supportedTypes);
    assertEquals(expected, contentType.toContentTypeString());
  }

  @Test(expected = IllegalArgumentException.class)
  public void invalidContentNegotiatorCreation() throws ODataException {
    final ContentType contentType = new ContentNegotiator().doContentNegotiation(null, null, null);
View Full Code Here

Examples of org.apache.olingo.odata2.core.commons.ContentType.toContentTypeString()

          context.getRequestHeader(HttpHeaders.IF_MODIFIED_SINCE),
          context.getRequestHeader(HttpHeaders.IF_UNMODIFIED_SINCE));

      timingHandle2 = context.startRuntimeMeasurement("Dispatcher", "dispatch");
      odataResponse =
          dispatcher.dispatch(method, uriInfo, request.getBody(), request.getContentType(), acceptContentType
              .toContentTypeString());
      context.stopRuntimeMeasurement(timingHandle2);

      ODataResponseBuilder extendedResponse = ODataResponse.fromResponse(odataResponse);
      final UriType uriType = uriInfo.getUriType();
View Full Code Here

Examples of org.apache.olingo.odata2.core.commons.ContentType.toContentTypeString()

      if (!odataResponse.containsHeader(ODataHttpHeaders.DATASERVICEVERSION)) {
        extendedResponse = extendedResponse.header(ODataHttpHeaders.DATASERVICEVERSION, serverDataServiceVersion);
      }
      if (!HttpStatusCodes.NO_CONTENT.equals(s) && !odataResponse.containsHeader(HttpHeaders.CONTENT_TYPE)) {
        extendedResponse.header(HttpHeaders.CONTENT_TYPE, acceptContentType.toContentTypeString());
      }

      odataResponse = extendedResponse.build();
    } catch (final Exception e) {
      exception = e;
View Full Code Here

Examples of org.apache.olingo.odata2.core.commons.ContentType.toContentTypeString()

    ContentType ctGif = ContentType.create("image", "gif");

    List<String> types = service.getSupportedContentTypes(EntityLinkProcessor.class);
    assertTrue(types.contains(APPLICATION_XML));
    assertTrue(types.contains(APPLICATION_JSON));
    assertFalse(types.contains(ctGif.toContentTypeString()));
  }

  @Test
  public void defaultSupportedContentTypesAndGifForEntityLink() throws Exception {
    String ctGif = ContentType.create("image", "gif").toContentTypeString();
View Full Code Here

Examples of org.apache.olingo.odata2.core.commons.ContentType.toContentTypeString()

      ContentType acceptContentType =
          new ContentNegotiator().doContentNegotiation(request, uriInfo, supportedContentTypes);

      timingHandle2 = context.startRuntimeMeasurement("Dispatcher", "dispatch");
      odataResponse =
          dispatcher.dispatch(method, uriInfo, request.getBody(), request.getContentType(), acceptContentType
              .toContentTypeString());
      context.stopRuntimeMeasurement(timingHandle2);

      ODataResponseBuilder extendedResponse = ODataResponse.fromResponse(odataResponse);
      final UriType uriType = uriInfo.getUriType();
View Full Code Here

Examples of org.apache.olingo.odata2.core.commons.ContentType.toContentTypeString()

      if (!odataResponse.containsHeader(ODataHttpHeaders.DATASERVICEVERSION)) {
        extendedResponse = extendedResponse.header(ODataHttpHeaders.DATASERVICEVERSION, serverDataServiceVersion);
      }
      if (!HttpStatusCodes.NO_CONTENT.equals(s) && !odataResponse.containsHeader(HttpHeaders.CONTENT_TYPE)) {
        extendedResponse.header(HttpHeaders.CONTENT_TYPE, acceptContentType.toContentTypeString());
      }

      odataResponse = extendedResponse.build();
    } catch (final Exception e) {
      exception = e;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.