Re: SoftReferences to PageImpl can cause performance problems

2015-03-19 Thread Robert Schmelzer
By removing the SoftReference in PageSourceImpl. You would get an 
OutOfMemoryError directly when you reach memory limit and the GC would 
not try to fix this by throwing away PageImpl instances.


So you would fail on you test env earlier. Otherwise things would come 
up during Performance/Loadtests which usually is later.



Am 18.03.2015 um 22:01 schrieb Thiago H de Paula Figueiredo:
On Wed, 18 Mar 2015 04:44:10 -0300, Robert Schmelzer 
rob...@schmelzer.cc wrote:


I do not agree with you on that  point. Tapestry is designed to cache 
the page. When you do not have enough memory to hold your pages 
cached basically the system does not work as designed so you should 
fail early.


How could Tapestry detect this situation to fail early?




-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Live Class Reloading

2015-03-19 Thread Adam X
Hi Felix - I also, once again, just created project and it is production
mode (not reporting development next to tapestry logo in the log output). I
also did a simple test by changing tapestryVersion property (Index.java) to
tapestryVersionn, expecting exception but none showing upon refreshing the
browser. Furthermore, restarting the app, does show the exception page, but
looks like it's production because no detailed exception report is
generated. Adding JVM param tapestry.execution-mode=development does make
it development, but again, this should not be necessary with
configuration.add(SymbolConstants.PRODUCTION_MODE,
false); unless I'm getting it wrong.

My enviornment:

As reported by: java --version :

java version 1.7.0_76
Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)

Remaining stack:

Eclipse Luna Service Release 1a (4.4.1)
Maven (m2e plug only) - no standalone
RJR 1.3.3.201203161919 (with embedded Jetty 6.1.26) - as installed from
Eclipse Marketplace
Tapestry 5.3.7
Ubuntu Trusty (14.04)

Adam

On Thu, Mar 19, 2015 at 2:16 AM, Felix Scheffer fschef...@felix-scheffer.de
 wrote:

 Hi Adam,

 I just created a project using the archetype and live reloading works fine
 without tapestry.execution-mode=development.

 Are you sure that you are in not in production mode? Your log should
 contain 5.3.7 (development mode) next to the Tapestry logo.

 The CheckForUpdatesFilter should
 call ComponentTemplateSourceImpl.checkForUpdates() on a regular basis to
 detect template changes.

 Hope that helps.

 Felix


 2015-03-18 15:38 GMT+01:00 Adam X vbgnm3c...@gmail.com:

  Howdy,
 
  I'm returning to Tapestry after several years of inactivity and I'm
  attempting a new project with T5.3.7.
 
  Ran a standard tut and found out that Live Class Reloading (following the
  tutorial) does not work unless Eclipse RJR Run Config is amended with a
 JVM
  param: -Dtapestry.execution-mode=development
 
  But,
 
  DevelopmentModule.java
 
  contains:
 
  // The factory default is true but during the early stages of an
  // application
  // overriding to false is a good idea. In addition, this is often
  // overridden
  // on the command line as -Dtapestry.production-mode=false
  configuration.add(SymbolConstants.PRODUCTION_MODE, false);
 
  The Class Reloading page @
 http://tapestry.apache.org/class-reloading.html
 
  Says the following:
 
  If Live Class Reloading doesn't workProduction Mode
 
  Starting with Tapestry 5.3, Live Class Reloading only works when not in
  Production Mode. Check your application module (usually AppModule.java)
  to be sure you have:
  configuration.add(SymbolConstants.PRODUCTION_MODE, false);
 
  and that this isn't being overridden to true on your application's
  startup command line.
 
  All other issues such as automatic IDE build etc have been confirmed to
 be
  setup properly.
 
  So this suggests that simply adding configuration with PRODUCTION_MODE
  false should enable development mode and therefore live class reloading.
  But that's not the case. A raw startup project setup according to
  http://tapestry.apache.org/creating-the-skeleton-application.html ,
 which
  does have PRODUCTION_MODE false in DevelopmentMode.java and the run
  configuration JVM parameter *empty* appears to run as if production mode
 =
  true.
 
  Adam
 



Re: SoftReferences to PageImpl can cause performance problems

2015-03-19 Thread Robert Schmelzer
Sorry, I was unprecise - my example should have referenced to the 
EntityManagerFactory (SessionFactoryImpl in Hibernate). You would not 
expect them, to throw away its cached configuration on memory preasure. 
I do not either expect that from Tapestry.


I cannot make our results public because of regulatory issues. I will 
try to setup a show case for that and will offer a patch. This will take 
me a few days.


Robert

Am 18.03.2015 um 18:19 schrieb Kalle Korhonen:

On Wed, Mar 18, 2015 at 12:44 AM, Robert Schmelzer rob...@schmelzer.cc
wrote:


I do not agree with you on that  point. Tapestry is designed to cache the
page. When you do not have enough memory to hold your pages cached
basically the system does not work as designed so you should fail early.
Otherwise you possible defer the problem to production use. Fail early
means you should try to see the problem in the early stages on dev, where
you try out all your pages. As I mentioned in my other post - you would
also not expect the EntityManager to work soft-refereences or spring
application context to work soft referenced.



