Page 1 of 1

Show a URL in a Separate Browser Using Authentication

PostPosted: Tue Apr 27, 2010 4:44 am
by ronm
Normally when I want to display a PDF file that is stored on a server I would:
Code: Select all
var webPage = 'http://www.servoy.com/docs/servoy_data_sync.pdf';   
var encoded_webPage = encodeURI(webPage);
application.showURL(encoded_webPage);  //Shows an URL in a browser

However I have this one application from a vendor on a server that requires authentication before you can access the its PDF files so my code is:
Code: Select all
//Create a named http client (like a web browser with session binding) usable todo multiple request/posts in same server session
plugins.http.createHttpClient('mybrowser');
var pageData = plugins.http.getPageData('http://www.servoy.com/docs/servoy_data_sync.pdf','mybrowser','username','mypassword');

The problem is that I do not want to show the page inside my application but want to open a separate browser to show the PDF files.

It is better to not have the data pass through my application (speed and memory considerations).

The webclient runs on the server so that means I would have to write the page data to a file on the server and open a browser that is pointing
to the file on the server.

That could get messy in the long run as I really do not want web clients writing temporary data to the server's file system.
It eventually has to be cleaned up.

Does anyone know of a set of JAVA or JAVAscript functions that would duplicate the application.showURL method but with authentication
as in the getPageData method?

Thank you in advance for your response.

Re: Show a URL in a Separate Browser Using Authentication

PostPosted: Tue Apr 27, 2010 10:29 am
by michel
You can provide the username and password in the url

Code: Select all
http://<username>:<password>@<host>:<port>/<url-path>

Re: Show a URL in a Separate Browser Using Authentication

PostPosted: Tue Apr 27, 2010 10:50 am
by Harjo
great tip! :-)
Thanks for sharing.

Re: Show a URL in a Separate Browser Using Authentication

PostPosted: Tue Apr 27, 2010 10:54 am
by pbakker
Note: this is standard HTTP Protocol stuff, meaning you can do this from any browser.

Always do this only when the page is running in HTTPS, or else you will send your credentials unencrypted over the internet.

Paul

Re: Show a URL in a Separate Browser Using Authentication

PostPosted: Tue Apr 27, 2010 4:20 pm
by ptalbot
pbakker wrote:Note: this is standard HTTP Protocol stuff, meaning you can do this from any browser.

Always do this only when the page is running in HTTPS, or else you will send your credentials unencrypted over the internet.

Paul


It might be standard but it is not supported by any browser. IE on windows will not accept it anymore...

And even in https, I don't think that the actual URL is encrypted, only the data inside the request (for post) and in the response, so beware!

Re: Show a URL in a Separate Browser Using Authentication

PostPosted: Tue Apr 27, 2010 6:11 pm
by ronm
Thank you for all of your inputs. All of these applications are on an intranet but the point about the use of https rather than http is noted. Again thank you.