Search code examples
open-liberty

Get multipart/form-data parts with IAttachment


I try to implement a microservice client to receive multipart form-data. I'm using Eclipse Microprofile and Openliberty. Therefore, I used the example sketched on https://openliberty.io/docs/21.0.0.6/send-receive-multipart-jaxrs.html. In the example I see a method having a parameter with type IAttachment. However, I don't have a library providing this interface in my workspace (Eclipse).
How do I need to configure my pom.xml to get this interface?
Which library should provide this interface?


Solution

  • The IAttachment class is a WebSphere/Liberty-specific interface, so you'd need to add this dependency to your pom.xml:

    <dependency>
        <groupId>com.ibm.websphere.appserver.api</groupId>
        <artifactId>com.ibm.websphere.appserver.api.jaxrs20</artifactId>
        <version>1.1.54</version>
        <scope>provided</scope>
    </dependency>
    

    In future versions of the Jakarta REST specification, you will be able to use a spec-defined interface, making your app more portable. See https://github.com/eclipse-ee4j/jaxrs-api/issues/418 for more details.