That's the definition of a memory cache - it trades memory for better
performance. The primary use case for soft refences is for caching so seems
to me it works exactly as designed. Your comparison to the EntityManager is
flawed since it's created per request. An EntityManager is designed to be
inexpensive to create. There are many areas that need improvements in
Tapestry but this is not one in my opinion. However, you seem to strongly
think otherwise, so you probably have some data to back this up. Do you
have a memory dump and trending cpu/memory charts of a sufficiently large
system you can share with us to demonstrate the problem? Jvisualvm
snapshots should work fine. And furthermore - how would you like this
changed? If it's just adding a Page as a threadlocal, perhaps you can just
write a patch for it.

Kalle



Am 18.03.2015 um 04:23 schrieb Kalle Korhonen:

  In my opinion, soft referencing page objects is highly appropriate usage

here. If there's pressure on the available memory, it makes sense to trade
performance for memory instead of exiting with OoM. This is simple
condition to detect and should be visible with any reasonable monitoring
tool. If you are hitting memory limits, you'll need to allocate more
memory
for the application for optimal performance. Soft references are
especially
useful here because you can optimize its behavior with the -client/-server
setting depending on your preferences.

Kalle

On Tue, Mar 17, 2015 at 4:26 PM, Howard Lewis Ship hls...@gmail.com
wrote:

  Possibly we need something more advanced; our own reference type that can

react to memory pressure by discarding pages that haven't been used in
configurable amount of time.

Or perhaps we could just assume that any page that has been used once
need
to be used in the future and get rid of the SoftReference entirely (or
otherwise janitorize it in some way).

On Tue, Mar 17, 2015 at 1:24 AM, Robert Schmelzer rob...@schmelzer.cc
wrote:

  Hello,

I recently came accross the implementation of PageSourceImpl where
PageImpl instances are softly refereneced into the pageCache:

private final MapCachedPageKey, SoftReferencePage pageCache =
CollectionFactory.newConcurrentMap();

This implementation caused troubles, when you bring your system into
memory preassure. The JVM will start to throw away the PageImpl to free


up


memory - but during request processing he needs the PageImpl again and
starts creating it again. So basically you end up loosing your pageCache


at


all and start creating the PageImpl instances on every request, which


take


way to much time and takes load onto the CPU. So basically you are


hiding a


memory problem by making the system slow and raise CPU load.

I would suggest to use normal references for the PageCache or at least
only do SoftReferences only when not in production mode. Otherwise we
are
going to cover memory problems for too long.

What do you think about that?

Robert

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




--
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com
@hlship



-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org





-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



JS conflict

2015-03-19 Thread Cheng Zhang
Hi all,

I am trying to apply Foundation framework to an existing Tapestry project.
But the JavaScript usded by Foundation seems like conflict with Tapestry JS.

Once I added the Foundataion JS file to my tml file, the eventlink does no
longer work, there is no any response after cliking, and Eclipse console
has no output.

I believe the http://foundation.zurb.com/docs/assets/js/all.js makes some
negative effect on the existing JS function Tapestry.waitForPage.

The tml file eventlink code:

a t:type=*eventlink* t:event=*resetPassword* t:zone=*editZone*
t:update=*show* href=*#*Forgot Password/a
In browser the generated html code:

a id=eventlink onclick=javascript:return Tapestry.waitForPage(event);
update=show href=/portal/signin:resetpasswordForgot Password/a

Thanks for your help!

Charles


Re: Weird behaviour, require js doesn't refresh changed js file immediately

2015-03-19 Thread abangkis
Sorry to brought up old thread. Does anyone know where I can set up the
expiration time for require js module? Can I set it to zero or 1 second?

Thanks.



On Tue, Feb 10, 2015 at 10:21 PM, Howard Lewis Ship hls...@gmail.com
wrote:

 For modules, which can't be fingerprinted with a checksum in the URL,
 Tapestry applies a short expiration time in development, and a much longer
 one in production. I suspect you are hitting that.  A hard refresh,
 clearing the local cache, should force the browser to request the updated
 resource.

 Sometimes the browser just refuses to get the resource; you can see this
 when it looks one way in the browser, and differently and correctly via
 curl or httpie.

 On Sun, Feb 8, 2015 at 10:49 PM, abangkis abang...@gmail.com wrote:

  Ok, my workaround is to add some kind of index number to log to
 javascript
  console such as : console.log(29. Google map is ready); I keep
 refreshing
  until the number is changed. For now it's good enough but hopefully
 there's
  a better solution in the future.
 
  On Sat, Feb 7, 2015 at 11:24 AM, abangkis abang...@gmail.com wrote:
 
   Hi guys, another question about require js. So i experiment with
 creating
   a new source folder in eclipse by the name of requiresrc. Under that
  folder
   will reside the META-INF/modules/my_javascript.js file. This way
 eclipse
   will deploy the META-INF/modules folder to the classes module
   automatically. It worked.
  
   The problem is when i change my_javascript.js file content. The content
   doesn't get refreshed automatically. Hitting F5 and Shift-F5 doesn't
  change
   it too. But after a while (5-10 second) then the content will be
 changed
   automatically.
  
   Looking around i found this related thread
  
 
 http://www.wenda.io/questions/4211439/force-refresh-doesnt-work-for-head-js.html
   basically it says that F5 wouldn't work because of the dynamic script
   loading. So, does anyone have a trick with this kind of thing? Because
  I'm
   used of putting my js folder under WebApp folder and hitting refresh,
tapestry would pick up the new content. Restarting the app every time
 i
   change the js file would be a big pain.
  
   Thanks :)
  
   --
   http://www.mreunionlabs.net/ http://www.mreunion-labs.net/
   twitter : @mreunionlabs @abangkis
   page : https://plus.google.com/104168782385184990771
  
 
 
 
  --
  http://www.mreunionlabs.net/ http://www.mreunion-labs.net/
  twitter : @mreunionlabs @abangkis
  page : https://plus.google.com/104168782385184990771
 



 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

 The source for Tapestry training, mentoring and support. Contact me to
 learn how I can get you up and productive in Tapestry fast!

 (971) 678-5210
 http://howardlewisship.com
 @hlship




-- 
http://www.mreunionlabs.net/ http://www.mreunion-labs.net/
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771


Re: Live Class Reloading

2015-03-19 Thread Adam X
Okay, I figured out the problem. I suppose the skeleton setup is somewhat
confusing. The services package in the skeleton provides for 3 modules:
AppModule, DevelopmentModule and a QaModule. Of those, seems like only
AppModule is loaded which does not contain the configuration for dev.
Therefore, simply following the tutorial by setting up the skeleton project
and executing it will run it in production mode.

The Development module, which contains
configuration.add(SymbolConstants.PRODUCTION_MODE, false); has the
following comment:

/**
 * This module is automatically included as part of the Tapestry IoC
Registry if
 * emtapestry.execution-mode/em includes codedevelopment/code.
 */

So the confusing part is that in order for Tapestry to use the
DevelopmentModule which has the necessary configuration it is required to
pass a JVM parameter in the first place, which in turn yields the point
about adding:

configuration.add(SymbolConstants.PRODUCTION_MODE, false);

kind of pointless. So my question is, what is the point of the above, if in
order to force the development module it is necessary to pass a JVM param
in the first place?

The funny thing is that commenting out
configuration.add(SymbolConstants.PRODUCTION_MODE, false); from the
DevelopmentModule and passing -Dtapestry.execution-mode=development runs in
the dev mode anyway. Again - what's the point of that configuration then?


On Thu, Mar 19, 2015 at 1:18 PM, Thiago H de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Thu, 19 Mar 2015 03:06:29 -0300, Adam X vbgnm3c...@gmail.com wrote:

  it development, but again, this should not be necessary with
 configuration.add(SymbolConstants.PRODUCTION_MODE,
 false); unless I'm getting it wrong.


 Have you tried configuration.add(SymbolConstants.PRODUCTION_MODE,
 false)? Is it in contributeApplicationDefaults()?

 --
 Thiago H. de Paula Figueiredo
 Tapestry, Java and Hibernate consultant and developer
 http://machina.com.br

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




Re: Live Class Reloading

2015-03-19 Thread Thiago H de Paula Figueiredo

On Thu, 19 Mar 2015 03:06:29 -0300, Adam X vbgnm3c...@gmail.com wrote:


it development, but again, this should not be necessary with
configuration.add(SymbolConstants.PRODUCTION_MODE,
false); unless I'm getting it wrong.


Have you tried configuration.add(SymbolConstants.PRODUCTION_MODE,  
false)? Is it in contributeApplicationDefaults()?


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



[5.4] Where to put the require.config?

2015-03-19 Thread Rural Hunter

Hi,

I'm testing tapestry 5.4. I'm wondering where to put the 
requirejs.config code for my own modules and third-party modules?


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: JS conflict

2015-03-19 Thread Cheng Zhang
More information from dev tool Console:

Uncaught TypeError: undefined is not a function prototype.js:2284
Element.Methods.writeAttribute   prototype.js:2284
global.Element
 prototype.js:1898
Tapestry.waitForPage
tapestry.js:120

onclick
(index):7
a.sendClick
all.js:34
a.onTouchEnd
all.js:34

d
all.js:34

On Thu, Mar 19, 2015 at 5:28 PM, Cheng Zhang charlesdenverj...@gmail.com
wrote:

 Hi all,

 I am trying to apply Foundation framework to an existing Tapestry project.
 But the JavaScript usded by Foundation seems like conflict with Tapestry JS.

 Once I added the Foundataion JS file to my tml file, the eventlink does no
 longer work, there is no any response after cliking, and Eclipse console
 has no output.

 I believe the http://foundation.zurb.com/docs/assets/js/all.js makes some
 negative effect on the existing JS function Tapestry.waitForPage.

 The tml file eventlink code:

 a t:type=*eventlink* t:event=*resetPassword* t:zone=*editZone*
 t:update=*show* href=*#*Forgot Password/a
 In browser the generated html code:

 a id=eventlink onclick=javascript:return Tapestry.waitForPage(event);
 update=show href=/portal/signin:resetpasswordForgot Password/a

 Thanks for your help!

 Charles



Re: SoftReferences to PageImpl can cause performance problems

2015-03-19 Thread Kalle Korhonen
On Thu, Mar 19, 2015 at 12:24 AM, Robert Schmelzer rob...@schmelzer.cc
wrote:

 Sorry, I was unprecise - my example should have referenced to the
 EntityManagerFactory (SessionFactoryImpl in Hibernate). You would not
 expect them, to throw away its cached configuration on memory preasure. I
 do not either expect that from Tapestry.
 I cannot make our results public because of regulatory issues. I will try
 to setup a show case for that and will offer a patch. This will take me a
 few days.


