Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Renard Desmon

Greenhorn
+ Follow
since Feb 14, 2022
Self taught
Love experimenting
Find out what's possible before creating possibilities
North Hempstead New York
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Renard Desmon

I see .I Missed that statement.  How do I make it show the prompt? What is the context?
in the URLConnection i came across an method called setAllowUserInteraction(boolean enable). What does this method do?

Does it have something to do with Basic[User name & password] authentication where an GUI is displayed asking the user to enter his name & password?

So far i make an dumb get request to the server as follows



And i make my server return an unauthorized response requesting for Basic authenication as follows



Client just throws an error saying error response code and terminates. But if i specify an Authenticator as follows



Then authentication works.

is setUserInteraction() meant to make this whole process GUI based  where password and username are entered in text fields and submitted thus eliminating the need for an Authenticator? If so how would i do that here?

What response does the server need to send and what parameter's need to be set in the HttpURLConnection to see this method in action?
So i had dropped an comment on the Asker of the Question asking for his final solution and it turns out that significant
changes were made actually in the client side more than in the server side.

Multiple OutputStream retrivals had to be changed from this



To this


This fixed everything
I am experimenting with the Expect:100-Continue Header and i am facing  an 5 second delay between sending the http body to the server and receiving the 100 Continue response code from the server.

Here is the client code



I am not interested in parsing the http data sent from the client but only in responding to it. In this case i just print the data received . From the  RFC Docs i have learnt that this is a 2 step process

1. The client sends headers and the server is supposed to respond with an 100 Continue code if the server has no problems with them. In this case i skip all checking and directly send 100 Continue

2. After the client sends the request body the server is supposed to respond with an final status code [200 OK or any other] to indicate end of the body. I send 200 response code

Here is the server



The problem is that there is an 5 second delay between step 1 and 2. If i respond with any other status code besides 100 for example


Then on the client side an exception is thrown immediately saying server rejected the request which makes perfect sense but when I send the 100 response code the server receives the body after 5 seconds.

Here is the output on the server side



Here is the output on the client



The same thing happens when i use chunk Transfer mode as well . Between each chunk there is an 5 second delay

Here is the Question from which i got the code from and modified it. The User has marked the answer as accepted but didn't give any code explanation as to how he solved the problem. If i were to ask the question there now it would get marked as duplicate.

How do i properly handle an Expect : 100 header in this case?
That makes sense.  A computer can have multiple network interfaces so binding a socket to an specific interface and port can direct traffic better.  Thank you
Hello everyone. Here goes my 2nd post here

The way i have been working with Sockets for the longest time is as follows

1) Create an ServerSocket that binds to an address and wait's there to accept client connections


2) Create an Socket that connects to the server


And just today i decided to see all features of sockets and discovered that the Client Socket class also has an bind() method

I thought it's only the server's job to bind() to an address to accept client connections so why does the client socket also have a bind() method?

What does it do?

Is there anyway to mark an post here as an accepted answer like in stack overflow or do i just mark it as helpful and leave it?
5 months ago
Thank you very much everyone  for the explanation. When i posted this question on stack overflow i got 4 downvotes in like 3 minutes . I like it here very much now
5 months ago
I am just getting started with regular expressions and i need some help in creating examples to understand these methods from the Matcher class

Matcher useAnchoringBounds(boolean b)

Matcher useTransparentBounds(boolean f)

boolean requireEnd()

I have experimented with every other method in this class with success but after reading the javadoc of these methods i don't even know how to write examples to experiment with these methods. It would be very useful if these examples could show the output before using & after using these methods

This is my first post so i'm not sure what more details i could provide on this question. Any guidance would be greatly appreciated
5 months ago