You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create rest client by using restlet library [ This client is to upload file in way of multipart/formdata],
try {
Representation file = new FileRepresentation(new File("/home/user1/data2.xml"),
MediaType.APPLICATION_ALL_XML);
FormDataSet form = new FormDataSet();
form.setMultipart(true);
form.getEntries().add(new FormData("upload_file", file));
ClientResource cr = new ClientResource("http://localhost:8080/upload");
cr.post(form);
} catch (Exception e){
e.printStackTrace();
}
The following above code works fine for restlet based rest provider but not for third party rest provider [ like spring boot rest endpoint which accepts post for multipart/form-data], Could anybody help here to resolve the issue?
The error I get as follow
Bad Request (400) - The request could not be understood by the server due to malformed syntax
at org.restlet.resource.ClientResource.doError(ClientResource.java:590)
at org.restlet.resource.ClientResource.handleInbound(ClientResource.java:1153)
at org.restlet.resource.ClientResource.handle(ClientResource.java:1048)
at org.restlet.resource.ClientResource.handle(ClientResource.java:1023)
at org.restlet.resource.ClientResource.post(ClientResource.java:1485)
The text was updated successfully, but these errors were encountered:
I am trying to create rest client by using restlet library [ This client is to upload file in way of multipart/formdata],
The following above code works fine for restlet based rest provider but not for third party rest provider [ like spring boot rest endpoint which accepts post for multipart/form-data], Could anybody help here to resolve the issue?
The error I get as follow
The text was updated successfully, but these errors were encountered: