If that is not enough, you can also inject the request and us it in the
contributed BaseUrlSource to sniff the host.

    public static void contributeServiceOverride(final
MappedConfiguration<Class,Object> configuration, final Request request) {
        BaseURLSource source = new  BaseURLSource()
        {
            
              public String getBaseURL(boolean secure)
            {
                
                   String protocol = secure ? "https" : "http";
                   int  port = secure ? 8443 : 8080;
                  request... instead the line below.
                   return String.format("%s://localhost:%d" , protocol,
port);

            }
        };
        configuration.add(BaseURLSource.class, source);
    }

Ville

-----Alkuperäinen viesti-----
Lähettäjä: Nicolas Bouillon [mailto:nico...@bouil.org] 
Lähetetty: 22. syyskuuta 2013 19:49
Vastaanottaja: Tapestry users
Aihe: Re: BaseURLSource with access to current request

Hi,

You can try starting you application server with this JVM options :

-Dtapestry.hostport-secure=443 -Dtapestry.hostport=80

Nicolas.


2013/9/22 Andy Pahne <li...@bodenkurier.de>:
> Hi there,
>
> I have a T5 app, that
>  - is party protected with SSL (fronted with Apache)
>  - also has some unprotected content not using SSL
>  - is used to run more than one domain   ( www.example.com,
www.example.co.uk )
>  - can be completely browsed using https scheme, even the unprotected
pages
>
> I have this mostly working, but there is one problem when https browsing
the site's pages which are not @Secure annotated: the links constructed have
the form
>    http://www.example.com:443/page1
>
> I tried to resolve this problem by contributing a service override for
BaseURLSource, as described in http://tapestry.apache.org/https.html
>
> However, the given implementation does not fit my needs, because I need
access to the current Request, because I need to extract the hostname from
it. I just cannot use a constant for the hostname, like in the example in
the docs:
>
>     public static void
contributeServiceOverride(MappedConfiguration<Class,Object> configuration) {
>         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(BaseURLSource.class, source);
>     }
>
>
>
> So here is my question: how do I construct an implementation of
BaseURLSource that has access to the current Request?
>
> I guess that's possible, but I am not familiar with Tapestry-IOC and
googling for approaches only, I only found solutions that are somewhat
"static" and do not depend on the current request.
>
> Andy
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to