Code Monkey home page Code Monkey logo

Comments (11)

uklance avatar uklance commented on June 23, 2024

I haven't tried tapestry-atmosphere in t5.4. You might want to open the
developer tools in your browser (f12) and have a look in the network tab.
Are all javascript files found? Or are some getting a 404?

I know t5.4 has new conventions for asset locations. Perhaps the atmosphere
javascript files need to be under META-INF/assets
On 25 Jan 2016 08:44, "githubgodot" [email protected] wrote:

I am trying to use the chat demo of tapestry-atmosphere in tapestry 540
after a little struggle to put the javascript modules in the right
directories I have come to a situation where the chat demo works, but does
not push the new messages to the client the webdeveloper console shows that
requirejs could not find atmosphere this turns out to be triggered by the
statement atmospheresubscribe call in the javascript file
any idea how I can fix this?
thanks, g


Reply to this email directly or view it on GitHub
#28.

from tapestry-atmosphere.

githubgodot avatar githubgodot commented on June 23, 2024

hello,

all the javascript files are found correctly: I put them in src/main/webapp
and prepended the imports with the prefix "context:".

I put a couple alerts into tapestry-atmosphere.js and everything gets
executed up to the line before "subsocket = atmosphere.subscribe(request);"
where it reports an requirejs exception that reads require: atmosphere is not defined.

I also added a couple alerts to confirm that atmosphere.js gets loaded and
executed, and it does... it seems to be a difference in scope/visibility
where the tapestry-atmosphere is not able to see the atmosphere code...

when I reload the page manually, the chat messages have been processed
correctly, but they are not pushed automagically without the reloading the
page.

a couple of months ago, I ported most of the features of your
tapestry-stitch successfully to 5.4. if you wish, I can send them to you...

thanks for your feedback, danny.

On 25 January 2016 at 10:30, Lance [email protected] wrote:

I haven't tried tapestry-atmosphere in t5.4. You might want to open the
developer tools in your browser (f12) and have a look in the network tab.
Are all javascript files found? Or are some getting a 404?

I know t5.4 has new conventions for asset locations. Perhaps the atmosphere
javascript files need to be under META-INF/assets
On 25 Jan 2016 08:44, "githubgodot" [email protected] wrote:

I am trying to use the chat demo of tapestry-atmosphere in tapestry 540
after a little struggle to put the javascript modules in the right
directories I have come to a situation where the chat demo works, but
does
not push the new messages to the client the webdeveloper console shows
that
requirejs could not find atmosphere this turns out to be triggered by the
statement atmospheresubscribe call in the javascript file
any idea how I can fix this?
thanks, g


Reply to this email directly or view it on GitHub
#28.


Reply to this email directly or view it on GitHub
#28 (comment)
.

from tapestry-atmosphere.

uklance avatar uklance commented on June 23, 2024

Hi Danny,

I can't say I'm that familiar with porting apps to t4.5 but it does sound
like a scoping issue. Perhaps we need to create a "shim" for atmosphere so
it's a require module then t5-atmosphere "require's" the atmosphere module?

a couple of months ago, I ported most of the features of your
tapestry-stitch successfully to 5.4. if you wish, I can send them to you...

Great! I've been meaning to do that myself but never found the time. Please
send a pull request through github. Thanks!
On 25 Jan 2016 10:00, "githubgodot" [email protected] wrote:

hello,

all the javascript files are found correctly: I put them in src/main/webapp
and prepended the imports with the prefix "context:".

I put a couple alerts into tapestry-atmosphere.js and everything gets
executed up to the line before "subsocket = atmosphere.subscribe(request);"
where it reports an requirejs exception that reads require: atmosphere is not defined.

I also added a couple alerts to confirm that atmosphere.js gets loaded and
executed, and it does... it seems to be a difference in scope/visibility
where the tapestry-atmosphere is not able to see the atmosphere code...

when I reload the page manually, the chat messages have been processed
correctly, but they are not pushed automagically without the reloading the
page.

a couple of months ago, I ported most of the features of your
tapestry-stitch successfully to 5.4. if you wish, I can send them to you...

thanks for your feedback, danny.

On 25 January 2016 at 10:30, Lance [email protected] wrote:

I haven't tried tapestry-atmosphere in t5.4. You might want to open the
developer tools in your browser (f12) and have a look in the network tab.
Are all javascript files found? Or are some getting a 404?

I know t5.4 has new conventions for asset locations. Perhaps the
atmosphere
javascript files need to be under META-INF/assets
On 25 Jan 2016 08:44, "githubgodot" [email protected] wrote:

I am trying to use the chat demo of tapestry-atmosphere in tapestry 540
after a little struggle to put the javascript modules in the right
directories I have come to a situation where the chat demo works, but
does
not push the new messages to the client the webdeveloper console shows
that
requirejs could not find atmosphere this turns out to be triggered by
the
statement atmospheresubscribe call in the javascript file
any idea how I can fix this?
thanks, g


Reply to this email directly or view it on GitHub
#28.


Reply to this email directly or view it on GitHub
<
#28 (comment)

.


Reply to this email directly or view it on GitHub
#28 (comment)
.

from tapestry-atmosphere.

githubgodot avatar githubgodot commented on June 23, 2024

hello,

the shim-thing sounds promising indeed...

wrt tapestry-stitch: I will create a diff between my 5.4 version and your
github version.
I have no experience with pull requests, but will give it a try...

thanks & cu later, d.

On 25 January 2016 at 15:29, Lance [email protected] wrote:

Hi Danny,

