You might want to vote for this:

https://issues.apache.org/jira/browse/TAP5-167


> -----Original Message-----
> From: Inge Solvoll [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 14, 2008 15:10
> To: Tapestry users
> Subject: Re: [T5] Pick up https/http from request
> 
> Thanks!
> 
> I tried copying your code into my AppModule with some small modifications.
> But the code only runs on server startup, not when I access a tapestry 5
> page. I tried to add deliberate errors in the code, like naming the server
> loooocalhost, but I never saw the results when accessing pages.
> 
> Also, when I try to add "final HttpServletRequest request" as a parameter
> to
> the contributeAlias method, my T5.0.13 crashes complaining about service
> recursion.
> 
> What I need is for T5 to figure out that a user accesses a page with
> either
> http or https, and respond on the same protocol...
> 
> 
> Regards
> Inge
> 
> On Fri, Nov 14, 2008 at 4:43 PM, Keith Bottner <[EMAIL PROTECTED]> wrote:
> 
> > I believe you might be able to use an alternation of a solution I used
> for
> > getting https to work properly between my development and production
> > servers.
> >
> > public static void contributeAlias(Configuration<AliasContribution>
> > configuration,
> >  @Inject @Value("${"+SymbolConstants.PRODUCTION_MODE+"}" ) final String
> > production
> >  {
> >                if (0 != production.compareToIgnoreCase("true"))
> >                {
> >              BaseURLSource source = new BaseURLSource()
> >              {
> >                  public String getBaseURL(boolean secure)
> >                  {
> >                      String protocol = secure ? "https" : "http";
> >
> >                      int port = secure ? 8443 : 8080;
> >
> >                      return String.format("%s://localhost:%d", protocol,
> > port);
> >                  }
> >              };
> >
> >
> >  configuration.add(AliasContribution.create(BaseURLSource.class,
> source));
> >                }
> >  }
> >
> > Somehow make this dependent on the user selection and return it
> > accordingly.
> >
> > Not a quick solution but possible a direction to try!
> >
> > Keith
> >
> >
> > On Nov 14, 2008, at 7:18 AM, Inge Solvoll wrote:
> >
> >  Hi!
> >>
> >> My web application is large and consists of Struts, T4 and T5 pages. In
> >> Struts and T4, I use the current http request to figure out whether to
> use
> >> https or not. Users can choose if they want to log in using https or
> not.
> >> The chosen protocol is used on all pages after login.
> >>
> >> In T5, this is either a global static setting, or a static setting per
> >> page.
> >> Is there a service or something I can override to implement my own
> >> "protocol
> >> builder"? Something like this:
> >>
> >> public class HttpProtocolBuilder {
> >>  public HttpProtocolBuilder (final HttpServletRequest request) {
> >>   this.request = request
> >>  }
> >>
> >>  public String getProtocol() {
> >>   if (request.isSecure()) {
> >>     return "https";
> >>   }
> >>   else {
> >>    return "http";
> >>    }
> >> }
> >>
> >> Regards
> >>
> >> Inge
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to