[
https://issues.jboss.org/browse/TEIID-2694?page=com.atlassian.jira.plugin...
]
Ramesh Reddy commented on TEIID-2694:
-------------------------------------
Doing some investigation
{code}
@Path("/message")
public class MessageRestService {
@POST
@Consumes("multipart/form-data")
public Response printMessage(MultipartFormDataInput input) {
Map<String, List<InputPart>> map = input.getFormDataMap();
for (String key:map.keySet()) {
System.out.println(key);
try {
System.out.println(map.get(key).get(0).getBodyAsString());
} catch (IOException e) {
e.printStackTrace();
}
}
return Response.status(200).entity("done").build();
}
}
{code}
and with the client
{code}
public static void main(String[] args) throws ClientProtocolException, IOException {
HttpEntity entity = MultipartEntityBuilder.create()
.addBinaryBody("message", "will this
work?".getBytes(), ContentType.create("application/json"),
"foo.txt")
.addTextBody("dst_folder", "foo")
.addTextBody("dst_source", "bar")
.build();
HttpPost httpPost = new
HttpPost("http://localhost:8080/RESTfulExample/rest/message");
httpPost.setEntity(entity);
HttpClient httpClient = new DefaultHttpClient();
HttpResponse response = httpClient.execute(httpPost);
response.getEntity().getContent();
System.out.println(response.getStatusLine().getStatusCode());
}
{code}
seems to work fine. So now the question is, if I follow this then all the POST methods
will be "multipart/form-data" as opposed regular to "form-data". I
know it may be little cumbersome to do the client with "multipart", but that
seems to be right way. If no objections, I will see if I can provide a fix.
Support for Blob Input in Teiid REST services
---------------------------------------------
Key: TEIID-2694
URL:
https://issues.jboss.org/browse/TEIID-2694
Project: Teiid
Issue Type: Enhancement
Affects Versions: 8.5
Environment: EAP 6.1 Alpha , Teiid 8.5
Reporter: Madhu Garimilla
Assignee: Ramesh Reddy
We are trying to upload large files as Blobs using Teiid REST service through VDB. Though
we are writing the Blob objects to HttpUrlConnection object, it is not received on REST
method. As per the conversation in the thread
"https://community.jboss.org/thread/232840" Current parameter handling is done
through strings and needs be enhanced to support Blob objects.
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)