I can't say I'm that familiar with porting apps to t4.5 but it does sound
like a scoping issue. Perhaps we need to create a "shim" for atmosphere so
it's a require module then t5-atmosphere "require's" the atmosphere module?

a couple of months ago, I ported most of the features of your
tapestry-stitch successfully to 5.4. if you wish, I can send them to you...

Great! I've been meaning to do that myself but never found the time. Please
send a pull request through github. Thanks!

On 25 Jan 2016 10:00, "githubgodot" [email protected] wrote:

hello,

all the javascript files are found correctly: I put them in
src/main/webapp
and prepended the imports with the prefix "context:".

I put a couple alerts into tapestry-atmosphere.js and everything gets
executed up to the line before "subsocket =
atmosphere.subscribe(request);"
where it reports an requirejs exception that reads require: atmosphere is not defined.

I also added a couple alerts to confirm that atmosphere.js gets loaded
and
executed, and it does... it seems to be a difference in scope/visibility
where the tapestry-atmosphere is not able to see the atmosphere code...

when I reload the page manually, the chat messages have been processed
correctly, but they are not pushed automagically without the reloading
the
page.

a couple of months ago, I ported most of the features of your
tapestry-stitch successfully to 5.4. if you wish, I can send them to
you...

thanks for your feedback, danny.

On 25 January 2016 at 10:30, Lance [email protected] wrote:

I haven't tried tapestry-atmosphere in t5.4. You might want to open the
developer tools in your browser (f12) and have a look in the network
tab.
Are all javascript files found? Or are some getting a 404?

I know t5.4 has new conventions for asset locations. Perhaps the
atmosphere
javascript files need to be under META-INF/assets
On 25 Jan 2016 08:44, "githubgodot" [email protected] wrote:

I am trying to use the chat demo of tapestry-atmosphere in tapestry
540
after a little struggle to put the javascript modules in the right
directories I have come to a situation where the chat demo works, but
does
not push the new messages to the client the webdeveloper console
shows
that
requirejs could not find atmosphere this turns out to be triggered by
the
statement atmospheresubscribe call in the javascript file
any idea how I can fix this?
thanks, g


Reply to this email directly or view it on GitHub
#28.


Reply to this email directly or view it on GitHub
<

#28 (comment)

.


Reply to this email directly or view it on GitHub
<
#28 (comment)

.


Reply to this email directly or view it on GitHub
#28 (comment)
.

from tapestry-atmosphere.

githubgodot avatar githubgodot commented on June 23, 2024

dear lance,

I am very happy that I can inform you that I got the tapestry-atmosphere
demo 0.0.6 working with tapestry 5.4.0.
it was a little cumbersome to find the right file locations and fixes, but
it works now...

I also include the changes to tapestry-stitch for 5.4.0.

the changes are relatively minimal once one has figured out how and where
the stuff has to go and how it should be called ;-)

changes wrt components.Container.java:

  • remove the library imports "@import(library = { "atmosphere.js",
    "tapestry-atmosphere.js" })"
  • replace the line
    "javascriptSupport.addInitializerCall("atmosphereContainer", config);" in
    afterRenderBody() with the following two lines:
    ======================== begin
    String className =
    java.lang.invoke.MethodHandles.lookup().lookupClass().getSimpleName();
    javascriptSupport.require(className).with(config);
    ======================== end

the className evaluates to "Container", but by calling getSimpleName the
code becomes copy/pastable and independent of a hardcoded string

subsequently, you have to save the atmosphere.js and Container.js into
src/main/resources/META-INF/modules and you are done...
your original tapestry-atmosphere is wrapped into a module-like structure,
but the real catch to get it to work properly was the subsocket assignment:
======================== begin
require(['atmosphere'], function(atmosphere) {
subsocket = atmosphere.subscribe(request)
});
======================== end

making the javascript files of your tapestry-stitch compatible with
tapestry 5.4.0 goes as follows:

