Read URL from browsers addressbar

Using Servoy to administrate the content of your website? Discuss all webrelated Servoy topics on this forum!

Read URL from browsers addressbar

Postby Janssenjos » Wed May 26, 2010 1:32 pm

Hi all,

Is it possible to retrieve the URL from the addressbar (what the end-client typed in)?
I've searched everywhere, but just couldn't find it.

Thanks.
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 148
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom

Re: Read URL from browsers addressbar

Postby ROCLASI » Wed May 26, 2010 1:45 pm

Do you mean application.getServerURL()?
This will return the used base URL (i.e. http://www.myDomain.com:8080/, http://app.myDomain.net:8181/, etc).
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Read URL from browsers addressbar

Postby Janssenjos » Wed May 26, 2010 2:38 pm

Well, I my case it returns 'localhost' instead of the url (or even ip-adress) that the user typed in.
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 148
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom

Re: Read URL from browsers addressbar

Postby ROCLASI » Wed May 26, 2010 2:40 pm

I assume you are using the web client. Smart client will show the correct URL.
I guess you need to file a feature request for this.
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Read URL from browsers addressbar

Postby Janssenjos » Thu May 27, 2010 9:10 am

Ok, thanks.
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 148
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom

Re: Read URL from browsers addressbar

Postby jcompagner » Thu May 27, 2010 1:24 pm

if it is a deepling to a solution
You get the parameters into your solution.

Or do you really want to know the server address they used?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Read URL from browsers addressbar

Postby Janssenjos » Thu May 27, 2010 1:41 pm

We really want to know what address they typed in.
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 148
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom

Re: Read URL from browsers addressbar

Postby jcompagner » Thu May 27, 2010 1:56 pm

i guess a simple (web client) only java plugin or java code in js could give you that result if needed.
Something like this could work in js:

var requestUrl = Packages.org.apache.wicket.RequestCycle.get().getRequest().getURL();
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Read URL from browsers addressbar

Postby Janssenjos » Thu May 27, 2010 3:14 pm

I get the follwoing as result: servoy-webclient/?x=BCUB7LJ19fDyURr8TKHe9EZ1ZAhy1Zs3vDKvkTREVpBm9ads38KG-XA-IwSb7*0J

But probably there will be a method that will return the whole url, so i will look into that.
Jos Janssen
Software Developer
Axerrio
http://www.axerrio.com
Janssenjos
 
Posts: 148
Joined: Thu Aug 13, 2009 3:55 pm
Location: Bergen op Zoom

Re: Read URL from browsers addressbar

Postby jcompagner » Thu May 27, 2010 3:30 pm

var requestUrl = Packages.org.apache.wicket.RequestCycle.get().getRequest().getHttpServletRequest().getRequestURI() ;
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Read URL from browsers addressbar

Postby pbakker » Tue Aug 31, 2010 2:46 pm

As of Servoy 5.2.1 application.getServerUrl() does return the base url from which the webclient is started.

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands


Return to Web Development

Who is online

Users browsing this forum: No registered users and 8 guests

cron