3,249 questions
0
votes
0
answers
60
views
Java HttpsUrlConnection’s setFixedLengthStreamingMode doesn’t resume file upload
I am trying to upload a large file (say 100 MB) to aws s3 using HttpsUrlConnection. My application runs in unpredictable and unstable network, hence I expect connectivity drops during the upload.
...
0
votes
1
answer
42
views
Issue with recording a flow in jmeter using chrome browser
i am using apache jmeter on windows 11 in my office laptop , i have installed jdk 18 for that , and installed a jmeter root certificate too. i have added transaction controller under a thread group ...
0
votes
0
answers
30
views
Setting up new connection using Oauth2.0
enter image description hereWhile setting up the oauth2.0 connection in event bridge with grant type as ClientCredemtials, how to declare the scope?
I tried using http parameters- query string type (...
0
votes
0
answers
11
views
'PKIX path building failed' [duplicate]
So, I am working on a project using Twilio API in Java and Spring Boot but I am getting this error.
"PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable ...
-1
votes
1
answer
266
views
Is it a good practice to use uri.toURL().openConnection()? [closed]
Should I use uri.toURL().openConnection(); since URL is deprecated from java 20
Path path = Paths.get(apiUrl);
URI uri = path.toUri();
HttpURLConnection connection = (HttpURLConnection) uri....
0
votes
0
answers
65
views
Apache HttpClient 5 create generic request
I am migrating from the old HttpURLConnection to the new Apache HttpClient 5 , to crate a connection in the old code I used this snippet of code
URL url = new URL(“url”);
HttpURLConnection conn = url....
1
vote
1
answer
54
views
Why prinnting HttpURLConnection request properties one of that is not present?
I'm using the above java code in order to connect to external server.
This is the code:
URL url = new URL("api-url");
HttpURLConnection hpcon = (HttpURLConnection)url.openConnection();
byte[]...
0
votes
0
answers
34
views
Continous loading during HttpURLConnection
I have a URL which is giving a QR Image response from a web URL. When that URL is restricted in Application running server this block code is continuously loading not returning any value. I am not ...
0
votes
0
answers
38
views
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 405 for URL
I use (java) HttpURLConnection to get Response from my remote server.
URL url = new URL(URL_STRING);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection....
0
votes
1
answer
73
views
Pepper Robot, issues while retrieving data via php query from Altervista
i'm a University student and i'm working on a project originally made in 2021 by my university group. The project is based on a website where users can write stories and an app where stories are ...
0
votes
0
answers
31
views
how to use proxy for HttpsURLConnection
I tried using -
con.setRequestProperty(http.proxyHost", "xxxxxx");
con.setRequestProperty(http.proxyPort", "3128");
and also by another way -
String authHeader = new ...
0
votes
0
answers
41
views
how to get UTF-8 string from api [duplicate]
URI uri = new URI(api);
URL url = uri.toURL();
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setRequestProperty("Content-Type", "application/json;UTF-8");
...
1
vote
0
answers
22
views
Cant read the whole response from the HttpURLConnection I want to achieve that for My Proxy Server?
public void run()
{
try
{
BufferedReader inFromClient = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
DataOutputStream ...
0
votes
0
answers
25
views
Android Studio HttpURLConnection every second request is empty on host
i'm trying to handle some json-requests with an php-server.
Im using HttpURLConnection and AsyncTask on android and file_get_contents('php://input') on php.
My problem is that only every second ...
0
votes
0
answers
66
views
getResponseCode returns null
the getResponseCode method returns null in the below code, there's no other thing happening in my class. I am just trying to receive the JSON response through my request. What might be the reason?
...
0
votes
0
answers
226
views
Jenkins Groovy HttpURLConnection PUT request failing while creating writer
So I'm trying to make a put request with HttpURLConnection in a groovy script running inside Jenkins. I have successfully made get and post calls with url-encoded-data, but the put request with a JSON ...
0
votes
0
answers
25
views
Android Volley library for secure requests
I am trying to build my own Android application using Java, and this application will contain sensitive users data like payment information, what is the safest way to implement this for requesting to ...
2
votes
2
answers
4k
views
HTTP connection failure when calling local API from .Net MAUI view
When calling my locally hosted API from my android emulator's .NET MAUI app, I receive an error message stating that the HTTP connection failed.
I am able to successfully send requests to my local API ...
0
votes
1
answer
546
views
What is the most efficient way to call rest service multiple times in a loop
I need to call an api endpoint multiple times in a loop. While the connection path remains same one parameter changes in every call. I have written it like below.
I am opening the connection at the ...
0
votes
1
answer
348
views
Not able to intercept methods of java.net.HttpURLConnection class in Java 17
i want to intercept the connect() method of java.net.HttpURLConnection. for that i am using below provided code. The provided code intercepts the connect method of the HttpURLConnection class in Java ...
0
votes
0
answers
55
views
How to Access Set-Cookie Values with httpUrlConnection.getHeaderFields() When Headers Are Empty Due to HTTP Only Cookie Restrictions?
I'm facing a challenge in accessing HTTP Only cookies in a large-scale Java application that uses httpUrlConnection. When trying to extract cookies from the Set-Cookie header of the HTTP response, I ...
0
votes
0
answers
32
views
Trying to get initial cookie value for a non authenticated website but it's throwing 403, using HttpURLConnection
I've requirement to get initial cookie value from website https://www.valueresearchonline.com/ and use it for subsequent requests using JSOUP ( in header I need to pass cookie value )
Below program is ...
0
votes
1
answer
763
views
Spring Cloud Open Feign: HttpURLConnection and Apache HttpClient
When using Feign, it defaults to using HttpURLConnection. I anticipated performance improvements by switching to Apache HttpClient for connection pooling. However, in my tests, the response time ...
0
votes
0
answers
38
views
Android HttpUrlConnection not working in release
I'm trying to get String from Web API. String is a list of file names, separate with new line and fill List with those line strings. The method is working in debug mode on emulator, works in debugging ...
0
votes
0
answers
46
views
Handling URL Redirections with HttpURLConnection or HttpsURLConnection
I recently ran into an issue while trying use HttpURLConnection to get the response code of a website, specifically https://bobaguys.com
Here is the code
URL url = new URL("https://bobaguys.com&...
0
votes
1
answer
28
views
Fidel API giving 401 when calling from java code
I am trying to call Fidel's APIs from my java code, this API needs just a key for authentication that we need to pass in headers.
when I hit the API from postman it works. but from my java code, it ...
0
votes
0
answers
233
views
java Https request via proxy dropping headers in doTunneling causing 403
Trying to acccess an API outside the firewall so we are going through a proxy server but the issue is that this causes HttpURLConnection to drop any set request headers for the URL.
Setup is simple
...
-2
votes
2
answers
271
views
runOnUiThread executes after waiting 30 seconds
I came across an extremely weird behaviour related to code execution on UI thread after server data retrieval.
In onResume, I start a Thread where I wait for some server data fetch to complete and ...
0
votes
0
answers
65
views
Unable to read the HttpURLConnection.responseCode when HttpURLConnection.setChunkedStreamingMode is enabled
I want to upload a file to a web server. To avoid getting an OutOfMemory error on large files, I added the connection.setChunkedStreamingMode(2048); method. This works fine when the server responds ...
1
vote
1
answer
41
views
How to execute http cmmand directly with Android Java?
I have a custom device which it's connected via hotspot with my mobile and through my app I can connect and login to that custom device correctly like :
http://x.x.x.x/cgi-bin/web.cgi?action=API&...
0
votes
3
answers
310
views
HttpUrlConnection returns ResponseCode 404 but any browser can access the URL anytime
I need to open a connection to an URL address and to read html with StringBuffer. However when i try to establish connection i get file not found exception 404. When i write this address in any ...
0
votes
1
answer
164
views
Android HttpsURLConnection giving SSLHandshakeException after disabling cipher suites in backend
Our backend is Azure App Service (Linux) that with default settings supports the following cipher suite:
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
...
0
votes
0
answers
118
views
HttpURLConnection unable to capture HTTP 302 correctly in a Java test
I am trying to write a test for a URL /rdrct which redirects to another URL, say /test on the same host. On the application, the redirect works fine and I see a HTTP 302 in the Network Inspector but ...
0
votes
0
answers
42
views
Reusing connections for Improving performance [duplicate]
I am using HttpURLConnection to make GET requests. Below is the code:
class ConnectClass {
private HttpURLConnection connection;
public makerequest(URL url) throws Exception {
...
0
votes
0
answers
37
views
How to Change VideoView Requests from GET to POST method
Hello Please i want Help, i have server only accept POST requests to Download Video, So how i can make VideoView send POST requests to Download Buffer Video From my Host
i tryed to change headers,I ...
0
votes
0
answers
52
views
HttpUrlConnection hangs out on POST request
I am working on custom gradle plugin which trigger API POST call. There is no many option for networking from gradle and UrlConnection looks as a best tool. I am able to trigger GET API call, but can ...
1
vote
1
answer
4k
views
Invalid HTTP method: PATCH in Java 8
I am trying to post payload to ClientApp RESTAPI via PATCH as HTTP_METHOD in Java.
There are lot of similar ERROR found in google and got suggestion to use X-HTTP-Method-Override header.
I followed ...
0
votes
1
answer
7k
views
ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
i have a column in a Dataframe called url. i'm trying to send a request to these servers and get the element of the content. The problem occours when i run my script and ALWAYS with the 7th request. ...
0
votes
2
answers
826
views
Problem with HttpURLConnection and application/x-www-form-urlencoded request
I want to send a post request in Groovy using HttpURLConnection and I can't get it to work.
HttpURLConnection conn = new URL("https://url").openConnection()
conn.setDoOutput(true)
conn....
0
votes
1
answer
690
views
How to send json data in Java using HttpURLConnection and Jackson
when I use the following command line when trying to send a json request it works perfectly:
$ curl -H "Content-Type: application/json" -XGET '192.168.0.121:9200/shakespeare/_search?pretty' -...
2
votes
0
answers
42
views
My data is randomly sent, using java http connection
I wrote a minimal method to post some binary data over HTTP but the data is not actually sent every time.
I saw many other questions that looks like this one, but none solved my problem.
Here is my ...
0
votes
0
answers
126
views
Integrate mockito logic with the production code
Below is a simple java command line utility to download a web page into a file.
This code was brought from here:
https://www.codejava.net/java-se/networking/java-urlconnection-and-httpurlconnection-...
0
votes
1
answer
360
views
How to upload InputStream to HttpURLConnection
I have created a HttpURLConnection using which i need to upload a file to a specific URL. Below is my code
String uURL = "http:some_domain/add";
URL url = new URL(uURL);
HttpURLConnection ...
3
votes
1
answer
498
views
Why doesn't Flask establish persistent HTTP connection with multiple requests from Java application using HttpURLConnection?
I have a minor project which will involve repeated HTTPS communication between a Java application and a Flask web server such that keeping the TCP connection alive is important. In order to test and ...
1
vote
0
answers
33
views
HttpUrlConnection: multipart request POST
I'm using multipart request in my app to send multiple files + some parameters to server. It worked with previous backend lib (express-formidable) but it is no longer working with current lib(Multer).
...
3
votes
1
answer
1k
views
How to cleanly intercept a request URL over java.net.HttpURLConnection in Java 8?
About
Trying to see if it's possible to rewrite/mutate the request URL along with ability to intercept the headers, request and response cleanly over java.net.HttpURLConnection in Java 8. Closest ...
0
votes
0
answers
65
views
Sending POST request using http url connection java
I'm trying to configure a system client-server.
The server uses a java server socket, and the client uses and http url connection to connect to the server.
The code of the server is:
private static ...
1
vote
0
answers
64
views
not able to execute the script. After Maver-Test, browser is opening and below errors are showing in the console
FAILED CONFIGURATION: @BeforeMethod setUp
org.openqa.selenium.remote.http.ConnectionFailedException: Unable to establish websocket connection to http://localhost:53584/devtools/browser/87a1db2f-4f8a-...
0
votes
1
answer
132
views
Is there is a way to view an image/jpeg response in ImageView
I am calling a GET api and it returns a string of image/jpeg contentType, I am using urlConnection to proceed the request.
How to display the response in an ImageView ?
GET https://httpbin.org/image/...
0
votes
1
answer
583
views
Error while mocking HttpUrlConnection call in REST service using Mockito in Java application
I am new to Java. I wanted to write unit test for the following method using Junit and Mockito framework. This method takes in payload, establish the http connection and return response:
public static ...