changes wrt mixins.Observe.java:

  • remove the library import "@import(library = "Observe.js")"
  • replace afterRender() and onObserve(...) with the following:
    ======================== begin
    final private static String className =
    java.lang.invoke.MethodHandles.lookup().lookupClass().getSimpleName();
    void afterRender() {
    List calculatedFields = calculateFields();
    if (calculatedFields != null) {
    String listenerURI = resources.createEventLink(className,
    event, context, ("" + fields).split(",").length).toURI();
    String clientId = container.getClientId();
    jss.require(className).with(clientId, getClientEvent(),
    listenerURI, zone, "" + calculatedFields, className);
    }
    }
    Object onObserve(String event, String context, int fieldCount) {
    List contextValues = new ArrayList();
    if (context != null) {
    contextValues.add(context);
    }
    for (int i = 0; i < fieldCount; ++i) {
    String paramName = className + i;
    contextValues.add(request.getParameter(paramName));
    }
    CaptureResultCallback callback = new
    CaptureResultCallback();
    EventContext eventContext = new StringEventContext(contextValues,
    valueEncoderSource);
    resources.triggerContextEvent(event, eventContext, callback);
    return callback.getResult();
    }
    ======================== end
  • save prettify.js (your original) and the two attached files
    ProgressLink.js and Observe.js
    ./src/main/resources/META-INF/assets/stitch/prettify.js
    ./src/main/resources/META-INF/assets/stitch/ProgressLink.js
    ./src/main/resources/META-INF/modules/Observe.js
  • the catch in both progress link and observe is the declaration of the zone
    manager and calling the deferredZoneUpdate...

    you will see that components.Errors.java imports
    org.apache.tapestry5.corelib.internal.InternalMessages which is no longer
    supported by 5.4.0.
    I fixed this by replacing "if (tracker == null) throw new
    RuntimeException(InternalMessages.encloseErrorsInForm());" with "if
    (tracker!=null)"

    I also had to avoid a couple of NullPointerExceptions in GridCollapse.java
    and GridDecorator.java where collapseColumn and
    containingDiv.find("table/tbody") can be null, but these issues are trivial
    to get by...

    kind regards, danny.

    On 25 January 2016 at 22:25, danny de cock [email protected] wrote:

    hello,

    the shim-thing sounds promising indeed...

    wrt tapestry-stitch: I will create a diff between my 5.4 version and your
    github version.
    I have no experience with pull requests, but will give it a try...

    thanks & cu later, d.

    On 25 January 2016 at 15:29, Lance [email protected] wrote:

    Hi Danny,

    I can't say I'm that familiar with porting apps to t4.5 but it does sound
    like a scoping issue. Perhaps we need to create a "shim" for atmosphere so
    it's a require module then t5-atmosphere "require's" the atmosphere
    module?

    a couple of months ago, I ported most of the features of your
    tapestry-stitch successfully to 5.4. if you wish, I can send them to
    you...

    Great! I've been meaning to do that myself but never found the time.
    Please
    send a pull request through github. Thanks!

    On 25 Jan 2016 10:00, "githubgodot" [email protected] wrote:

    hello,

    all the javascript files are found correctly: I put them in
    src/main/webapp
    and prepended the imports with the prefix "context:".

    I put a couple alerts into tapestry-atmosphere.js and everything gets
    executed up to the line before "subsocket =
    atmosphere.subscribe(request);"
    where it reports an requirejs exception that reads require: atmosphere is not defined.

    I also added a couple alerts to confirm that atmosphere.js gets loaded
    and
    executed, and it does... it seems to be a difference in scope/visibility
    where the tapestry-atmosphere is not able to see the atmosphere code...

    when I reload the page manually, the chat messages have been processed
    correctly, but they are not pushed automagically without the reloading
    the
    page.

    a couple of months ago, I ported most of the features of your
    tapestry-stitch successfully to 5.4. if you wish, I can send them to
    you...

    thanks for your feedback, danny.

    On 25 January 2016 at 10:30, Lance [email protected] wrote:

    I haven't tried tapestry-atmosphere in t5.4. You might want to open
    the
    developer tools in your browser (f12) and have a look in the network
    tab.
    Are all javascript files found? Or are some getting a 404?

    I know t5.4 has new conventions for asset locations. Perhaps the
    atmosphere
    javascript files need to be under META-INF/assets
    On 25 Jan 2016 08:44, "githubgodot" [email protected] wrote:

    I am trying to use the chat demo of tapestry-atmosphere in tapestry
    540
    after a little struggle to put the javascript modules in the right
    directories I have come to a situation where the chat demo works,
    but
    does
    not push the new messages to the client the webdeveloper console
    shows
    that
    requirejs could not find atmosphere this turns out to be triggered
    by
    the
    statement atmospheresubscribe call in the javascript file
    any idea how I can fix this?
    thanks, g


    Reply to this email directly or view it on GitHub
    #28.


    Reply to this email directly or view it on GitHub
    <

    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    <
    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    #28 (comment)
    .

from tapestry-atmosphere.

uklance avatar uklance commented on June 23, 2024

Are you able to create a git patch file for your changes?

This would involve committing your changes to your local git repo then
using format-patch to generate a patch file

https://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/
On 27 Jan 2016 17:36, "githubgodot" [email protected] wrote:

dear lance,

I am very happy that I can inform you that I got the tapestry-atmosphere
demo 0.0.6 working with tapestry 5.4.0.
it was a little cumbersome to find the right file locations and fixes, but
it works now...

I also include the changes to tapestry-stitch for 5.4.0.

the changes are relatively minimal once one has figured out how and where
the stuff has to go and how it should be called ;-)

changes wrt components.Container.java:

  • remove the library imports "@import(library = { "atmosphere.js",
    "tapestry-atmosphere.js" })"
  • replace the line
    "javascriptSupport.addInitializerCall("atmosphereContainer", config);" in
    afterRenderBody() with the following two lines:
    ======================== begin
    String className =
    java.lang.invoke.MethodHandles.lookup().lookupClass().getSimpleName();
    javascriptSupport.require(className).with(config);
    ======================== end

the className evaluates to "Container", but by calling getSimpleName the
code becomes copy/pastable and independent of a hardcoded string

subsequently, you have to save the atmosphere.js and Container.js into
src/main/resources/META-INF/modules and you are done...
your original tapestry-atmosphere is wrapped into a module-like structure,
but the real catch to get it to work properly was the subsocket assignment:
======================== begin
require(['atmosphere'], function(atmosphere) {
subsocket = atmosphere.subscribe(request)
});
======================== end

making the javascript files of your tapestry-stitch compatible with
tapestry 5.4.0 goes as follows:

