Re: The wicket way of getting application base URL
Thanks! Has added config option On Thu, Mar 13, 2014 at 8:39 PM, Chris Snyder chris.sny...@biologos.orgwrote: I think that such a configuration option is likely your only choice, and is something I often see in other webapps. The only other option I can think of would be if the proxy was passing a header with the original requested URL. However, I don't see such functionality in mod_proxy (at least from a quick skim of its documentation). I can imagine a hacky way of using Javascript to pass it in. I'm only mentioning it to dissuade you from considering it (if you were), as it would be a huge security risk: Someone could send incorrect data to the server, causing it to send out the wrong URLs. That would make for an effective phishing campaign - emails from a legitimate source with links to the cracker's server. Best, Chris On Thu, Mar 13, 2014 at 9:22 AM, jchappelle jchappe...@4redi.com wrote: We just use a configuration property in our application that is stored in our properties database table. So our solution really doesn't involve wicket at all. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/The-wicket-way-of-getting-application-base-URL-tp4664925p4664938.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Chris Snyder Web Developer, BioLogos biologos.org -- WBR Maxim aka solomax
Re: The wicket way of getting application base URL
We just use a configuration property in our application that is stored in our properties database table. So our solution really doesn't involve wicket at all. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/The-wicket-way-of-getting-application-base-URL-tp4664925p4664938.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: The wicket way of getting application base URL
I think that such a configuration option is likely your only choice, and is something I often see in other webapps. The only other option I can think of would be if the proxy was passing a header with the original requested URL. However, I don't see such functionality in mod_proxy (at least from a quick skim of its documentation). I can imagine a hacky way of using Javascript to pass it in. I'm only mentioning it to dissuade you from considering it (if you were), as it would be a huge security risk: Someone could send incorrect data to the server, causing it to send out the wrong URLs. That would make for an effective phishing campaign - emails from a legitimate source with links to the cracker's server. Best, Chris On Thu, Mar 13, 2014 at 9:22 AM, jchappelle jchappe...@4redi.com wrote: We just use a configuration property in our application that is stored in our properties database table. So our solution really doesn't involve wicket at all. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/The-wicket-way-of-getting-application-base-URL-tp4664925p4664938.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Chris Snyder Web Developer, BioLogos biologos.org
The wicket way of getting application base URL
Hello, I'm currently using SelfUpdatingAjaxBehavior [1] to get application base URL used by the end user. Maybe there is more standard way of doing this? Or maybe code like this can be added to ClientInfo? Thanks in advance! [1] https://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/web/java/org/apache/openmeetings/web/util/BaseUrlAjaxBehavior.java?view=markup -- WBR Maxim aka solomax
Re: The wicket way of getting application base URL
Hi Maxim, Maybe you might use something like this: Url baseUrl = new Url(page.getRequestCycle().getUrlRenderer().getBaseUrl()); I used it to retrieve the relative url: private static String getUrl(WebPage page) { Url pageUrl = Url.parse(page.urlFor(page.getClass(), null).toString()); Url baseUrl = new Url(page.getRequestCycle().getUrlRenderer().getBaseUrl()); baseUrl.resolveRelative(pageUrl); return String.format(%s/%s, page.getRequest().getContextPath(), baseUrl); } Best regards, Sebastien. On Wed, Mar 12, 2014 at 5:14 PM, Maxim Solodovnik solomax...@gmail.comwrote: Hello, I'm currently using SelfUpdatingAjaxBehavior [1] to get application base URL used by the end user. Maybe there is more standard way of doing this? Or maybe code like this can be added to ClientInfo? Thanks in advance! [1] https://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/web/java/org/apache/openmeetings/web/util/BaseUrlAjaxBehavior.java?view=markup -- WBR Maxim aka solomax
Re: The wicket way of getting application base URL
The reason I have implemented the hook: Our users are using mod_proxy all the time So port and context are might be changed and I need to get the base URL after all these modifications (to create emails with links etc.) On Wed, Mar 12, 2014 at 11:24 PM, Sebastien seb...@gmail.com wrote: Hi Maxim, Maybe you might use something like this: Url baseUrl = new Url(page.getRequestCycle().getUrlRenderer().getBaseUrl()); I used it to retrieve the relative url: private static String getUrl(WebPage page) { Url pageUrl = Url.parse(page.urlFor(page.getClass(), null).toString()); Url baseUrl = new Url(page.getRequestCycle().getUrlRenderer().getBaseUrl()); baseUrl.resolveRelative(pageUrl); return String.format(%s/%s, page.getRequest().getContextPath(), baseUrl); } Best regards, Sebastien. On Wed, Mar 12, 2014 at 5:14 PM, Maxim Solodovnik solomax...@gmail.com wrote: Hello, I'm currently using SelfUpdatingAjaxBehavior [1] to get application base URL used by the end user. Maybe there is more standard way of doing this? Or maybe code like this can be added to ClientInfo? Thanks in advance! [1] https://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/web/java/org/apache/openmeetings/web/util/BaseUrlAjaxBehavior.java?view=markup -- WBR Maxim aka solomax -- WBR Maxim aka solomax