0

How to get the complete URL of the current page using Java

asked 2009-05-22 16:37:12 +0800

bob007 gravatar image bob007
384 3 4

updated 2009-05-25 18:19:02 +0800

***SOLVED***

Hi,

I'm trying to add the page to favorites using javascript.
But to to that i need to the get the complete url of the current page using Java.

How can I do that ?

Thank you for help

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2009-05-22 18:05:31 +0800

bob007 gravatar image bob007
384 3 4

updated 2009-05-25 18:18:30 +0800

To be clearer in url like : http://www.someserver:8080/anApplication/aPage.zul?no=343&dem=aadd

I need this part http://www.someserver:8080/anApplication/aPage.zul
Or this part http://www.someserver:8080/anApplication/

I tried Executions.getCurrent().encodeURL(uri) but It dont seem to add any part to the uri

Any idea ?

Thank in advance


EDITED 25/05/2009 :
Thank you robbie its working

String port = ( Executions.getCurrent().getServerPort() == 80 ) ? "" : (":" + Executions.getCurrent().getServerPort());
url = Executions.getCurrent().getScheme() + "://" + Executions.getCurrent().getServerName() + port + Executions.getCurrent().getContextPath() +  Executions.getCurrent().getDesktop().getRequestPath();

link publish delete flag offensive edit

answered 2009-05-25 02:47:14 +0800

robbiecheng gravatar image robbiecheng
1144 2
http://robbiecheng.sys-co...

Executions.getCurrent().getServerName() returns the severname ex.zkoss.org
Executions.getCurrent().getDesktop().getRequestPath() returns /app/index.zul
the rest of it can be found in javadoc.

/robbie

link publish delete flag offensive edit

answered 2013-10-17 20:40:00 +0800

eahincapie gravatar image eahincapie
3

Thanks, great example.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-05-22 16:37:12 +0800

Seen: 2,193 times

Last updated: Oct 17 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More