changes wrt mixins.Observe.java:

  • remove the library import "@import(library = "Observe.js")"
  • replace afterRender() and onObserve(...) with the following:
    ======================== begin
    final private static String className =
    java.lang.invoke.MethodHandles.lookup().lookupClass().getSimpleName();
    void afterRender() {
    List calculatedFields = calculateFields();
    if (calculatedFields != null) {
    String listenerURI = resources.createEventLink(className,
    event, context, ("" + fields).split(",").length).toURI();
    String clientId = container.getClientId();
    jss.require(className).with(clientId, getClientEvent(),
    listenerURI, zone, "" + calculatedFields, className);
    }
    }
    Object onObserve(String event, String context, int fieldCount) {
    List contextValues = new ArrayList();
    if (context != null) {
    contextValues.add(context);
    }
    for (int i = 0; i < fieldCount; ++i) {
    String paramName = className + i;
    contextValues.add(request.getParameter(paramName));
    }
    CaptureResultCallback callback = new
    CaptureResultCallback();
    EventContext eventContext = new StringEventContext(contextValues,
    valueEncoderSource);
    resources.triggerContextEvent(event, eventContext, callback);
    return callback.getResult();
    }
    ======================== end
  • save prettify.js (your original) and the two attached files
    ProgressLink.js and Observe.js
    ./src/main/resources/META-INF/assets/stitch/prettify.js
    ./src/main/resources/META-INF/assets/stitch/ProgressLink.js
    ./src/main/resources/META-INF/modules/Observe.js
  • the catch in both progress link and observe is the declaration of the zone
    manager and calling the deferredZoneUpdate...

    you will see that components.Errors.java imports
    org.apache.tapestry5.corelib.internal.InternalMessages which is no longer
    supported by 5.4.0.
    I fixed this by replacing "if (tracker == null) throw new
    RuntimeException(InternalMessages.encloseErrorsInForm());" with "if
    (tracker!=null)"

    I also had to avoid a couple of NullPointerExceptions in GridCollapse.java
    and GridDecorator.java where collapseColumn and
    containingDiv.find("table/tbody") can be null, but these issues are trivial
    to get by...

    kind regards, danny.

    On 25 January 2016 at 22:25, danny de cock [email protected] wrote:

    hello,

    the shim-thing sounds promising indeed...

    wrt tapestry-stitch: I will create a diff between my 5.4 version and your
    github version.
    I have no experience with pull requests, but will give it a try...

    thanks & cu later, d.

    On 25 January 2016 at 15:29, Lance [email protected] wrote:

    Hi Danny,

    I can't say I'm that familiar with porting apps to t4.5 but it does
    sound
    like a scoping issue. Perhaps we need to create a "shim" for atmosphere
    so
    it's a require module then t5-atmosphere "require's" the atmosphere
    module?

    a couple of months ago, I ported most of the features of your
    tapestry-stitch successfully to 5.4. if you wish, I can send them to
    you...

    Great! I've been meaning to do that myself but never found the time.
    Please
    send a pull request through github. Thanks!

    On 25 Jan 2016 10:00, "githubgodot" [email protected] wrote:

    hello,

    all the javascript files are found correctly: I put them in
    src/main/webapp
    and prepended the imports with the prefix "context:".

    I put a couple alerts into tapestry-atmosphere.js and everything gets
    executed up to the line before "subsocket =
    atmosphere.subscribe(request);"
    where it reports an requirejs exception that reads require: atmosphere is not defined.

    I also added a couple alerts to confirm that atmosphere.js gets loaded
    and
    executed, and it does... it seems to be a difference in
    scope/visibility
    where the tapestry-atmosphere is not able to see the atmosphere
    code...

    when I reload the page manually, the chat messages have been processed
    correctly, but they are not pushed automagically without the reloading
    the
    page.

    a couple of months ago, I ported most of the features of your
    tapestry-stitch successfully to 5.4. if you wish, I can send them to
    you...

    thanks for your feedback, danny.

    On 25 January 2016 at 10:30, Lance [email protected] wrote:

    I haven't tried tapestry-atmosphere in t5.4. You might want to open
    the
    developer tools in your browser (f12) and have a look in the network
    tab.
    Are all javascript files found? Or are some getting a 404?

    I know t5.4 has new conventions for asset locations. Perhaps the
    atmosphere
    javascript files need to be under META-INF/assets
    On 25 Jan 2016 08:44, "githubgodot" [email protected]
    wrote:

    I am trying to use the chat demo of tapestry-atmosphere in
    tapestry
    540
    after a little struggle to put the javascript modules in the right
    directories I have come to a situation where the chat demo works,
    but
    does
    not push the new messages to the client the webdeveloper console
    shows
    that
    requirejs could not find atmosphere this turns out to be triggered
    by
    the
    statement atmospheresubscribe call in the javascript file
    any idea how I can fix this?
    thanks, g


    Reply to this email directly or view it on GitHub
    #28.


    Reply to this email directly or view it on GitHub
    <

    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    <

    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    <
    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    #28 (comment)
    .

from tapestry-atmosphere.

githubgodot avatar githubgodot commented on June 23, 2024

dear lance,

the attached patch files should do the trick.
the changes to GridCollapse.java and GridDecorator.java look overwhelming,
but they are nothing more than the reindentation of the code after checking
for a null-pointer occurrence... tapestry 5.4 seems to fail if
collapseColumn (in GridCollapse) and the table body of GridDecorator are
null...

kind regards, d.

On 27 January 2016 at 19:12, Lance [email protected] wrote:

Are you able to create a git patch file for your changes?

This would involve committing your changes to your local git repo then
using format-patch to generate a patch file

https://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/

On 27 Jan 2016 17:36, "githubgodot" [email protected] wrote:

dear lance,

I am very happy that I can inform you that I got the tapestry-atmosphere
demo 0.0.6 working with tapestry 5.4.0.
it was a little cumbersome to find the right file locations and fixes,
but
it works now...