I don't think we are going to simply do away with the SoftReferences
without any replacements so I wouldn't even attempt at offering such a
patch. I just don't agree that a memory cache should be permanent
construct. If your object is not in a cache, you'll simply incur a cache
miss and re-create the object on the fly. It is not typical that a cache
will grow indefinitely. If you are adamant on this approach, you could
probably convince us to add a symbol to control the cache behavior (i.e. to
never purge objects from it). Guava has excellent, easily configurable
cache implementations.

Kalle


 Robert

 Am 18.03.2015 um 18:19 schrieb Kalle Korhonen:

  On Wed, Mar 18, 2015 at 12:44 AM, Robert Schmelzer rob...@schmelzer.cc
 wrote:

  I do not agree with you on that  point. Tapestry is designed to cache the
 page. When you do not have enough memory to hold your pages cached
 basically the system does not work as designed so you should fail early.
 Otherwise you possible defer the problem to production use. Fail early
 means you should try to see the problem in the early stages on dev, where
 you try out all your pages. As I mentioned in my other post - you would
 also not expect the EntityManager to work soft-refereences or spring
 application context to work soft referenced.


  That's the definition of a memory cache - it trades memory for better
 performance. The primary use case for soft refences is for caching so
 seems
 to me it works exactly as designed. Your comparison to the EntityManager
 is
 flawed since it's created per request. An EntityManager is designed to be
 inexpensive to create. There are many areas that need improvements in
 Tapestry but this is not one in my opinion. However, you seem to strongly
 think otherwise, so you probably have some data to back this up. Do you
 have a memory dump and trending cpu/memory charts of a sufficiently large
 system you can share with us to demonstrate the problem? Jvisualvm
 snapshots should work fine. And furthermore - how would you like this
 changed? If it's just adding a Page as a threadlocal, perhaps you can just
 write a patch for it.

 Kalle


  Am 18.03.2015 um 04:23 schrieb Kalle Korhonen:

   In my opinion, soft referencing page objects is highly appropriate
 usage

 here. If there's pressure on the available memory, it makes sense to
 trade
 performance for memory instead of exiting with OoM. This is simple
 condition to detect and should be visible with any reasonable monitoring
 tool. If you are hitting memory limits, you'll need to allocate more
 memory
 for the application for optimal performance. Soft references are
 especially
 useful here because you can optimize its behavior with the
 -client/-server
 setting depending on your preferences.

 Kalle

 On Tue, Mar 17, 2015 at 4:26 PM, Howard Lewis Ship hls...@gmail.com
 wrote:

   Possibly we need something more advanced; our own reference type that
 can

 react to memory pressure by discarding pages that haven't been used in
 configurable amount of time.

 Or perhaps we could just assume that any page that has been used once
 need
 to be used in the future and get rid of the SoftReference entirely (or
 otherwise janitorize it in some way).

 On Tue, Mar 17, 2015 at 1:24 AM, Robert Schmelzer rob...@schmelzer.cc
 
 wrote:

   Hello,

 I recently came accross the implementation of PageSourceImpl where
 PageImpl instances are softly refereneced into the pageCache:

 private final MapCachedPageKey, SoftReferencePage pageCache =
 CollectionFactory.newConcurrentMap();

 This implementation caused troubles, when you bring your system into
 memory preassure. The JVM will start to throw away the PageImpl to
 free

  up

  memory - but during request processing he needs the PageImpl again and
 starts creating it again. So basically you end up loosing your
 pageCache

  at

  all and start creating the PageImpl instances on every request, which

  take

  way to much time and takes load onto the CPU. So basically you are

  hiding a

  memory problem by making the system slow and raise CPU load.

 I would suggest to use normal references for the PageCache or at
 least
 only do SoftReferences only when not in production mode. Otherwise we
 are
 going to cover memory problems for too long.

 What do you think about that?

 Robert

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: 

Re: Live Class Reloading

2015-03-19 Thread Felix Scheffer
Hi Adam,

The example uses the maven jetty plugin to set the execution-mode property
to development (in the pom.xml file). So if you use the maven-jetty-plugin
(jetty:run) to start the server, live reloading should work out of the box.

Felix

Felix Scheffer
Dammstrasse 2
68549 Ilvesheim
Tel: 0151 / 15427385

http://www.pimdb.de
m...@pimdb.de

