Dear Tapestry users, how have you been?

I'm writing this time to ask you about using HTTPS with Jetty.

I followed the advices of the page 
http://tapestry.apache.org/tapestry5/guide/secure.html and others, but I wasn't 
able to make it work for all the pages at once.
What I'm trying to do is securing all the pages in one place, an avoid to put 
the @Secure annotation in every single page.

I tried putting in AppModule, inside of contributeApplicationDefaults the 
values: 

configuration.add(SymbolConstants.PRODUCTION_MODE, "true");
configuration.add(SymbolConstants.SECURE_ENABLED, "true");

And then, I added also in AppModule:

public void contributeMetaDataLocator(MappedConfiguration<String,String> 
configuration) {
    configuration.add(MetaDataConstants.SECURE_PAGE, "true");
}

and

public static void contributeAlias(Configuration<AliasContribution<?>> 
configuration) {
        
    BaseURLSource source = new BaseURLSource() {

        public String getBaseURL(boolean secure) {

            String protocol = secure ? "https" : "http";

            int port = secure ? 8443 : 8080;

            return String.format("%s://server:%d", protocol, port);
        }
    };

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



At last, in the Jetty plugin, I defined the connectors, to force the use of 
certain ports for certain protocol:

<connectors>
    <connector 
implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
        <port>8080</port>
        <maxIdleTime>60000</maxIdleTime>
    </connector>
    <connector implementation="org.eclipse.jetty.server.ssl.SslSocketConnector">
        <port>8443</port>
        <maxIdleTime>60000</maxIdleTime>
        <keystore>src/test/resources/keystore</keystore>
        <password>password</password>
        <keyPassword>password</keyPassword>
    </connector>
</connectors>


But it doesn't work, at least for me. I tried adding the @Secure annotation to 
every page (which is exactly what I'm trying to avoid), and it started to work 
the way I wanted. 

Is there anything I'm forgetting? Does it require any other configurations?


Thanks in advance!!! Best wishes!

Matias.


      

Reply via email to