I also include the changes to tapestry-stitch for 5.4.0.

the changes are relatively minimal once one has figured out how and where
the stuff has to go and how it should be called ;-)

changes wrt components.Container.java:

  • remove the library imports "@import(library = { "atmosphere.js",
    "tapestry-atmosphere.js" })"
  • replace the line
    "javascriptSupport.addInitializerCall("atmosphereContainer", config);" in
    afterRenderBody() with the following two lines:
    ======================== begin
    String className =
    java.lang.invoke.MethodHandles.lookup().lookupClass().getSimpleName();
    javascriptSupport.require(className).with(config);
    ======================== end

the className evaluates to "Container", but by calling getSimpleName the
code becomes copy/pastable and independent of a hardcoded string

subsequently, you have to save the atmosphere.js and Container.js into
src/main/resources/META-INF/modules and you are done...
your original tapestry-atmosphere is wrapped into a module-like
structure,
but the real catch to get it to work properly was the subsocket
assignment:
======================== begin
require(['atmosphere'], function(atmosphere) {
subsocket = atmosphere.subscribe(request)
});
======================== end

making the javascript files of your tapestry-stitch compatible with
tapestry 5.4.0 goes as follows:

changes wrt mixins.Observe.java:

  • remove the library import "@import(library = "Observe.js")"
  • replace afterRender() and onObserve(...) with the following:
    ======================== begin
    final private static String className =
    java.lang.invoke.MethodHandles.lookup().lookupClass().getSimpleName();
    void afterRender() {
    List calculatedFields = calculateFields();
    if (calculatedFields != null) {
    String listenerURI = resources.createEventLink(className,
    event, context, ("" + fields).split(",").length).toURI();
    String clientId = container.getClientId();
    jss.require(className).with(clientId, getClientEvent(),
    listenerURI, zone, "" + calculatedFields, className);
    }
    }
    Object onObserve(String event, String context, int fieldCount) {
    List contextValues = new ArrayList();
    if (context != null) {
    contextValues.add(context);
    }
    for (int i = 0; i < fieldCount; ++i) {
    String paramName = className + i;
    contextValues.add(request.getParameter(paramName));
    }
    CaptureResultCallback callback = new
    CaptureResultCallback();
    EventContext eventContext = new StringEventContext(contextValues,
    valueEncoderSource);
    resources.triggerContextEvent(event, eventContext, callback);
    return callback.getResult();
    }
    ======================== end
  • save prettify.js (your original) and the two attached files
    ProgressLink.js and Observe.js
    ./src/main/resources/META-INF/assets/stitch/prettify.js
    ./src/main/resources/META-INF/assets/stitch/ProgressLink.js
    ./src/main/resources/META-INF/modules/Observe.js
  • the catch in both progress link and observe is the declaration of the
    zone
    manager and calling the deferredZoneUpdate...

    you will see that components.Errors.java imports
    org.apache.tapestry5.corelib.internal.InternalMessages which is no longer
    supported by 5.4.0.
    I fixed this by replacing "if (tracker == null) throw new
    RuntimeException(InternalMessages.encloseErrorsInForm());" with "if
    (tracker!=null)"

    I also had to avoid a couple of NullPointerExceptions in
    GridCollapse.java
    and GridDecorator.java where collapseColumn and
    containingDiv.find("table/tbody") can be null, but these issues are
    trivial
    to get by...

    kind regards, danny.

    On 25 January 2016 at 22:25, danny de cock [email protected]
    wrote:

    hello,

    the shim-thing sounds promising indeed...

    wrt tapestry-stitch: I will create a diff between my 5.4 version and
    your
    github version.
    I have no experience with pull requests, but will give it a try...

    thanks & cu later, d.

    On 25 January 2016 at 15:29, Lance [email protected] wrote:

    Hi Danny,

    I can't say I'm that familiar with porting apps to t4.5 but it does
    sound
    like a scoping issue. Perhaps we need to create a "shim" for
    atmosphere
    so
    it's a require module then t5-atmosphere "require's" the atmosphere
    module?

    a couple of months ago, I ported most of the features of your
    tapestry-stitch successfully to 5.4. if you wish, I can send them to
    you...

    Great! I've been meaning to do that myself but never found the time.
    Please
    send a pull request through github. Thanks!

    On 25 Jan 2016 10:00, "githubgodot" [email protected] wrote:

    hello,

    all the javascript files are found correctly: I put them in
    src/main/webapp
    and prepended the imports with the prefix "context:".

    I put a couple alerts into tapestry-atmosphere.js and everything
    gets
    executed up to the line before "subsocket =
    atmosphere.subscribe(request);"
    where it reports an requirejs exception that reads require: atmosphere is not defined.

    I also added a couple alerts to confirm that atmosphere.js gets
    loaded
    and
    executed, and it does... it seems to be a difference in
    scope/visibility
    where the tapestry-atmosphere is not able to see the atmosphere
    code...

    when I reload the page manually, the chat messages have been
    processed
    correctly, but they are not pushed automagically without the
    reloading
    the
    page.

    a couple of months ago, I ported most of the features of your
    tapestry-stitch successfully to 5.4. if you wish, I can send them to
    you...

    thanks for your feedback, danny.

    On 25 January 2016 at 10:30, Lance [email protected]
    wrote:

    I haven't tried tapestry-atmosphere in t5.4. You might want to
    open
    the
    developer tools in your browser (f12) and have a look in the
    network
    tab.
    Are all javascript files found? Or are some getting a 404?

    I know t5.4 has new conventions for asset locations. Perhaps the
    atmosphere
    javascript files need to be under META-INF/assets
    On 25 Jan 2016 08:44, "githubgodot" [email protected]
    wrote:

    I am trying to use the chat demo of tapestry-atmosphere in
    tapestry
    540
    after a little struggle to put the javascript modules in the
    right
    directories I have come to a situation where the chat demo
    works,
    but
    does
    not push the new messages to the client the webdeveloper console
    shows
    that
    requirejs could not find atmosphere this turns out to be
    triggered
    by
    the
    statement atmospheresubscribe call in the javascript file
    any idea how I can fix this?
    thanks, g


    Reply to this email directly or view it on GitHub
    #28.


    Reply to this email directly or view it on GitHub
    <

    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    <

    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    <

    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    <
    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    #28 (comment)
    .