2015-03-19 7:06 GMT+01:00 Adam X vbgnm3c...@gmail.com:

 Hi Felix - I also, once again, just created project and it is production
 mode (not reporting development next to tapestry logo in the log output). I
 also did a simple test by changing tapestryVersion property (Index.java) to
 tapestryVersionn, expecting exception but none showing upon refreshing the
 browser. Furthermore, restarting the app, does show the exception page, but
 looks like it's production because no detailed exception report is
 generated. Adding JVM param tapestry.execution-mode=development does make
 it development, but again, this should not be necessary with
 configuration.add(SymbolConstants.PRODUCTION_MODE,
 false); unless I'm getting it wrong.

 My enviornment:

 As reported by: java --version :

 java version 1.7.0_76
 Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
 Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)

 Remaining stack:

 Eclipse Luna Service Release 1a (4.4.1)
 Maven (m2e plug only) - no standalone
 RJR 1.3.3.201203161919 (with embedded Jetty 6.1.26) - as installed from
 Eclipse Marketplace
 Tapestry 5.3.7
 Ubuntu Trusty (14.04)

 Adam

 On Thu, Mar 19, 2015 at 2:16 AM, Felix Scheffer 
 fschef...@felix-scheffer.de
  wrote:

  Hi Adam,
 
  I just created a project using the archetype and live reloading works
 fine
  without tapestry.execution-mode=development.
 
  Are you sure that you are in not in production mode? Your log should
  contain 5.3.7 (development mode) next to the Tapestry logo.
 
  The CheckForUpdatesFilter should
  call ComponentTemplateSourceImpl.checkForUpdates() on a regular basis to
  detect template changes.
 
  Hope that helps.
 
  Felix
 
 
  2015-03-18 15:38 GMT+01:00 Adam X vbgnm3c...@gmail.com:
 
   Howdy,
  
   I'm returning to Tapestry after several years of inactivity and I'm
   attempting a new project with T5.3.7.
  
   Ran a standard tut and found out that Live Class Reloading (following
 the
   tutorial) does not work unless Eclipse RJR Run Config is amended with a
  JVM
   param: -Dtapestry.execution-mode=development
  
   But,
  
   DevelopmentModule.java
  
   contains:
  
   // The factory default is true but during the early stages of an
   // application
   // overriding to false is a good idea. In addition, this is often
   // overridden
   // on the command line as -Dtapestry.production-mode=false
   configuration.add(SymbolConstants.PRODUCTION_MODE, false);
  
   The Class Reloading page @
  http://tapestry.apache.org/class-reloading.html
  
   Says the following:
  
   If Live Class Reloading doesn't workProduction Mode
  
   Starting with Tapestry 5.3, Live Class Reloading only works when not in
   Production Mode. Check your application module (usually
 AppModule.java)
   to be sure you have:
   configuration.add(SymbolConstants.PRODUCTION_MODE, false);
  
   and that this isn't being overridden to true on your application's
   startup command line.
  
   All other issues such as automatic IDE build etc have been confirmed to
  be
   setup properly.
  
   So this suggests that simply adding configuration with PRODUCTION_MODE
   false should enable development mode and therefore live class
 reloading.
   But that's not the case. A raw startup project setup according to
   http://tapestry.apache.org/creating-the-skeleton-application.html ,
  which
   does have PRODUCTION_MODE false in DevelopmentMode.java and the run
   configuration JVM parameter *empty* appears to run as if production
 mode
  =
   true.
  
   Adam
  
 



Re: HTTP/S Session Cookie

2015-03-19 Thread Martin Polívka
Thank you, that's what I think, but I can't make it why it was working on
Tapestry 5.0.14. I think that it's not Tapestry related problem, but only
Tapestry version changed - no browser, Tomcat or another.
Making app accessible on https only is last option which I would like to
avoid :)

čt 19. 3. 2015 v 18:00 odesílatel Kalle Korhonen kalle.o.korho...@gmail.com
napsal:

 On Thu, Mar 19, 2015 at 9:41 AM, Martin Polívka martasdx@gmail.com
 wrote:

  Hi, I am quite new to Tapestry, but last month I am upgrading our app
 from
  Tapestry 5.0.14 to 5.3.8. It's working now with one problem.
  We use Tomcat 7, servlet 3.0 (in the future Tomcat 8 and servlet 3.1) and
  Java 7. Tomcat listens on http (8080) and https(8443). If I use https,
  everything is OK.
  If I use http, I enter login page off app and SessionState object is
  created. I can see Session ID (equals X). It's done
  by contributeApplicationStateManager function in Module. Another
 contribute
  is for URL (contributeServiceOverride) where we use only https
 connection.
  That's because we want all ajax requests to go over https even if user is
  on http.
  So if user log in, session and cookie is created with atribute httpOnly
 and
  if I send ajax request to https, another session is created by Tapestry.
  Is it possible to access the http session in https request?
 
 
 In general, no, it's not possible. This is a security issue and it's not
 related to Tapestry. Container-specific configuration may allow
 joining/sharing sessions on the servers (I recall having done something
 similar in the past with Tomcat). I'd advise simply using https everywhere,
 it'll make your life easier.

 Kalle



The active page name has not been specified

2015-03-19 Thread George Christman
Could someone help me to understand this exception? I'm using Tap 5.4 and
I've been seeing this quite often, but can't seem to reproduce it.

