This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes InputStream from password protected http site Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "InputStream from password protected http site" Watch "InputStream from password protected http site" New topic
Author

InputStream from password protected http site

Jay Crawf
Greenhorn

Joined: Sep 15, 2013
Posts: 10

So I'm trying to develop a program that will send a snapshot command to an IP camera, and then save the resulting jpeg to a local file. If I navigate to the URL specified in the webPage string with a browser, I am prompted for the username/password and then presented with a page with the snapshot. When I attempt to do the same thing with my program, I get a connection refused error on opening the inputstream. I'm certain there isn't a firewall/port issue since I can get to the page with a browser on the same machine, and it is a http rather than a https address.

Am I on the wrong track with how I am trying to go about doing this?


Code:


Error:
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18712
    
    8

Some possibilities: I notice your server is listening on port 81; did you include that port number when you asked the browser to connect to it? And when the browser connected, did it ask you to authenticate yourself via a dialog box asking for user ID and password?

And even though your server appears to be on the same LAN as your client software, does your browser connect to the server via an HTTP proxy server?
Jay Crawf
Greenhorn

Joined: Sep 15, 2013
Posts: 10
I also specify the port when connecting thru browser (just copied and pasted the String value from the browser).

There is no HTTP proxy involved on the LAN.

The page prompts authentication via a pop-up menu. Is my method of authenticating not going to work in this case?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: InputStream from password protected http site