from tapestry-atmosphere.

uklance avatar uklance commented on June 23, 2024

Hi Danny, nothing attached unfortunately.
On 28 Jan 2016 10:24, "githubgodot" [email protected] wrote:

dear lance,

the attached patch files should do the trick.
the changes to GridCollapse.java and GridDecorator.java look overwhelming,
but they are nothing more than the reindentation of the code after checking
for a null-pointer occurrence... tapestry 5.4 seems to fail if
collapseColumn (in GridCollapse) and the table body of GridDecorator are
null...

kind regards, d.

On 27 January 2016 at 19:12, Lance [email protected] wrote:

Are you able to create a git patch file for your changes?

This would involve committing your changes to your local git repo then
using format-patch to generate a patch file

https://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/

On 27 Jan 2016 17:36, "githubgodot" [email protected] wrote:

dear lance,

I am very happy that I can inform you that I got the
tapestry-atmosphere
demo 0.0.6 working with tapestry 5.4.0.
it was a little cumbersome to find the right file locations and fixes,
but
it works now...

I also include the changes to tapestry-stitch for 5.4.0.

the changes are relatively minimal once one has figured out how and
where
the stuff has to go and how it should be called ;-)

changes wrt components.Container.java:

  • remove the library imports "@import(library = { "atmosphere.js",
    "tapestry-atmosphere.js" })"
  • replace the line
    "javascriptSupport.addInitializerCall("atmosphereContainer", config);"
    in
    afterRenderBody() with the following two lines:
    ======================== begin
    String className =
    java.lang.invoke.MethodHandles.lookup().lookupClass().getSimpleName();
    javascriptSupport.require(className).with(config);
    ======================== end

the className evaluates to "Container", but by calling getSimpleName
the
code becomes copy/pastable and independent of a hardcoded string

subsequently, you have to save the atmosphere.js and Container.js into
src/main/resources/META-INF/modules and you are done...
your original tapestry-atmosphere is wrapped into a module-like
structure,
but the real catch to get it to work properly was the subsocket
assignment:
======================== begin
require(['atmosphere'], function(atmosphere) {
subsocket = atmosphere.subscribe(request)
});
======================== end

making the javascript files of your tapestry-stitch compatible with
tapestry 5.4.0 goes as follows:

