Questions tagged [httpentity]

68 questions
1
vote
1 answer

Saving BufferedHttpEntity to File

How do you save an entity to SDCard, in a streamed manner (To avoid memory issues). I cant find any solid documentation on the matter. response = httpClient.execute(request); BufferedHttpEntity responseEntity = new…
IAmGroot
  • 13,760
  • 18
  • 84
  • 154
0
votes
1 answer

Spring RestTemplate: Exception sending byte[] to a Mail API

There's a Mail API I gotta use and I'm not able to send information through my Spring application. When I copy/paste the 'body' of my HttpEntity on Postman it delivers perfectly but with RestTemplate seems to not be working. I've even tried to make…
0
votes
1 answer

How to preserve string ("/") while sending api request as part of JSONObject

I am trying to send below Jsonobject as request parameter to rest API. { "date": "2022-01-01", "value": [ "TST/USED" ] } Value field contains the list of values, but when I add the value in this format as part of request it replaces string / to…
Janny
  • 127
  • 1
  • 12
0
votes
3 answers

HttpMessageNotReadableException: JSON parse error: Unrecognized token '嬀崀'

I am calling an endpoint via RestTemplate as follows: SSLContext sslContext = SSLContexts.createSystemDefault(); SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext); HttpClient client =…
Queue
  • 446
  • 7
  • 23
0
votes
2 answers

I need to perform Basic authentication as well as send key value as body for a Http Post request and get data

Basic Authorization for url Key value content in body x-www-form-urlencoded I need to perform both basic auth and pass www-form-urlencoded data in the body. How can i code in java using http to get response data obtained after passing above data to…
0
votes
1 answer

Preserve a HTTPEntity without consuming the stream

I'm using org.apache.http.client.HttpClient and I'm trying to access the payload of the request HTTPEntity without consuming the underlying stream. I tried using EntityUtils.toString(someEntity); but this consumes the stream. I just want to…
Francesco Iannazzo
  • 596
  • 2
  • 11
  • 31
0
votes
1 answer

java.lang.ClassNotFoundException: org.apache.http.HttpEntity on HttpPost

I'm working with java 8 I'm trying to do a HTTP POST request with a JSON body and then get the response as a string so I'll be able to parse it as Gson (JsonObject) But ! When i use the HttpEntity or the BasicResponseHandler, i'm faced with this…
Sornin
  • 105
  • 2
  • 10
0
votes
1 answer

Sending Request body as json to GET request through httpentity

Sample Request Body as Json to send through the GET request for external API. Below is sample json need to be added in Request Body to send through GET request to external API: ''' {"nameidentify":["Name-1","Name-2","Name-3"]} …
Akhilesh
  • 1
  • 7
0
votes
0 answers

Convert String to HTTPEntity

I am getting api response as String. eg: HTTP/2 201 server: nginx/1.14.0 (Ubuntu) date: Fri, 23 Oct 2020 11:35:08 GMT content-type: application/json content-length: 51 set-cookie: userid=test; Path=/ set-cookie: uid=98-123-8h6; Path=/ set-cookie:…
Vipin Gupta
  • 213
  • 3
  • 15
0
votes
1 answer

How to make HttpPut request with string array as body to it in JAVA?

I have a requirement to call a rest api put method which accepts one parameter Body(of type arrray[string]) which is to be passed to "BODY" not query parameter. Below is the value that this parameter accepts: [ "string" ] These are the steps…
Revaix
  • 15
  • 5
0
votes
1 answer

Http Proxy servlet with caching capabilities

I'm writing a very simple proxy servlet by taking as a reference this one. I want o add caching capabilities where the key in the cache would be the URI. Of course the issue is that I cannot cache the whole response since if I pass it throught the…
Raffaele
  • 461
  • 1
  • 7
  • 20
0
votes
1 answer

How to get only Json content from HttpEntity Java

Using HttpEntity I am getting a very long text which has special characters as well along with Json. I tried regex but it's not working as it is almost 30000 of characters. Is there a way that i can only get Json data from the HttpEntity. Even…
mickyslate
  • 11
  • 3
0
votes
0 answers

Function argument and return value does look incorrect - Spring ResponseEntity

I have such problem with ResponseEntity. The function returns such statement: public ResponseEntity And some functions doesn't return type User instead some thing: return new ResponseEntity<>(HttpStatus.NOT_FOUND); What do you think about…
user9183621
0
votes
1 answer

org.springframework.web.client.HttpClientErrorException: 400 Bad Request using HttpEntity restTemplate.exchange

I am getting HttpClientErrorException: 400 Bad Request when posting some data to client api. Exception stack trace: org.springframework.web.client.HttpClientErrorException: 400 Bad Request org.springframework.web.client.HttpClientErrorException: 400…
App User
  • 15
  • 4
0
votes
1 answer

When I post a request through rest template,It throws no suitable HttpMessageConverter

HttpHeaders reqheaders= new HttpHeaders(); reqheaders.set(HttpHeaders.Accept,MediaType.Application_xml) reqheaders.set(HttpHeaders.Content_type,MediaType.Application Json) HttpEntity XML= new HttpEntity (json,reqheaders) ResponseEntity xmlfile=…