The active page name has not been
specified.org.apache.tapestry5.ioc.internal.OperationException: The active
page name has not been specified. at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.logAndRethrow(OperationTrackerImpl.java:184)
at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perform(OperationTrackerImpl.java:118)
at
org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.perform(PerThreadOperationTracker.java:84)
at
org.apache.tapestry5.ioc.internal.RegistryImpl.perform(RegistryImpl.java:1264)
at
org.apache.tapestry5.internal.services.DeferredResponseRenderer.invokeQueuedRenderer(DeferredResponseRenderer.java:73)
at
org.apache.tapestry5.internal.services.DeferredResponseRenderer.handleComponentEvent(DeferredResponseRenderer.java:47)
at $ComponentRequestHandler_18c715615aaee.handleComponentEvent(Unknown
Source) at
org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39)
at $ComponentRequestHandler_18c715615aaee.handleComponentEvent(Unknown
Source) at
org.apache.tapestry5.internal.services.ProductionModeUnknownComponentFilter.handleComponentEvent(ProductionModeUnknownComponentFilter.java:50)
at $ComponentRequestHandler_18c715615aaee.handleComponentEvent(Unknown
Source) at
org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:55)
at
org.apache.tapestry5.internal.services.RequestOperationTracker$1.perform(RequestOperationTracker.java:52)
at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perform(OperationTrackerImpl.java:110)
at
org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.perform(PerThreadOperationTracker.java:84)
at
org.apache.tapestry5.ioc.internal.RegistryImpl.perform(RegistryImpl.java:1264)
at
org.apache.tapestry5.internal.services.RequestOperationTracker.handleComponentEvent(RequestOperationTracker.java:47)
at $ComponentRequestHandler_18c715615aaee.handleComponentEvent(Unknown
Source) at
org.tynamo.security.SecurityComponentRequestFilter.handleComponentEvent(SecurityComponentRequestFilter.java:41)
at $ComponentRequestFilter_18c715615aaeb.handleComponentEvent(Unknown
Source) at
$ComponentRequestHandler_18c715615aaee.handleComponentEvent(Unknown Source)
at $ComponentRequestHandler_18c715615aac8.handleComponentEvent(Unknown
Source) at
org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:48)
at $Dispatcher_18c715615aac9.dispatch(Unknown Source) at
$Dispatcher_18c715615aac2.dispatch(Unknown Source) at
org.apache.tapestry5.modules.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:305)
at org.healthresearch.etss.services.AppModule$1.service(AppModule.java:302)
at $RequestFilter_18c715615aac1.service(Unknown Source) at
$RequestHandler_18c715615aac3.service(Unknown Source) at
org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
at $RequestHandler_18c715615aac3.service(Unknown Source) at
org.apache.tapestry5.modules.TapestryModule$3.service(TapestryModule.java:844)
at $RequestHandler_18c715615aac3.service(Unknown Source) at
org.apache.tapestry5.modules.TapestryModule$2.service(TapestryModule.java:834)
at $RequestHandler_18c715615aac3.service(Unknown Source) at
org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:89)
at $RequestHandler_18c715615aac3.service(Unknown Source) at
$RequestHandler_18c715615aa81.service(Unknown Source) at
org.apache.tapestry5.modules.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:256)
at
org.tynamo.security.services.impl.SecurityConfiguration$1.call(SecurityConfiguration.java:56)
at
org.tynamo.security.services.impl.SecurityConfiguration$1.call(SecurityConfiguration.java:54)
at
org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at
org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at
org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at
org.tynamo.security.services.impl.SecurityConfiguration.service(SecurityConfiguration.java:54)
at $HttpServletRequestFilter_18c715615aa80.service(Unknown Source) at
$HttpServletRequestHandler_18c715615aa83.service(Unknown Source) at
org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter.service(MultipartServletRequestFilter.java:45)
at $HttpServletRequestHandler_18c715615aa83.service(Unknown Source) at
org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:59)
at $HttpServletRequestHandler_18c715615aa83.service(Unknown Source) at
org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
at $HttpServletRequestFilter_18c715615aa7c.service(Unknown Source) at
$HttpServletRequestHandler_18c715615aa83.service(Unknown Source) at

Re: HTTP/S Session Cookie

2015-03-19 Thread Kalle Korhonen
On Thu, Mar 19, 2015 at 9:41 AM, Martin Polívka martasdx@gmail.com
wrote:

 Hi, I am quite new to Tapestry, but last month I am upgrading our app from
 Tapestry 5.0.14 to 5.3.8. It's working now with one problem.
 We use Tomcat 7, servlet 3.0 (in the future Tomcat 8 and servlet 3.1) and
 Java 7. Tomcat listens on http (8080) and https(8443). If I use https,
 everything is OK.
 If I use http, I enter login page off app and SessionState object is
 created. I can see Session ID (equals X). It's done
 by contributeApplicationStateManager function in Module. Another contribute
 is for URL (contributeServiceOverride) where we use only https connection.
 That's because we want all ajax requests to go over https even if user is
 on http.
 So if user log in, session and cookie is created with atribute httpOnly and
 if I send ajax request to https, another session is created by Tapestry.
 Is it possible to access the http session in https request?


In general, no, it's not possible. This is a security issue and it's not
related to Tapestry. Container-specific configuration may allow
joining/sharing sessions on the servers (I recall having done something
similar in the past with Tomcat). I'd advise simply using https everywhere,
it'll make your life easier.

Kalle


Re: Weird behaviour, require js doesn't refresh changed js file immediately

2015-03-19 Thread Felix Scheffer
Hi,

for AMD modules, caching should be disabled by default.

The default value for the Cache-Control header in this case is:
max-age=60,must-revalidate. You can customize that by setting
SymbolConstants.OMIT_EXPIRATION_CACHE_CONTROL_HEADER.

Hope that helps!

Felix


