212 questions
3
votes
1
answer
153
views
Liberty TLS java.net.http.WebSocket failing after migrating to Java 21 & Jakarta
We have java.net.http.WebSocket code that connects to our devices with the wss:// TLS Web Socket protocol successfully under our OpenLiberty Java 17, Java EE (and Spring 5) application, but fails ...
3
votes
0
answers
94
views
How do I get the Java11+ HttpClient to drop the Authorization header when following redirects?
I'm using an API which, for certain large queries, returns a 307 status code and redirects me to a signed AWS S3 URL. I'm querying it with Java's inbuilt HttpClient (java.net.http.HttpClient), and the ...
1
vote
0
answers
76
views
Apache Jena 4.9.0 [Endpoint returned Content-Type: application/sparql-results+json which is not recognized for SELECT queries.]
I'm developing a tool based on Apache Jena 4.9.0 libraries to issue SELECT queries to a SPARQL endpoint, and execution resulted in error stated at the title
(that is, "Endpoint returned Content-...
0
votes
0
answers
103
views
Which Java 11+ HttpClient BodyHandler return chunks as they arrive?
I want to get data from a server that sends chunked data, in my case line by line.
I checked this answer suggesting a custom BodySubscriber, as well as this one resorting to an InputStream.
My current ...
0
votes
1
answer
306
views
Java 17 HttpClient- socket keepalive
Apache's HttpClient provides mechanism to keep the socket alive.
SocketConfig socketConfig = SocketConfig.custom().setSoKeepAlive(true).build();
new PoolingHttpClientConnectionManager()....
1
vote
0
answers
499
views
Idea Http Client - Reusing Requests
I'm interested in starting to use the Idea Http Client for API testing. I'm currently facing a challenge. I have a set of requests or a sequence of requests that I would like to execute within other ...
1
vote
0
answers
167
views
Is there a way to read HTTP trailers with the Java 11 HttpClient?
Currently using the Java 11 HttpClient to make http requests and it appears there isn't an obvious way to read response trailers. These responses are streamed back to the client - the Java 11 ...
1
vote
1
answer
95
views
Jena 4 connection to Virtuoso
How can I access authenticated Virtuoso OpenSource SPARQL 1.1. graph store protocol through Jena 4? I am facing this problem after having upgraded my codebase from Jena 3 (Apache HttpClient) to Jena 4 ...
0
votes
0
answers
144
views
How to pretend that an API request is is being sent from Firefox?
I'm implementing an app to fetch requests from a website API that seems to be protected by Cloudfare. When I make requests to the API using Java HttpClient framework, I get the following response (I'...
20
votes
1
answer
6k
views
Java 21 built-in HTTP client pins the carrier thread
I'm using Java Corretto 21.0.0.35.1 build 21+35-LTS, and the built-in Java HTTP client to retrieve a response as an InputStream. I'm making parallel requests using virtual threads, and for the most ...
2
votes
1
answer
78
views
Getting a release asset from GitHub returns empty response file
I'm trying to download an asset inside a GitHub release as a file, but the response is empty.
The repository is private, but I have a working bearer token with which I can perform other calls.
static ...
1
vote
2
answers
917
views
HttpClient Object in Java 11 OpenJDK
I'm using Java 11 HttpClient to send request to a remote server.
I wanted to know if there is a difference on the HttpClient object when creating object in below 2 different ways
HttpClient client = ...
0
votes
0
answers
163
views
Java 11 - HttpClient - JIRA - FileUploadBase$InvalidContentTypeException
Im trying to upload a file to a JIRA task using the Java 11 HttpClient.
But getting org.apache.commons.fileupload.FileUploadBase$InvalidContentTypeException: the request doesn't contain a multipart/...
2
votes
0
answers
581
views
java.net.http.HttpClient Error Handling with different BodySubscribers
Currently, I have this JsonBodyHandler used to parse the response body if the response is successful. I also have a model defined if the request is not successful. So based on the status code, I need ...
1
vote
3
answers
2k
views
How to stub HttpClient send method in mockito
I am calling an external API using HttpClient as below,
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder().uri(URI.create("http://localhost:8080/...
0
votes
2
answers
3k
views
I am trying to stream response(word by word) of chatgpt api in android (java) by implementing async task but i get an error
I am trying to stream response(word by word) of chatgpt api in android (java) by implementing async task but i get an error. I am using java's HTTPurlconnection library with input and outputstreams so ...
1
vote
1
answer
2k
views
Looking for the 302 redirect code, instead getting 200 OK status code
I made a Java program to check whether a web request will redirect or not.
As there are some status codes in HTTP protocol, I need to look for 302 status code that expresses redirect request,
Here is ...
1
vote
1
answer
873
views
java.net.http package can't be resolved in android kotlin project [duplicate]
I'm working on an simple android kotlin project which use the build-in java.net.http.HttpClient to make http post request, but it always failed to build, the error is:
Unresolved reference: http
...
0
votes
1
answer
511
views
Why am I receiving a 403 when making a request to the reddit API but not in Postman?
I'm trying to make a HTTP Request using Java 11 HttpClient and after receiving an access token I'm getting a 403 error.
Here's a coding snippet, after receiving a valid token:
HttpClient httpClient = ...
0
votes
0
answers
52
views
How to include a ? in Java 11 HTTP Client URL? [duplicate]
I have a URL from a third party so no option of removing the nasty characters. For security purposes I have put a dummy company in mybadurl.com and also replaced the account number with AccountNo.
...
1
vote
0
answers
265
views
How to process each part from multipart response in Java from javax.mail.internet.MimeMultipart API
ByteArrayDataSource datasource = new ByteArrayDataSource(in, "multipart/form-data");
MimeMultipart multipart = new MimeMultipart(datasource);
int count = multipart.getCount();
log.debug(&...
0
votes
0
answers
1k
views
Cannot connect to Spring WebSocket server due to null Upgrade Header
I created a WebSocket server using Java Spring, which worked correctly when connecting via ws://localhost:8080/socket and ws://localhost:30019/socket. However, when I attempt to upload the socket to ...
0
votes
1
answer
768
views
Java 11 HttpClient - POST issue
I am writing java HttpClient code, to query splunk API, and get search id (sid) as output.
I was able to write this in curl and python, with no issues.
But Java is proving to be difficult.
Curl: (...
2
votes
1
answer
704
views
Which Java client to use for calculating HTTP performance metrics like TCP connection time, Time to first byte, TLS handshake time etc
I am looking for a Java HTTP Async client which can be used to get performance metrics like TCP connection time, Time to first byte, TLS handshake time for an endpoint.
I looked into latest java.net....
1
vote
1
answer
628
views
Can the core Java HttpClient proxy through a TLS Proxy?
I am trying to setup a HttpClient to proxy requests through a HTTPS authenticated proxy.
It seems the Java HttpClient can only proxy over http and therefore the proxy credentials are sent in plaintext ...