I have trouble converting an example cURL string (that works) to a meaningful resteasy expression. The cURL is:
curl -X POST -u admin:admin --data-binary "@tempfile.xml" http://localhost:8810/rest/configurations
I have:
public void sendPost(ConfigurationDTO config) throws JAXBException, FileNotFoundException {
    // client target is:  http://localhost:8810/rest
    ResteasyWebTarget target = getTarget();
    target.path("configurations");
    JAXBContext context = JAXBContext.newInstance(ConfigurationDTO.class);
    Marshaller marshaller = context.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
    // this here produces exactly what I need
    marshaller.marshal(config, new File("test.xml"));
    MultipartFormDataOutput dataOutput = new MultipartFormDataOutput();
    dataOutput.addFormData("file", new FileInputStream(new File("test.xml")), MediaType.APPLICATION_OCTET_STREAM_TYPE);
    GenericEntity<MultipartFormDataOutput> entity = new GenericEntity<MultipartFormDataOutput>(dataOutput) {};
    Response response = target.request().post( Entity.entity(entity, MediaType.MULTIPART_FORM_DATA_TYPE));
    response.close();
}
protected ResteasyWebTarget getTarget() {
    ResteasyClient client = new ResteasyClientBuilder().build();
    ResteasyWebTarget target = client.target(UriBuilder.fromUri(restUrl).build());
    client.register(new AddAuthHeadersRequestFilter(user, pass));
    return target;
}
Throws HTTP.500, I don't have access to the server to see what happened.
 
     
     
    