0

Linking from HTTP page to HTTPS page using relative path

asked 2009-02-23 16:48:21 +0800

sreed gravatar image sreed
195 1 3 5

I am looking for a way to link from an HTTP page to HTTPS page without specifying the absolute path in an href. If anyone has any ideas on this, especially if there are utilities in ZK that would help, I'd appreciate hearing about it.
Thanks,
Scott

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2009-02-23 20:39:12 +0800

YamilBracho gravatar image YamilBracho
1722 2

You can use the OnClick event and inside this event make the redirection

link publish delete flag offensive edit

answered 2009-02-24 05:18:41 +0800

sreed gravatar image sreed
195 1 3 5

Thank you, Yamil. Please give me an example of the code to make the redirection.

link publish delete flag offensive edit

answered 2009-02-24 09:07:51 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-02-24 09:10:26 +0800

   ...
   public void onClick$yourBtn(Event event) throws Exception {

     // redirect
     Executions.sendRedirect("/yourNewPage.zul");
     }

Regards
Stephan

link publish delete flag offensive edit

answered 2009-02-24 11:32:10 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

updated 2009-02-24 15:22:53 +0800

sreed,
I think you have to use absolute path cause you change the protocol from http to https of a url...

link publish delete flag offensive edit

answered 2009-02-24 21:53:39 +0800

sreed gravatar image sreed
195 1 3 5

You're correct, Dennis, but I'd prefer not hard-coding the absolute path in the zuml code so I don't break it if I move the files around. One approach I considered is to obtain the absolute path of the HTTPS page and then construct the absolute path for the link to the HTTP link on the fly and not have to hard-code an absolute path in the zuml code.

Can anyone tell me how to get the absolute path (relative to ROOT) of the current page?

link publish delete flag offensive edit

answered 2009-02-25 01:00:19 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

no direct api to do this in servler/zk I think , but you can do it by a simple util api isn't it.
in jsp , you do

String uri = request.getRequestURI();
if (request.getQueryString() != null) {
   uri += '?' + request.getQueryString();
}
URL url = new URL(request.getScheme(),
                               request.getServerName(),
                               request.getServerPort(),
                               uri);

in url , construct this in first request(not ajax request) , keep it in desktop.

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-02-23 16:48:21 +0800

Seen: 554 times

Last updated: Feb 25 '09

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