• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

URLConnection : what does setAllowUserInteraction do?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 27235
87
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That docs page actually tells you what its purpose is, in the Field Summary section. You are on the right track, it says

If true, this URL is being examined in a context in which it makes sense to allow user interactions such as popping up an authentication dialog.

 
Renard Desmon
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see .I Missed that statement.  How do I make it show the prompt? What is the context?
 
Paul Clapham
Sheriff
Posts: 27235
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, first of all you don't make it show a prompt. You code should do that, since you're the one who knows what the prompt should look like.

About the context: it's always been obvious to me whether my code is in a context where popping up a dialog is appropriate. I didn't even know this attribute existed until today.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic