Tapestry cometd with HTTPS

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Tapestry cometd with HTTPS

Miguel Figueiredo
Hi,

I am testing a Tapestry application with HTTPS configuration.
I did the dev configuration according to the documentation (
https://tapestry.apache.org/https.html)

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

    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);
    }

Additionaly I have added the jetty configuration for SSL.

All the normal requests work fine, but when I do a broadcast with a push
manager, I get the following error:

Caused by: java.lang.RuntimeException: Symbol 'tapestry-offline.serverName'
is not defined.
    at
org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl$SymbolExpansion.expandSymbol(SymbolSourceImpl.java:136)
    at
org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl$SymbolExpansion.valueForSymbol(SymbolSourceImpl.java:99)
    at
org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl.valueForSymbol(SymbolSourceImpl.java:214)
    at $SymbolSource_2086fa2c220a.valueForSymbol(Unknown Source)
    at
org.apache.tapestry5.ioc.internal.services.SymbolObjectProvider.provide(SymbolObjectProvider.java:49)
    at
org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl$1.invoke(MasterObjectProviderImpl.java:52)
    at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)
    ... 67 more

Note that this works file with HTTP.

Can someone give me some help?

Best regards,
Miguel


--
Miguel Figueiredo
Software Developer

"I'm a pretty lazy person and am prepared to work quite hard in order to
avoid work."
-- Martin Fowler
Reply | Threaded
Open this post in threaded view
|

Re: Tapestry cometd with HTTPS

Lance Java
tapestry-cometd uses tapestry-offline under the hood to fool tapestry into
believing it was invoked via a request / response when it was actually
invoked via websockets.

I'm guessing you are rendering a link in your websocket flow. You'll need
to provide a few extra symbols to render links including the server name &
port. See the tapestry-offline readme for more information

https://github.com/uklance/tapestry-offline

On 30 Apr 2017 19:53, "Miguel Figueiredo" <[hidden email]> wrote:

> Hi,
>
> I am testing a Tapestry application with HTTPS configuration.
> I did the dev configuration according to the documentation (
> https://tapestry.apache.org/https.html)
>
>     public void contributeMetaDataLocator(MappedConfiguration<String,
> String> configuration) {
>         configuration.add(MetaDataConstants.SECURE_PAGE, "true");
>     }
>
>     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);
>     }
>
> Additionaly I have added the jetty configuration for SSL.
>
> All the normal requests work fine, but when I do a broadcast with a push
> manager, I get the following error:
>
> Caused by: java.lang.RuntimeException: Symbol 'tapestry-offline.serverName'
> is not defined.
>     at
> org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl$
> SymbolExpansion.expandSymbol(SymbolSourceImpl.java:136)
>     at
> org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl$
> SymbolExpansion.valueForSymbol(SymbolSourceImpl.java:99)
>     at
> org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl.
> valueForSymbol(SymbolSourceImpl.java:214)
>     at $SymbolSource_2086fa2c220a.valueForSymbol(Unknown Source)
>     at
> org.apache.tapestry5.ioc.internal.services.SymbolObjectProvider.provide(
> SymbolObjectProvider.java:49)
>     at
> org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl$1.
> invoke(MasterObjectProviderImpl.java:52)
>     at
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.
> invoke(OperationTrackerImpl.java:74)
>     ... 67 more
>
> Note that this works file with HTTP.
>
> Can someone give me some help?
>
> Best regards,
> Miguel
>
>
> --
> Miguel Figueiredo
> Software Developer
>
> "I'm a pretty lazy person and am prepared to work quite hard in order to
> avoid work."
> -- Martin Fowler
>
Reply | Threaded
Open this post in threaded view
|

Re: Tapestry cometd with HTTPS

Miguel Figueiredo
Hi,

Thanks for the answer. I will look into that.

Best regards,
Miguel

On Sun, Apr 30, 2017 at 10:12 PM, Lance Java <[hidden email]>
wrote:

> tapestry-cometd uses tapestry-offline under the hood to fool tapestry into
> believing it was invoked via a request / response when it was actually
> invoked via websockets.
>
> I'm guessing you are rendering a link in your websocket flow. You'll need
> to provide a few extra symbols to render links including the server name &
> port. See the tapestry-offline readme for more information
>
> https://github.com/uklance/tapestry-offline
>
> On 30 Apr 2017 19:53, "Miguel Figueiredo" <[hidden email]> wrote:
>
> > Hi,
> >
> > I am testing a Tapestry application with HTTPS configuration.
> > I did the dev configuration according to the documentation (
> > https://tapestry.apache.org/https.html)
> >
> >     public void contributeMetaDataLocator(MappedConfiguration<String,
> > String> configuration) {
> >         configuration.add(MetaDataConstants.SECURE_PAGE, "true");
> >     }
> >
> >     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);
> >     }
> >
> > Additionaly I have added the jetty configuration for SSL.
> >
> > All the normal requests work fine, but when I do a broadcast with a push
> > manager, I get the following error:
> >
> > Caused by: java.lang.RuntimeException: Symbol
> 'tapestry-offline.serverName'
> > is not defined.
> >     at
> > org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl$
> > SymbolExpansion.expandSymbol(SymbolSourceImpl.java:136)
> >     at
> > org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl$
> > SymbolExpansion.valueForSymbol(SymbolSourceImpl.java:99)
> >     at
> > org.apache.tapestry5.ioc.internal.services.SymbolSourceImpl.
> > valueForSymbol(SymbolSourceImpl.java:214)
> >     at $SymbolSource_2086fa2c220a.valueForSymbol(Unknown Source)
> >     at
> > org.apache.tapestry5.ioc.internal.services.SymbolObjectProvider.provide(
> > SymbolObjectProvider.java:49)
> >     at
> > org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl$1.
> > invoke(MasterObjectProviderImpl.java:52)
> >     at
> > org.apache.tapestry5.ioc.internal.OperationTrackerImpl.
> > invoke(OperationTrackerImpl.java:74)
> >     ... 67 more
> >
> > Note that this works file with HTTP.
> >
> > Can someone give me some help?
> >
> > Best regards,
> > Miguel
> >
> >
> > --
> > Miguel Figueiredo
> > Software Developer
> >
> > "I'm a pretty lazy person and am prepared to work quite hard in order to
> > avoid work."
> > -- Martin Fowler
> >
>



--
Miguel Figueiredo
Software Developer
http://jaragua.hopto.org <http://jaragua.dyndns.org>

"I'm a pretty lazy person and am prepared to work quite hard in order to
avoid work."
-- Martin Fowler