Ajax SSL Tapestry 5.3

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

Ajax SSL Tapestry 5.3

h3ph3st0s
Hi!

In the ZoneUpdate.js I have is it ok that I inserted after this line of
code :
var listenerURIWithValue = this.listenerURI;

the following :
listenerURIWithValue=listenerURIWithValue.replace("http","https");


I mean, using 5.3 and Tapestry (not JQuery ) is this the right approach
or is there some other flag that I should switch on in tapestry
configuration ?

If I don't do that ajax call gives "Access Denied" leading to failure on
using the form.

Kind regards,
Dimitris

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Ajax SSL Tapestry 5.3

JumpStart
I think it would be better to figure this out server-side. Look at the request to see if it’s HTTPS, but allow override with a parameter to the mixin.

        /**
         * Set secure to true if https is being used, else set to false. If not provided then we set it to the value of
         * Request.isSecure().
         */
        @Parameter(name = "secure", defaultPrefix = BindingConstants.LITERAL)
        private Boolean secure;

        @Inject
        private Request request;

        void afterRender() {

                boolean useHttps = false;

                if (secure == null) {
                        useHttps = request.isSecure();
                }
                else {
                        useHttps = secure;
                }

                String listenerURI = componentResources.createEventLink(event, context).toAbsoluteURI(useHttps);

                                …

I’ll update JumpStart soon to do the same.

Geoff

> On 10 Mar 2016, at 2:33 AM, h3ph3st0s <[hidden email]> wrote:
>
> Hi!
>
> In the ZoneUpdate.js I have is it ok that I inserted after this line of code :
> var listenerURIWithValue = this.listenerURI;
>
> the following :
> listenerURIWithValue=listenerURIWithValue.replace("http","https");
>
>
> I mean, using 5.3 and Tapestry (not JQuery ) is this the right approach or is there some other flag that I should switch on in tapestry configuration ?
>
> If I don't do that ajax call gives "Access Denied" leading to failure on using the form.
>
> Kind regards,
> Dimitris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

Reply | Threaded
Open this post in threaded view
|

Re: Ajax SSL Tapestry 5.3

h3ph3st0s
Hi
I am really amateur to this framework but I think this is the java side,
right ?.
Is it something that I can follow perhaps in the other question with SSL
I had ? ( to turn on or off SSL on http request ? )

For this thread of mails the problem stands within the ZoneUpdater.js
which is javascript.
There I did ( on my opinion ) a very bad hack to replace the string of
url from http to https
Is there a more clever way to achieve this ?

Kind regards,
Dimitri

On 2016-03-10 4:22, JumpStart wrote:

> I think it would be better to figure this out server-side. Look at the request to see if it’s HTTPS, but allow override with a parameter to the mixin.
>
> /**
> * Set secure to true if https is being used, else set to false. If not provided then we set it to the value of
> * Request.isSecure().
> */
> @Parameter(name = "secure", defaultPrefix = BindingConstants.LITERAL)
> private Boolean secure;
>
> @Inject
> private Request request;
>
> void afterRender() {
>
> boolean useHttps = false;
>
> if (secure == null) {
> useHttps = request.isSecure();
> }
> else {
> useHttps = secure;
> }
>
> String listenerURI = componentResources.createEventLink(event, context).toAbsoluteURI(useHttps);
>
> …
>
> I’ll update JumpStart soon to do the same.
>
> Geoff
>
>> On 10 Mar 2016, at 2:33 AM, h3ph3st0s <[hidden email]> wrote:
>>
>> Hi!
>>
>> In the ZoneUpdate.js I have is it ok that I inserted after this line of code :
>> var listenerURIWithValue = this.listenerURI;
>>
>> the following :
>> listenerURIWithValue=listenerURIWithValue.replace("http","https");
>>
>>
>> I mean, using 5.3 and Tapestry (not JQuery ) is this the right approach or is there some other flag that I should switch on in tapestry configuration ?
>>
>> If I don't do that ajax call gives "Access Denied" leading to failure on using the form.
>>
>> Kind regards,
>> Dimitris
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Ajax SSL Tapestry 5.3

JumpStart
Yes, server-side, or "java side” as you said. Instead of changing ZoneUpdater.js, what I was recommending is to change ZoneUpdater.java. The code I posted sets up the listenerURI that is passed to the javascript in these examples:

        T5.3: http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/onevent
        T5.4: http://jumpstart.doublenegative.com.au/jumpstart7/examples/ajax/onevent

This doesn’t solve your other question, but it will work automatically with whatever solution you choose to the other question.

Geoff

> On 10 Mar 2016, at 7:31 PM, h3ph3st0s <[hidden email]> wrote:
>
> Hi
> I am really amateur to this framework but I think this is the java side, right ?.
> Is it something that I can follow perhaps in the other question with SSL I had ? ( to turn on or off SSL on http request ? )
>
> For this thread of mails the problem stands within the ZoneUpdater.js which is javascript.
> There I did ( on my opinion ) a very bad hack to replace the string of url from http to https
> Is there a more clever way to achieve this ?
>
> Kind regards,
> Dimitri
>
> On 2016-03-10 4:22, JumpStart wrote:
>> I think it would be better to figure this out server-side. Look at the request to see if it’s HTTPS, but allow override with a parameter to the mixin.
>>
>> /**
>> * Set secure to true if https is being used, else set to false. If not provided then we set it to the value of
>> * Request.isSecure().
>> */
>> @Parameter(name = "secure", defaultPrefix = BindingConstants.LITERAL)
>> private Boolean secure;
>>
>> @Inject
>> private Request request;
>>
>> void afterRender() {
>>
>> boolean useHttps = false;
>>
>> if (secure == null) {
>> useHttps = request.isSecure();
>> }
>> else {
>> useHttps = secure;
>> }
>>
>> String listenerURI = componentResources.createEventLink(event, context).toAbsoluteURI(useHttps);
>>
>> …
>>
>> I’ll update JumpStart soon to do the same.
>>
>> Geoff
>>
>>> On 10 Mar 2016, at 2:33 AM, h3ph3st0s <[hidden email]> wrote:
>>>
>>> Hi!
>>>
>>> In the ZoneUpdate.js I have is it ok that I inserted after this line of code :
>>> var listenerURIWithValue = this.listenerURI;
>>>
>>> the following :
>>> listenerURIWithValue=listenerURIWithValue.replace("http","https");
>>>
>>>
>>> I mean, using 5.3 and Tapestry (not JQuery ) is this the right approach or is there some other flag that I should switch on in tapestry configuration ?
>>>
>>> If I don't do that ajax call gives "Access Denied" leading to failure on using the form.
>>>
>>> Kind regards,
>>> Dimitris
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]