2015-03-19 10:46 GMT+01:00 abangkis abang...@gmail.com:

 Sorry to brought up old thread. Does anyone know where I can set up the
 expiration time for require js module? Can I set it to zero or 1 second?

 Thanks.



 On Tue, Feb 10, 2015 at 10:21 PM, Howard Lewis Ship hls...@gmail.com
 wrote:

  For modules, which can't be fingerprinted with a checksum in the URL,
  Tapestry applies a short expiration time in development, and a much
 longer
  one in production. I suspect you are hitting that.  A hard refresh,
  clearing the local cache, should force the browser to request the updated
  resource.
 
  Sometimes the browser just refuses to get the resource; you can see this
  when it looks one way in the browser, and differently and correctly via
  curl or httpie.
 
  On Sun, Feb 8, 2015 at 10:49 PM, abangkis abang...@gmail.com wrote:
 
   Ok, my workaround is to add some kind of index number to log to
  javascript
   console such as : console.log(29. Google map is ready); I keep
  refreshing
   until the number is changed. For now it's good enough but hopefully
  there's
   a better solution in the future.
  
   On Sat, Feb 7, 2015 at 11:24 AM, abangkis abang...@gmail.com wrote:
  
Hi guys, another question about require js. So i experiment with
  creating
a new source folder in eclipse by the name of requiresrc. Under that
   folder
will reside the META-INF/modules/my_javascript.js file. This way
  eclipse
will deploy the META-INF/modules folder to the classes module
automatically. It worked.
   
The problem is when i change my_javascript.js file content. The
 content
doesn't get refreshed automatically. Hitting F5 and Shift-F5 doesn't
   change
it too. But after a while (5-10 second) then the content will be
  changed
automatically.
   
Looking around i found this related thread
   
  
 
 http://www.wenda.io/questions/4211439/force-refresh-doesnt-work-for-head-js.html
basically it says that F5 wouldn't work because of the dynamic script
loading. So, does anyone have a trick with this kind of thing?
 Because
   I'm
used of putting my js folder under WebApp folder and hitting refresh,
 tapestry would pick up the new content. Restarting the app every
 time
  i
change the js file would be a big pain.
   
Thanks :)
   
--
http://www.mreunionlabs.net/ http://www.mreunion-labs.net/
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771
   
  
  
  
   --
   http://www.mreunionlabs.net/ http://www.mreunion-labs.net/
   twitter : @mreunionlabs @abangkis
   page : https://plus.google.com/104168782385184990771
  
 
 
 
  --
  Howard M. Lewis Ship
 
  Creator of Apache Tapestry
 
  The source for Tapestry training, mentoring and support. Contact me to
  learn how I can get you up and productive in Tapestry fast!
 
  (971) 678-5210
  http://howardlewisship.com
  @hlship
 



 --
 http://www.mreunionlabs.net/ http://www.mreunion-labs.net/
 twitter : @mreunionlabs @abangkis
 page : https://plus.google.com/104168782385184990771



Re: Live Class Reloading

2015-03-19 Thread Adam X
I did not use maven-jetty-plugin, so that makes a lot more sense Felix.
Anyway, I fully understand this now. However, without maven-jetty-plugin
the contribution seems bit cumbersome :)

On Thu, Mar 19, 2015 at 5:51 PM, Felix Scheffer fschef...@felix-scheffer.de
 wrote:

 Hi Adam,

 The example uses the maven jetty plugin to set the execution-mode property
 to development (in the pom.xml file). So if you use the maven-jetty-plugin
 (jetty:run) to start the server, live reloading should work out of the box.

 Felix

 Felix Scheffer
 Dammstrasse 2
 68549 Ilvesheim
 Tel: 0151 / 15427385

 http://www.pimdb.de
 m...@pimdb.de

 2015-03-19 7:06 GMT+01:00 Adam X vbgnm3c...@gmail.com:

  Hi Felix - I also, once again, just created project and it is production
  mode (not reporting development next to tapestry logo in the log
 output). I
  also did a simple test by changing tapestryVersion property (Index.java)
 to
  tapestryVersionn, expecting exception but none showing upon refreshing
 the
  browser. Furthermore, restarting the app, does show the exception page,
 but
  looks like it's production because no detailed exception report is
  generated. Adding JVM param tapestry.execution-mode=development does make
  it development, but again, this should not be necessary with
  configuration.add(SymbolConstants.PRODUCTION_MODE,
  false); unless I'm getting it wrong.
 
  My enviornment:
 
  As reported by: java --version :
 
  java version 1.7.0_76
  Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
  Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)
 
  Remaining stack:
 
  Eclipse Luna Service Release 1a (4.4.1)
  Maven (m2e plug only) - no standalone
  RJR 1.3.3.201203161919 (with embedded Jetty 6.1.26) - as installed from
  Eclipse Marketplace
  Tapestry 5.3.7
  Ubuntu Trusty (14.04)
 
  Adam
 
  On Thu, Mar 19, 2015 at 2:16 AM, Felix Scheffer 
  fschef...@felix-scheffer.de
   wrote:
 
   Hi Adam,
  
   I just created a project using the archetype and live reloading works
  fine
   without tapestry.execution-mode=development.
  
   Are you sure that you are in not in production mode? Your log should
   contain 5.3.7 (development mode) next to the Tapestry logo.
  
   The CheckForUpdatesFilter should
   call ComponentTemplateSourceImpl.checkForUpdates() on a regular basis
 to
   detect template changes.
  
   Hope that helps.
  
   Felix
  
  
   2015-03-18 15:38 GMT+01:00 Adam X vbgnm3c...@gmail.com:
  
