Show a URL in a Separate Browser Using Authentication

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

Show a URL in a Separate Browser Using Authentication

Postby ronm » Tue Apr 27, 2010 4:44 am

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.
ronm
 
Posts: 10
Joined: Mon Feb 08, 2010 11:28 pm

Re: Show a URL in a Separate Browser Using Authentication

Postby michel » Tue Apr 27, 2010 10:29 am

You can provide the username and password in the url

Code: Select all
http://<username>:<password>@<host>:<port>/<url-path>
Michel van Klink
Vision Development
michel
 
Posts: 186
Joined: Mon Sep 22, 2008 10:53 am
Location: Boskoop, The Netherlands

Re: Show a URL in a Separate Browser Using Authentication

Postby Harjo » Tue Apr 27, 2010 10:50 am

great tip! :-)
Thanks for sharing.
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: Show a URL in a Separate Browser Using Authentication

Postby pbakker » Tue Apr 27, 2010 10:54 am

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
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: Show a URL in a Separate Browser Using Authentication

Postby ptalbot » Tue Apr 27, 2010 4:20 pm

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!
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: Show a URL in a Separate Browser Using Authentication

Postby ronm » Tue Apr 27, 2010 6:11 pm

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.
ronm
 
Posts: 10
Joined: Mon Feb 08, 2010 11:28 pm


Return to How To

Who is online

Users browsing this forum: No registered users and 5 guests