changes wrt mixins.Observe.java:

  • remove the library import "@import(library = "Observe.js")"
  • replace afterRender() and onObserve(...) with the following:
    ======================== begin
    final private static String className =
    java.lang.invoke.MethodHandles.lookup().lookupClass().getSimpleName();
    void afterRender() {
    List calculatedFields = calculateFields();
    if (calculatedFields != null) {
    String listenerURI = resources.createEventLink(className,
    event, context, ("" + fields).split(",").length).toURI();
    String clientId = container.getClientId();
    jss.require(className).with(clientId, getClientEvent(),
    listenerURI, zone, "" + calculatedFields, className);
    }
    }
    Object onObserve(String event, String context, int fieldCount) {
    List contextValues = new ArrayList();
    if (context != null) {
    contextValues.add(context);
    }
    for (int i = 0; i < fieldCount; ++i) {
    String paramName = className + i;
    contextValues.add(request.getParameter(paramName));
    }
    CaptureResultCallback callback = new
    CaptureResultCallback();
    EventContext eventContext = new StringEventContext(contextValues,
    valueEncoderSource);
    resources.triggerContextEvent(event, eventContext, callback);
    return callback.getResult();
    }
    ======================== end
  • save prettify.js (your original) and the two attached files
    ProgressLink.js and Observe.js
    ./src/main/resources/META-INF/assets/stitch/prettify.js
    ./src/main/resources/META-INF/assets/stitch/ProgressLink.js
    ./src/main/resources/META-INF/modules/Observe.js
  • the catch in both progress link and observe is the declaration of the
    zone
    manager and calling the deferredZoneUpdate...

    you will see that components.Errors.java imports
    org.apache.tapestry5.corelib.internal.InternalMessages which is no
    longer
    supported by 5.4.0.
    I fixed this by replacing "if (tracker == null) throw new
    RuntimeException(InternalMessages.encloseErrorsInForm());" with "if
    (tracker!=null)"

    I also had to avoid a couple of NullPointerExceptions in
    GridCollapse.java
    and GridDecorator.java where collapseColumn and
    containingDiv.find("table/tbody") can be null, but these issues are
    trivial
    to get by...

    kind regards, danny.

    On 25 January 2016 at 22:25, danny de cock [email protected]
    wrote:

    hello,

    the shim-thing sounds promising indeed...

    wrt tapestry-stitch: I will create a diff between my 5.4 version and
    your
    github version.
    I have no experience with pull requests, but will give it a try...

    thanks & cu later, d.

    On 25 January 2016 at 15:29, Lance [email protected] wrote:

    Hi Danny,

    I can't say I'm that familiar with porting apps to t4.5 but it does
    sound
    like a scoping issue. Perhaps we need to create a "shim" for
    atmosphere
    so
    it's a require module then t5-atmosphere "require's" the atmosphere
    module?

    a couple of months ago, I ported most of the features of your
    tapestry-stitch successfully to 5.4. if you wish, I can send them to
    you...

    Great! I've been meaning to do that myself but never found the time.
    Please
    send a pull request through github. Thanks!

    On 25 Jan 2016 10:00, "githubgodot" [email protected]
    wrote:

    hello,

    all the javascript files are found correctly: I put them in
    src/main/webapp
    and prepended the imports with the prefix "context:".

    I put a couple alerts into tapestry-atmosphere.js and everything
    gets
    executed up to the line before "subsocket =
    atmosphere.subscribe(request);"
    where it reports an requirejs exception that reads require: atmosphere is not defined.

    I also added a couple alerts to confirm that atmosphere.js gets
    loaded
    and
    executed, and it does... it seems to be a difference in
    scope/visibility
    where the tapestry-atmosphere is not able to see the atmosphere
    code...

    when I reload the page manually, the chat messages have been
    processed
    correctly, but they are not pushed automagically without the
    reloading
    the
    page.

    a couple of months ago, I ported most of the features of your
    tapestry-stitch successfully to 5.4. if you wish, I can send them
    to
    you...

    thanks for your feedback, danny.

    On 25 January 2016 at 10:30, Lance [email protected]
    wrote:

    I haven't tried tapestry-atmosphere in t5.4. You might want to
    open
    the
    developer tools in your browser (f12) and have a look in the
    network
    tab.
    Are all javascript files found? Or are some getting a 404?

    I know t5.4 has new conventions for asset locations. Perhaps the
    atmosphere
    javascript files need to be under META-INF/assets
    On 25 Jan 2016 08:44, "githubgodot" [email protected]
    wrote:

    I am trying to use the chat demo of tapestry-atmosphere in
    tapestry
    540
    after a little struggle to put the javascript modules in the
    right
    directories I have come to a situation where the chat demo
    works,
    but
    does
    not push the new messages to the client the webdeveloper
    console
    shows
    that
    requirejs could not find atmosphere this turns out to be
    triggered
    by
    the
    statement atmospheresubscribe call in the javascript file
    any idea how I can fix this?
    thanks, g


    Reply to this email directly or view it on GitHub
    #28.


    Reply to this email directly or view it on GitHub
    <

    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    <

    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    <

    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    <

    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    <
    #28 (comment)

    .


    Reply to this email directly or view it on GitHub
    #28 (comment)
    .

from tapestry-atmosphere.

githubgodot avatar githubgodot commented on June 23, 2024

probably stripped by github... will send the attachment to your gmail
account...

d.

On 28 January 2016 at 11:40, Lance [email protected] wrote:

Hi Danny, nothing attached unfortunately.

On 28 Jan 2016 10:24, "githubgodot" [email protected] wrote:

dear lance,

the attached patch files should do the trick.
the changes to GridCollapse.java and GridDecorator.java look
overwhelming,
but they are nothing more than the reindentation of the code after
checking
for a null-pointer occurrence... tapestry 5.4 seems to fail if
collapseColumn (in GridCollapse) and the table body of GridDecorator are
null...

kind regards, d.

On 27 January 2016 at 19:12, Lance [email protected] wrote:

Are you able to create a git patch file for your changes?

This would involve committing your changes to your local git repo then
using format-patch to generate a patch file

https://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/

On 27 Jan 2016 17:36, "githubgodot" [email protected] wrote:

dear lance,

I am very happy that I can inform you that I got the
tapestry-atmosphere
demo 0.0.6 working with tapestry 5.4.0.
it was a little cumbersome to find the right file locations and
fixes,
but
it works now...

I also include the changes to tapestry-stitch for 5.4.0.

the changes are relatively minimal once one has figured out how and
where
the stuff has to go and how it should be called ;-)

changes wrt components.Container.java:

  • remove the library imports "@import(library = { "atmosphere.js",
    "tapestry-atmosphere.js" })"
  • replace the line
    "javascriptSupport.addInitializerCall("atmosphereContainer",
    config);"
    in
    afterRenderBody() with the following two lines:
    ======================== begin
    String className =

java.lang.invoke.MethodHandles.lookup().lookupClass().getSimpleName();
javascriptSupport.require(className).with(config);
======================== end

the className evaluates to "Container", but by calling getSimpleName
the
code becomes copy/pastable and independent of a hardcoded string

subsequently, you have to save the atmosphere.js and Container.js
into
src/main/resources/META-INF/modules and you are done...
your original tapestry-atmosphere is wrapped into a module-like
structure,
but the real catch to get it to work properly was the subsocket
assignment:
======================== begin
require(['atmosphere'], function(atmosphere) {
subsocket = atmosphere.subscribe(request)
});
======================== end

making the javascript files of your tapestry-stitch compatible with
tapestry 5.4.0 goes as follows:

changes wrt mixins.Observe.java:

  • remove the library import "@import(library = "Observe.js")"
  • replace afterRender() and onObserve(...) with the following:
    ======================== begin
    final private static String className =

java.lang.invoke.MethodHandles.lookup().lookupClass().getSimpleName();
void afterRender() {
List calculatedFields = calculateFields();
if (calculatedFields != null) {
String listenerURI = resources.createEventLink(className,
event, context, ("" + fields).split(",").length).toURI();
String clientId = container.getClientId();
jss.require(className).with(clientId, getClientEvent(),
listenerURI, zone, "" + calculatedFields, className);
}
}
Object onObserve(String event, String context, int fieldCount) {
List contextValues = new ArrayList();
if (context != null) {
contextValues.add(context);
}
for (int i = 0; i < fieldCount; ++i) {
String paramName = className + i;
contextValues.add(request.getParameter(paramName));
}
CaptureResultCallback callback = new
CaptureResultCallback();
EventContext eventContext = new StringEventContext(contextValues,
valueEncoderSource);
resources.triggerContextEvent(event, eventContext, callback);
return callback.getResult();
}
======================== end

  • save prettify.js (your original) and the two attached files
    ProgressLink.js and Observe.js
    ./src/main/resources/META-INF/assets/stitch/prettify.js
    ./src/main/resources/META-INF/assets/stitch/ProgressLink.js
    ./src/main/resources/META-INF/modules/Observe.js

the catch in both progress link and observe is the declaration of the
zone
manager and calling the deferredZoneUpdate...

you will see that components.Errors.java imports
org.apache.tapestry5.corelib.internal.InternalMessages which is no
longer
supported by 5.4.0.
I fixed this by replacing "if (tracker == null) throw new
RuntimeException(InternalMessages.encloseErrorsInForm());" with "if
(tracker!=null)"

I also had to avoid a couple of NullPointerExceptions in
GridCollapse.java
and GridDecorator.java where collapseColumn and
containingDiv.find("table/tbody") can be null, but these issues are
trivial
to get by...

kind regards, danny.

On 25 January 2016 at 22:25, danny de cock [email protected]
wrote:

hello,

the shim-thing sounds promising indeed...

wrt tapestry-stitch: I will create a diff between my 5.4 version
and
your
github version.
I have no experience with pull requests, but will give it a try...

thanks & cu later, d.

On 25 January 2016 at 15:29, Lance [email protected]
wrote:

Hi Danny,

I can't say I'm that familiar with porting apps to t4.5 but it
does
sound
like a scoping issue. Perhaps we need to create a "shim" for
atmosphere
so
it's a require module then t5-atmosphere "require's" the
atmosphere
module?

a couple of months ago, I ported most of the features of your
tapestry-stitch successfully to 5.4. if you wish, I can send them
to
you...

Great! I've been meaning to do that myself but never found the
time.
Please
send a pull request through github. Thanks!

On 25 Jan 2016 10:00, "githubgodot" [email protected]
wrote:

hello,

all the javascript files are found correctly: I put them in
src/main/webapp
and prepended the imports with the prefix "context:".

I put a couple alerts into tapestry-atmosphere.js and everything
gets
executed up to the line before "subsocket =
atmosphere.subscribe(request);"
where it reports an requirejs exception that reads require: atmosphere is not defined.

I also added a couple alerts to confirm that atmosphere.js gets
loaded
and
executed, and it does... it seems to be a difference in
scope/visibility
where the tapestry-atmosphere is not able to see the atmosphere
code...

when I reload the page manually, the chat messages have been
processed
correctly, but they are not pushed automagically without the
reloading
the
page.

a couple of months ago, I ported most of the features of your
tapestry-stitch successfully to 5.4. if you wish, I can send
them
to
you...

thanks for your feedback, danny.

On 25 January 2016 at 10:30, Lance [email protected]
wrote:

I haven't tried tapestry-atmosphere in t5.4. You might want to
open
the
developer tools in your browser (f12) and have a look in the
network
tab.
Are all javascript files found? Or are some getting a 404?

I know t5.4 has new conventions for asset locations. Perhaps
the
atmosphere
javascript files need to be under META-INF/assets
On 25 Jan 2016 08:44, "githubgodot" <[email protected]

wrote:

I am trying to use the chat demo of tapestry-atmosphere in
tapestry
540
after a little struggle to put the javascript modules in the
right
directories I have come to a situation where the chat demo
works,
but
does
not push the new messages to the client the webdeveloper
console
shows
that
requirejs could not find atmosphere this turns out to be
triggered
by
the
statement atmospheresubscribe call in the javascript file
any idea how I can fix this?
thanks, g


Reply to this email directly or view it on GitHub
#28.


Reply to this email directly or view it on GitHub
<

#28 (comment)

.


Reply to this email directly or view it on GitHub
<

#28 (comment)

.


Reply to this email directly or view it on GitHub
<

#28 (comment)

.


Reply to this email directly or view it on GitHub
<

#28 (comment)

.


Reply to this email directly or view it on GitHub
<

#28 (comment)

.


Reply to this email directly or view it on GitHub
<
#28 (comment)

.


Reply to this email directly or view it on GitHub
#28 (comment)
.

from tapestry-atmosphere.

githubgodot avatar githubgodot commented on June 23, 2024

hello lance,

I had to replace the prototype specific calls Object.toJSON() and Object.evalJSON() with the atmosphere equivalent atmosphere.util.stringifyJSON() and atmosphere.util.parseJSON() calls to make it also work in the application I am developing...

the container.js in attachment works fine now...

kind regards, d.
Container.js.txt

from tapestry-atmosphere.

uklance avatar uklance commented on June 23, 2024

tapestry-atmosphere upgraded to tapestry 5.4 thanks to this pull request. Please try version 0.0.6

from tapestry-atmosphere.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.