Howdy,
   
I'm returning to Tapestry after several years of inactivity and I'm
attempting a new project with T5.3.7.
   
Ran a standard tut and found out that Live Class Reloading (following
  the
tutorial) does not work unless Eclipse RJR Run Config is amended
 with a
   JVM
param: -Dtapestry.execution-mode=development
   
But,
   
DevelopmentModule.java
   
contains:
   
// The factory default is true but during the early stages of an
// application
// overriding to false is a good idea. In addition, this is often
// overridden
// on the command line as -Dtapestry.production-mode=false
configuration.add(SymbolConstants.PRODUCTION_MODE, false);
   
The Class Reloading page @
   http://tapestry.apache.org/class-reloading.html
   
Says the following:
   
If Live Class Reloading doesn't workProduction Mode
   
Starting with Tapestry 5.3, Live Class Reloading only works when not
 in
Production Mode. Check your application module (usually
  AppModule.java)
to be sure you have:
configuration.add(SymbolConstants.PRODUCTION_MODE, false);
   
and that this isn't being overridden to true on your application's
startup command line.
   
All other issues such as automatic IDE build etc have been confirmed
 to
   be
setup properly.
   
So this suggests that simply adding configuration with
 PRODUCTION_MODE
false should enable development mode and therefore live class
  reloading.
But that's not the case. A raw startup project setup according to
http://tapestry.apache.org/creating-the-skeleton-application.html ,
   which
does have PRODUCTION_MODE false in DevelopmentMode.java and the run
configuration JVM parameter *empty* appears to run as if production
  mode
   =
true.
   
Adam
   
  
 



Re: Live Class Reloading

2015-03-19 Thread Thiago H de Paula Figueiredo

On Thu, 19 Mar 2015 09:46:25 -0300, Adam X vbgnm3c...@gmail.com wrote:


So the confusing part is that in order for Tapestry to use the
DevelopmentModule which has the necessary configuration it is required to
pass a JVM parameter in the first place, which in turn yields the point
about adding:

configuration.add(SymbolConstants.PRODUCTION_MODE, false);

kind of pointless. So my question is, what is the point of the above, if  
in order to force the development module it is necessary to pass a JVM  
param

in the first place?


I don't think you got why execution modes exists. It's for having  
different configurations for different environments (development, QA,  
staging, production, etc) which you can select by JVM argument. It  
defaults to the production environment, so you don't accidentally use the  
wrong configuration in user- or client-facing environments.


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Live Class Reloading

2015-03-19 Thread Adam X
I get that. My point is that setting up execution mode for development
renders contribution for PRODUCTION_MODE useless.

On Thu, Mar 19, 2015 at 3:39 PM, Thiago H de Paula Figueiredo 
thiag...@gmail.com wrote:

 On Thu, 19 Mar 2015 09:46:25 -0300, Adam X vbgnm3c...@gmail.com wrote:

  So the confusing part is that in order for Tapestry to use the
 DevelopmentModule which has the necessary configuration it is required to
 pass a JVM parameter in the first place, which in turn yields the point
 about adding:

 configuration.add(SymbolConstants.PRODUCTION_MODE, false);

 kind of pointless. So my question is, what is the point of the above, if
 in order to force the development module it is necessary to pass a JVM param
 in the first place?


 I don't think you got why execution modes exists. It's for having
 different configurations for different environments (development, QA,
 staging, production, etc) which you can select by JVM argument. It defaults
 to the production environment, so you don't accidentally use the wrong
 configuration in user- or client-facing environments.


 --
 Thiago H. de Paula Figueiredo
 Tapestry, Java and Hibernate consultant and developer
 http://machina.com.br

 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org




how to escape {{ symbols?

2015-03-19 Thread Тимур Бухараев
I use AngularJS and Tapestry 5.3 in my web project.

The problem is next:
1. User inputs some data in text field, for example his profile
description, and post it to server.
2. Profile description renders with tapestry variable:
div$descriptiondiv
3. if $description contains some text like this {{
scriptalert(Hehe!);/script }}, AngularJS starts interpret this, and
it is a big security problem.

Tapestry escapes standard html symbols:  replaces with lt and so on. So
if user inputs some html tags, tapestry decorates it and it is great. I
want replace '{' symbol with #123;

I found class AbstractMarkupModel in source, which doing this decorating
work.

The question is: how replace behavior of AbstractMarkupMode.encode to
support decoration of {{ symbol?


HTTP/S Session Cookie

2015-03-19 Thread Martin Polívka
Hi, I am quite new to Tapestry, but last month I am upgrading our app from
Tapestry 5.0.14 to 5.3.8. It's working now with one problem.
We use Tomcat 7, servlet 3.0 (in the future Tomcat 8 and servlet 3.1) and
Java 7. Tomcat listens on http (8080) and https(8443). If I use https,
everything is OK.
If I use http, I enter login page off app and SessionState object is
created. I can see Session ID (equals X). It's done
by contributeApplicationStateManager function in Module. Another contribute
is for URL (contributeServiceOverride) where we use only https connection.
That's because we want all ajax requests to go over https even if user is
on http.
So if user log in, session and cookie is created with atribute httpOnly and
if I send ajax request to https, another session is created by Tapestry.
Is it possible to access the http session in https request?

I can provide sample codes.
Thanks for your help!