You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Josip Gracin <gr...@tel.fer.hr> on 2006/05/29 16:58:40 UTC
Redirecting to HTTPS in pageValidate(), or something?
Hello!
Is there a way to ensure that a page can be accessed only via HTTPS
scheme, but relying only on Tapestry mechanisms, i.e. not using Tomcat etc.?
Ideally, I would like to redirect an HTTP request in pageValidate() of a
page to the same page but via HTTPS.
Thanks in advance!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [SPAM] Re: Redirecting to HTTPS in pageValidate(), or something?
Posted by Josip Gracin <gr...@tel.fer.hr>.
Shing Hing Man wrote:
> @InjectObject("service:tapestry.globals.WebRequest")
> public abstract WebRequest getWebRequest()
Thanks, I try that!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Redirecting to HTTPS in pageValidate(), or something?
Posted by Shing Hing Man <ma...@yahoo.com>.
Please try something like this in .page:
@InjectObject("service:tapestry.globals.WebRequest")
public abstract WebRequest getWebRequest()
Shing
--- Josip Gracin <gr...@tel.fer.hr> wrote:
> Hi!
>
> Nick Westgate wrote:
> > RequestContext requestContext =
> > event.getRequestCycle().getRequestContext();
>
> I've thought about that, yes, but it seemed like a
> bit of a hack. Is
> this the right way to do it in Tapestry 4 (except
> that instead of
> calling getRequestContext(), the context should be
> injected into pages.
> BTW, how do I do that)?
>
> Thanks for answering!
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
> users-help@tapestry.apache.org
>
>
Home page :
http://uk.geocities.com/matmsh/index.html
___________________________________________________________
All New Yahoo! Mail Tired of Vi@gr@! come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Redirecting to HTTPS in pageValidate(), or something?
Posted by Josip Gracin <gr...@tel.fer.hr>.
Hi!
Nick Westgate wrote:
> RequestContext requestContext =
> event.getRequestCycle().getRequestContext();
I've thought about that, yes, but it seemed like a bit of a hack. Is
this the right way to do it in Tapestry 4 (except that instead of
calling getRequestContext(), the context should be injected into pages.
BTW, how do I do that)?
Thanks for answering!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Redirecting to HTTPS in pageValidate(), or something?
Posted by Nick Westgate <ni...@key-planning.co.jp>.
Hi Josip.
Have you tried doing exectly what you yourself suggested? ;-)
In T3 I use something like this:
public abstract class AppBasePage extends BasePage implements PageValidateListener
{
public void pageValidate(PageEvent event)
{
// ssl?
RequestContext requestContext = event.getRequestCycle().getRequestContext();
if (!requestContext.getScheme().equals("https"))
{
// no, so redirect
String url = "https://" + requestContext.getServerName();
if (requestContext.getServerPort() == 8080)
{
url += ":8443"; // to handle debugging
}
url += requestContext.getRequestURI();
throw new RedirectException(url);
}
...
}
}
Cheers,
Nick.
Josip Gracin wrote:
> Hello!
>
> Is there a way to ensure that a page can be accessed only via HTTPS
> scheme, but relying only on Tapestry mechanisms, i.e. not using Tomcat
> etc.?
>
> Ideally, I would like to redirect an HTTP request in pageValidate() of a
> page to the same page but via HTTPS.
>
> Thanks in advance!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org