Package org.jboss.resteasy.plugins.providers.multipart

Examples of org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput


   @Test
   public void testMultipartFormDataOutput() throws Exception
   {
      MultipartClient client = ProxyFactory.create(MultipartClient.class,
              generateBaseUrl());
      MultipartFormDataOutput output = new MultipartFormDataOutput();
      output.addFormData("bill", new Customer("bill"),
              MediaType.APPLICATION_XML_TYPE);
      output.addFormData("monica", new Customer("monica"),
              MediaType.APPLICATION_XML_TYPE);
      client.putFormData(output);
   }
View Full Code Here


public class MultipartResource {

    @GET
    @Produces("multipart/related")
    public MultipartFormDataOutput get() {
        MultipartFormDataOutput output = new MultipartFormDataOutput();
        output.addPart("Hello", MediaType.TEXT_PLAIN_TYPE);
        output.addPart("World", MediaType.TEXT_PLAIN_TYPE);
        return output;
    }
View Full Code Here

   }

   @Test
   public void testPutForm() throws Exception
   {
      MultipartFormDataOutput mpfdo = new MultipartFormDataOutput();
      mpfdo.addFormData("part1", "This is Value 1", MediaType.TEXT_PLAIN_TYPE);
      mpfdo.addFormData("part2", "This is Value 2", MediaType.TEXT_PLAIN_TYPE);
      mpfdo.addFormData("data.txt",  LocateTestData.getTestData("data.txt"), MediaType.TEXT_PLAIN_TYPE);
      ClientRequest request = new ClientRequest(TEST_URI);
      request.body(MediaType.MULTIPART_FORM_DATA_TYPE, mpfdo);
      ClientResponse<String> response = request.put(String.class);
      Assert.assertEquals(200, response.getStatus());
      String responseBody = response.getEntity();
View Full Code Here

   @Test
   public void testPostForm() throws Exception
   {
      ClientRequest request = new ClientRequest(TEST_URI);
      MultipartFormDataOutput mpfdo = new MultipartFormDataOutput();
      mpfdo.addFormData("part1", "This is Value 1", MediaType.TEXT_PLAIN_TYPE);
      mpfdo.addFormData("part2", "This is Value 2", MediaType.TEXT_PLAIN_TYPE);
      mpfdo.addFormData("data.txt", LocateTestData.getTestData("data.txt"), MediaType.TEXT_PLAIN_TYPE);
      request.body(MediaType.MULTIPART_FORM_DATA_TYPE, mpfdo);
      ClientResponse<InputStream> response = request.post(InputStream.class);
      BufferedInputStream in = new BufferedInputStream(response.getEntity());
      String contentType = response.getResponseHeaders().getFirst("content-type");
      System.out.println(contentType);
View Full Code Here

      testMultipart(TEST_URI + "/multi/list");
   }

   private void testMultipart(String uri) throws Exception
   {
      MultipartFormDataOutput mpfdo = new MultipartFormDataOutput();
      mpfdo.addFormData("bill", createCustomerData("bill"), MediaType.APPLICATION_XML_TYPE);
      mpfdo.addFormData("monica", createCustomerData("monica"), MediaType.APPLICATION_XML_TYPE);
      ClientRequest request = new ClientRequest(uri);
      request.body(MediaType.MULTIPART_FORM_DATA_TYPE, mpfdo);
      ClientResponse<?> response = request.put();
      Assert.assertEquals(204, response.getStatus());
      response.releaseConnection();
View Full Code Here

   @Test
   public void testMultipartFormDataOutput() throws Exception
   {
      MultipartClient client = ProxyFactory.create(MultipartClient.class,
              generateBaseUrl());
      MultipartFormDataOutput output = new MultipartFormDataOutput();
      output.addFormData("bill", new Customer("bill"),
              MediaType.APPLICATION_XML_TYPE);
      output.addFormData("monica", new Customer("monica"),
              MediaType.APPLICATION_XML_TYPE);
      client.putFormData(output);
   }
View Full Code Here

        Client client = ClientBuilder.newBuilder().register(authFilter).build();
        UriBuilder authBase = UriBuilder.fromUri("http://localhost:8081/auth");
        WebTarget adminRealms = client.target(AdminRoot.realmsUrl(authBase));


        MultipartFormDataOutput formData = new MultipartFormDataOutput();
        InputStream is = SamlBindingTest.class.getResourceAsStream("/saml/sp-metadata.xml");
        Assert.assertNotNull(is);
        formData.addFormData("file", is, MediaType.APPLICATION_XML_TYPE);

        WebTarget upload = adminRealms.path("demo/application-importers/saml2-entity-descriptor/upload");
        System.out.println(upload.getUri());
        Response response = upload.request().post(Entity.entity(formData, MediaType.MULTIPART_FORM_DATA));
        Assert.assertEquals(204, response.getStatus());
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput

Copyright © 2018 www.massapicom. 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.