Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-954

Using @MultipartForm doesn't work with ResteasyClientBuilder

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 3.0.6.Final
    • 3.0.4.Final
    • None
    • Hide

      Run JUnit with class ClientRequestTest:
      testNewBuilder() doesn't work correctly.

      Show
      Run JUnit with class ClientRequestTest: testNewBuilder() doesn't work correctly.

      I tried to upload an attachment via Multipart. For that i use the client proxy api.

      The proxy interface has a method like this:

      @Path("test/{key}")
      @Consumes("multipart/form-data")
      @POST
      public void postAttachment(@MultipartForm Attachment attachment, @PathParam("key") String key)
      

      When i generate the proxy with the old ProxyFactory it can send the POST, but an exception is thrown with the new ResteasyClientBuilder:

      javax.ws.rs.ProcessingException: could not find writer for content-type multipart/form-data type: de.markant.anwendkart.client.Attachment
      

      The problem seems to be, that the variable "annotations" in ResteasyProviderFactory.getClientMessageBodyWriter() is not correctly filled with a proxy generated by the new ResteasyClientBuilder. Without it, the correct MessageBodyWriter(MultipartFormAnnotationWriter) is not used.

      The test project i used is attached.

            patriot1burke@gmail.com Bill Burke (Inactive)
            rond_jira Torsten Schöne (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: