I am trying to use the chat demo of tapestry-atmosphere in tapestry 5.4.0. 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 atmosphere.subscribe call in the javascript file.
any idea how I can fix this?
thanks, g.
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" notifications@github.com 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
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 notifications@github.com 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" notifications@github.com 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
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" notifications@github.com 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 notifications@github.com 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" notifications@github.com 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
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 notifications@github.com 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" notifications@github.com 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 notifications@github.com 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" notifications@github.com 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
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
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 danny.decock@gmail.com 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 notifications@github.com 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" notifications@github.com 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 notifications@github.com 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" notifications@github.com 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
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 danny.decock@gmail.com 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 notifications@github.com 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" notifications@github.com 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 notifications@github.com 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" notifications@github.com
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
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 notifications@github.com 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
On 27 Jan 2016 17:36, "githubgodot" notifications@github.com 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 danny.decock@gmail.com
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 notifications@github.com 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" notifications@github.com 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 notifications@github.com
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" notifications@github.com
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
Hi Danny, nothing attached unfortunately.
On 28 Jan 2016 10:24, "githubgodot" notifications@github.com 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 notifications@github.com 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
On 27 Jan 2016 17:36, "githubgodot" notifications@github.com 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 danny.decock@gmail.com
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 notifications@github.com 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" notifications@github.com
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 notifications@github.com
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" notifications@github.com
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
probably stripped by github... will send the attachment to your gmail
account...
d.
On 28 January 2016 at 11:40, Lance notifications@github.com wrote:
Hi Danny, nothing attached unfortunately.
On 28 Jan 2016 10:24, "githubgodot" notifications@github.com 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 notifications@github.com 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
On 27 Jan 2016 17:36, "githubgodot" notifications@github.com 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 danny.decock@gmail.com
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 notifications@github.com
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" notifications@github.com
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 notifications@github.com
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" <notifications@github.com
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
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...
I am trying to use the chat demo of tapestry-atmosphere in tapestry 5.4.0. 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 atmosphere.subscribe call in the javascript file. any idea how I can fix this? thanks, g.