-
Probably a very basic question but I couldn't find any good solution so far. How can I detect all implementing classes of As Background: I have a wrapper function for HTTP requests (shortened version below). If the submitted function http_post_request(url, body, charset) {
// ...
var httpPost = new org.apache.http.client.methods.HttpPost(url);
// detect entity here: var isEntity = body instanceof org.apache.http.HttpEntity; // this doesn't work
if(!isEntity) body = new StringEntity(body, charset);
httpPost.setEntity(body);
// ...
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I correct myself: org.apache.http.entity.mime.MultipartEntityBuilder.create()
// ...
.build(); ... what returns type I'd like to share my final solution: var entity = body instanceof org.apache.http.HttpEntity ? body : new StringEntity(body, charset)
httpRequest.setEntity(entity); |
Beta Was this translation helpful? Give feedback.
I correct myself:
body instanceof org.apache.http.HttpEntity
does work perfectly well in my case where I do:... what returns type
HttpEntity
.I'd like to share my final solution: