Examples of contentType()


Examples of org.elasticsearch.common.xcontent.XContentParser.contentType()

            switch (token) {
                case START_ARRAY:
                    if ("requests".equals(fieldName)) {
                        while ((token = p.nextToken()) != XContentParser.Token.END_ARRAY) {
                            assert token == XContentParser.Token.START_OBJECT;
                            XContentBuilder payloadBuilder = XContentFactory.contentBuilder(p.contentType()).copyCurrentStructure(p);
                            SearchRequest req = new SearchRequest();
                            req.source(payloadBuilder.bytes(), contentUnsafe);
                            builder.addSearchRequest(req);
                        }
                    } else if ("competitors".equals(fieldName)) {
View Full Code Here

Examples of org.elasticsearch.view.ViewResult.contentType()

                .source(getResult.sourceAsMap());

        // Ok, let's render it with a ViewEngineService
        ViewResult result = viewService.render(viewContext);

        return new ViewResponse(result.contentType(), result.content());
    }

    private ViewContext extract(Map<String, Object> sourceAsMap, String format) {
        if (sourceAsMap != null) {
            for (String key : sourceAsMap.keySet()) {
View Full Code Here

Examples of org.infinispan.rest.MimeMetadata.contentType()

   @Override
   public String getContentType(MarshalledEntry entry) {
      //ugly, to be solved together with ISPN-3460
      InternalMetadataImpl mei = (InternalMetadataImpl) entry.getMetadata();
      MimeMetadata metadata = (MimeMetadata) mei.actual();
      return metadata.contentType();
   }

   @Override
   public Metadata buildMetadata(String contentType, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) {
      return MimeMetadata.apply(contentType, lifespan, lifespanUnit, maxIdle, maxIdleUnit);
View Full Code Here

Examples of org.jboss.aerogear.controller.mocks.RouteTester.contentType()

                        .consumes(JSON)
                        .produces(MediaType.JSON)
                        .to(SampleController.class).save(param(Car.class));
            }
        }).requestMethod(POST).acceptHeader(JSON).body("{\"color\":\"red\", \"brand\":\"mini\"}");
        final InvocationResult invocationResult = routeTester.contentType("invalid/type").processPostRequest("/cars");
        assertThat(invocationResult.getResult()).isInstanceOf(RuntimeException.class);
    }

    @Test
    public void testOrderMultipleAcceptHeaders() throws Exception {
View Full Code Here

Examples of org.jboss.resteasy.mock.MockHttpRequest.contentType()

   }

   public Response executeEntity(String method, String uri, String contentType, Object entity)
   {
      MockHttpRequest post = createRequest(uri, method);
      post.contentType(contentType);
      return getResponse(post, entity);
   }

   public Response postEntity(String uri, String contentType, Object entity)
   {
View Full Code Here

Examples of org.jboss.resteasy.mock.MockHttpRequest.contentType()

         Assert.assertEquals("basic", response.getContentAsString());
      }
      {
         MockHttpRequest request = MockHttpRequest.put("/basic");
         request.content("basic".getBytes());
         request.contentType("text/plain");
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);

View Full Code Here

Examples of org.jboss.resteasy.mock.MockHttpRequest.contentType()

         Assert.assertEquals("basic", response.getContentAsString());
      }
      {
         MockHttpRequest request = MockHttpRequest.put("/locating/basic");
         request.content("basic".getBytes());
         request.contentType("text/plain");
         MockHttpResponse response = new MockHttpResponse();

         dispatcher.invoke(request, response);

View Full Code Here

Examples of org.jclouds.io.payloads.Part.PartOptions.contentType()

      ImmutableList.Builder<Part> parts = ImmutableList.<Part> builder();
      for (Parameter param : parametersWithAnnotation(invocation.getInvokable(), PartParam.class)) {
         PartParam partParam = param.getAnnotation(PartParam.class);
         PartOptions options = new PartOptions();
         if (!PartParam.NO_CONTENT_TYPE.equals(partParam.contentType()))
            options.contentType(partParam.contentType());
         if (!PartParam.NO_FILENAME.equals(partParam.filename()))
            options.filename(replaceTokens(partParam.filename(), tokenValues));
         Object arg = invocation.getArgs().get(param.hashCode());
         checkNotNull(arg, partParam.name());
         Part part = Part.create(partParam.name(), newPayload(arg), options);
View Full Code Here

Examples of org.jclouds.io.payloads.Part.PartOptions.contentType()

      ImmutableList.Builder<Part> parts = ImmutableList.<Part> builder();
      for (Parameter param : parametersWithAnnotation(invocation.getInvokable(), PartParam.class)) {
         PartParam partParam = param.getAnnotation(PartParam.class);
         PartOptions options = new PartOptions();
         if (!PartParam.NO_CONTENT_TYPE.equals(partParam.contentType()))
            options.contentType(partParam.contentType());
         if (!PartParam.NO_FILENAME.equals(partParam.filename()))
            options.filename(replaceTokens(partParam.filename(), tokenValues));
         Object arg = invocation.getArgs().get(param.hashCode());
         checkNotNull(arg, partParam.name());
         Part part = Part.create(partParam.name(), newPayload(arg), options);
View Full Code Here

Examples of org.jclouds.io.payloads.Part.PartOptions.contentType()

      ImmutableList.Builder<Part> parts = ImmutableList.<Part> builder();
      for (Parameter param : parametersWithAnnotation(invocation.getInvokable(), PartParam.class)) {
         PartParam partParam = param.getAnnotation(PartParam.class);
         PartOptions options = new PartOptions();
         if (!PartParam.NO_CONTENT_TYPE.equals(partParam.contentType()))
            options.contentType(partParam.contentType());
         if (!PartParam.NO_FILENAME.equals(partParam.filename()))
            options.filename(replaceTokens(partParam.filename(), tokenValues));
         Object arg = invocation.getArgs().get(param.hashCode());
         checkNotNull(arg, partParam.name());
         Part part = Part.create(partParam.name(), newPayload(arg), options);
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.