You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Bill Boland <bo...@comcast.net> on 2003/08/11 16:40:17 UTC

Autoreload and WebappLoader

I was migrating a web application to Velocity 1.3.1 and Velocity Tools 1.0
this weekend and was unable to get the autoreload of libraries to work. I
looked into the source and it seems to always return zero for the
modification time for the WebappLoader which is used by default from the
VelocityViewServlet. I didn't see a bug report on this...so it could just be
me or something stupid I've done. I'm not using a war file. This does not
seem to be a problem with templates that are not libraries so I'm not sure
if the modification time is a problem or there is something else going on.

Could someone verify that this does or doesn't work? Thanks.

bill boland




RE: Autoreload Global Macros?

Posted by Tim Colson <tc...@cisco.com>.
> Cut?  It wasn't removed.  We just have long timescales.  
> <sheepish grin>
> Have you tried it from CVS head?
Sorry, I meant that the autoreload global macros apparently does not to
me at least appear in the 1.3.1 release (hence, "it didn't make the
cut", think "it didn't make the team").

I haven't tried CVS head. I assumed it's in there, but was wondering if
this is planned/tested for the upcoming 1.4.x release. I'll pull CVS
head down, build and give it a run. :-)

Thanks,
Timo


Re: Autoreload Global Macros?

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On Tuesday, August 19, 2003, at 04:47 PM, Tim Colson wrote:

> Geir wrote back on Nov 04, 2002:
>> 2) reloading templates/macros - Velocity can reload both templates
>> and macros while developing.
>> You can even reload the global macro library, but
>> that's probably in the latest dev tree, 1.4.
>
> And even found the earlier Aug 2001 thread were
> velocimacro.library.autoreload was born:
> http://www.mail-archive.com/velocity-user@jakarta.apache.org/ 
> msg02882.ht
> ml
>
>
> I just tried with Velocity 1.3.1 and it seems to that it didn't make  
> the
> cut, so just wondering if it does exist for sure in the 1.4 dev? (I  
> hope
> it makes it into the 1.4 production release! ;-)

Cut?  It wasn't removed.  We just have long timescales.  <sheepish grin>

Have you tried it from CVS head?


-- 
Geir Magnusson Jr                                   203-956-2604(w)
Adeptra, Inc.                                       203-434-2093(m)
geirm@adeptra.com                                   203-247-1713(m)


Autoreload Global Macros?

Posted by Tim Colson <tc...@cisco.com>.
Geir wrote back on Nov 04, 2002:
> 2) reloading templates/macros - Velocity can reload both templates 
> and macros while developing.  
> You can even reload the global macro library, but
> that's probably in the latest dev tree, 1.4.  

And even found the earlier Aug 2001 thread were
velocimacro.library.autoreload was born:
http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg02882.ht
ml


I just tried with Velocity 1.3.1 and it seems to that it didn't make the
cut, so just wondering if it does exist for sure in the 1.4 dev? (I hope
it makes it into the 1.4 production release! ;-)

Timo	



Re: ANNOUNCE: New product using Velocity - Cotsec

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On Monday, August 18, 2003, at 10:50 AM, David Ford wrote:

> Cotsec (http://www.cotsec.com) uses Velocity as it's underlying 
> template
> engine - we'd really appreciate it if you could add our product to the 
> list
> of those using Velocity on the main Velocity page.

Done.  This will reach the list before I commit.  When it gets public, 
check and suggest better wording if you wish.

-- 
Geir Magnusson Jr                                   203-956-2604(w)
Adeptra, Inc.                                       203-434-2093(m)
geirm@adeptra.com                                   203-247-1713(m)


ANNOUNCE: New product using Velocity - Cotsec

Posted by David Ford <da...@cotsec.com>.
Cotsec (http://www.cotsec.com) uses Velocity as it's underlying template
engine - we'd really appreciate it if you could add our product to the list
of those using Velocity on the main Velocity page.

http://jakarta.apache.org/velocity/

Thanks!

-------------------------------
We'd like to announce the general availability of our product "Cotsec".
It's kind of commercial and kind of not - something like a cross between the
two, in that anyone can enhance the product - but be paid with a profit
percentage when the product is sold.

Here's a brief outline:
==================================================
Cotsec has released Cotsec Forms - a framework for generating Forms based
applications in:
  - Swing
  - Struts
    [via CMP 2.0 EJB's, or a
     user-defined persistence framework such
     as Hibernate]
  - Eclipse SWT
  - .NET Windows Forms
  - .NET ASPx code
    [bound to automatically generated .NET web
     services in .NET standard fashion]

==================================================


Here's a (much) longer version.

Cotsec has released a cross-language/cross-platform rapid development
environment that significantly cuts down general development costs for
desktop,web-based and mobile applications.

Cotsec generates Java applications using a Requirements Driven
Development (RDD) approach in which Business Analysts (BA's)
createrequirements of the application to be created, and then use an
application generator (such as Cotsec) to generate and maintain large
portions of the target application.  This is in line with Cotsec's
philosophy that developers shouldn't write applications - they should
primarily create architectures, frameworks and code generators - and
share these in a community of similar developers.

Cotsec has released Cotsec Forms - a framework for generating Forms
based applications in:
  - Swing
  - Struts
    [via CMP 2.0 EJB's, or a
     user-defined persistence framework such
     as Hibernate]
  - Eclipse SWT
  - .NET Windows Forms
  - .NET ASPx code
    [bound to automatically generated .NET web
     services in .NET standard fashion]

Cotsec is seeking interest from both potential clients (end users or
developers interested in utilising the framework in their environment)
and developers interested in extending the Cotsec framework in an
"Open Source" fashion.  Please email mailto:developer@cotsec.com
(developer@cotsec.com) for further information.


Screenshots -- http://www.cotsec.com/screenshots/index.html
Products    -- http://www.cotsec.com/product/index.html

    ==== Development Philosophy ====

Cotsec aims to share code, processes and expertise across it's
widening base of developers - effectively creating a cross between a
large multinational consulting agency and a large multinational open
source project.  It's envisaged that much of the work that would be
completed at customer sites would enhance the code generation
framework (the model compiler), and that extensions to the model
compiler would be shared amongst participating Cotsec developers and
companies - making it easier for them to either perform their in-house
development tasks or to win new customers.

=========  Developers don't build applications  =============


1. Developers build model compilers instead.  BA's build applications.


 Business analyst
      |
      |
      V
  +-------+                             +-------------+
  | model |  -->( Model compiler ) -->  | application |
  +-------+                             +-------------+


Business analysts create a model of the application:
  * Input forms
  * Validation rules
  * Business logic/calculators
  * Reports
  * Menu structures
  * Security/permissions information

This model is then compiled into an actual application.  At the moment
application generators exist for:

  * J2EE desktop (Swing) applications (bound to Enterprise Javabeans
       to a DB)
  * J2EE JSP pages (Struts)
  * .NET Windows Forms applications via Web services to a database
  * .NET ASPX C# web applications via Web services to a database

More are coming.  Cotsec is currently on:
  * Delphi
  * VB
  * Perl (available with two weeks)

mailto:developer@cotsec.com

Best regards

David

Cotsec: [Share Everything]


ANNOUNCE: New product using Velocity - Cotsec

Posted by David Ford <da...@cotsec.com>.
Cotsec (http://www.cotsec.com) uses Velocity as it's underlying template
engine - we'd really appreciate it if you could add our product to the list
of those using Velocity on the main Velocity page.

http://jakarta.apache.org/velocity/

Thanks!

-------------------------------
We'd like to announce the general availability of our product "Cotsec".
It's kind of commercial and kind of not - something like a cross between the
two, in that anyone can enhance the product - but be paid with a profit
percentage when the product is sold.

Here's a brief outline:
==================================================
Cotsec has released Cotsec Forms - a framework for generating Forms based
applications in:
  - Swing
  - Struts
    [via CMP 2.0 EJB's, or a
     user-defined persistence framework such
     as Hibernate]
  - Eclipse SWT
  - .NET Windows Forms
  - .NET ASPx code
    [bound to automatically generated .NET web
     services in .NET standard fashion]

==================================================


Here's a (much) longer version.

Cotsec has released a cross-language/cross-platform rapid development
environment that significantly cuts down general development costs for
desktop,web-based and mobile applications.

Cotsec generates Java applications using a Requirements Driven
Development (RDD) approach in which Business Analysts (BA's)
createrequirements of the application to be created, and then use an
application generator (such as Cotsec) to generate and maintain large
portions of the target application.  This is in line with Cotsec's
philosophy that developers shouldn't write applications - they should
primarily create architectures, frameworks and code generators - and
share these in a community of similar developers.

Cotsec has released Cotsec Forms - a framework for generating Forms
based applications in:
  - Swing
  - Struts
    [via CMP 2.0 EJB's, or a
     user-defined persistence framework such
     as Hibernate]
  - Eclipse SWT
  - .NET Windows Forms
  - .NET ASPx code
    [bound to automatically generated .NET web
     services in .NET standard fashion]

Cotsec is seeking interest from both potential clients (end users or
developers interested in utilising the framework in their environment)
and developers interested in extending the Cotsec framework in an
"Open Source" fashion.  Please email mailto:developer@cotsec.com
(developer@cotsec.com) for further information.


Screenshots -- http://www.cotsec.com/screenshots/index.html
Products    -- http://www.cotsec.com/product/index.html

    ==== Development Philosophy ====

Cotsec aims to share code, processes and expertise across it's
widening base of developers - effectively creating a cross between a
large multinational consulting agency and a large multinational open
source project.  It's envisaged that much of the work that would be
completed at customer sites would enhance the code generation
framework (the model compiler), and that extensions to the model
compiler would be shared amongst participating Cotsec developers and
companies - making it easier for them to either perform their in-house
development tasks or to win new customers.

=========  Developers don't build applications  =============


1. Developers build model compilers instead.  BA's build applications.


 Business analyst
      |
      |
      V
  +-------+                             +-------------+
  | model |  -->( Model compiler ) -->  | application |
  +-------+                             +-------------+


Business analysts create a model of the application:
  * Input forms
  * Validation rules
  * Business logic/calculators
  * Reports
  * Menu structures
  * Security/permissions information

This model is then compiled into an actual application.  At the moment
application generators exist for:

  * J2EE desktop (Swing) applications (bound to Enterprise Javabeans
       to a DB)
  * J2EE JSP pages (Struts)
  * .NET Windows Forms applications via Web services to a database
  * .NET ASPX C# web applications via Web services to a database

More are coming.  Cotsec is currently on:
  * Delphi
  * VB
  * Perl (available with two weeks)

mailto:developer@cotsec.com

Best regards

David

Cotsec: [Share Everything]


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Autoreload Global Macros?

Posted by Tim Colson <tc...@cisco.com>.
Geir wrote back on Nov 04, 2002:
> 2) reloading templates/macros - Velocity can reload both templates 
> and macros while developing.  
> You can even reload the global macro library, but
> that's probably in the latest dev tree, 1.4.  

And even found the earlier Aug 2001 thread were
velocimacro.library.autoreload was born:
http://www.mail-archive.com/velocity-user@jakarta.apache.org/msg02882.ht
ml


I just tried with Velocity 1.3.1 and it seems to that it didn't make the
cut, so just wondering if it does exist for sure in the 1.4 dev? (I hope
it makes it into the 1.4 production release! ;-)

Timo	



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Autoreload and WebappLoader

Posted by Daniel Dekany <dd...@freemail.hu>.
Sunday, August 17, 2003, 10:29:57 AM, Claude Brisson wrote:

>> isSourceModified and getLastModified are basically no-ops for the WebappLoader
>
> the main problem here is that the WebappLoader accesses resources via
> the servlet api (to work as well with exploded resources as with war
> files), and that the actual servlet api doesn't give us any date/time
> information on files. Maybe that would be the kind of feedack to give
> to w3c folks.

It's possible to get the last modification time of servlet resources:
You can get an java.net.URL with ServletContext.getResource(path). Then,
you can create an java.net.URLConnection with URL.openConnection(), and
URLConnection has a getLastModified() method.

> A potential workaround would be to reload all resources in dev mode, and not to reload any one in production mode (except on some
> 'reload' signal manually generated, to avoid restarting ?)

BTW, this reminds me of a practical issue with the method I said above.
At least Tomcat 4.1 is lazy about monitoring the changes of the
resources. That is, you change the file, but then if you access it
through the servlet resource API, it will sometimes pretend *forever*
that the file was not changed... quite annoying. The workaround I did
for this is that I try to access the resource as File: Use
ServletContext.getRealPath(path), and if it is successful, then use the
File directly, rather than the servlet resource API.

-- 
Best regards,
 Daniel Dekany



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Autoreload and WebappLoader

Posted by Daniel Dekany <dd...@freemail.hu>.
Sunday, August 17, 2003, 10:29:57 AM, Claude Brisson wrote:

>> isSourceModified and getLastModified are basically no-ops for the WebappLoader
>
> the main problem here is that the WebappLoader accesses resources via
> the servlet api (to work as well with exploded resources as with war
> files), and that the actual servlet api doesn't give us any date/time
> information on files. Maybe that would be the kind of feedack to give
> to w3c folks.

It's possible to get the last modification time of servlet resources:
You can get an java.net.URL with ServletContext.getResource(path). Then,
you can create an java.net.URLConnection with URL.openConnection(), and
URLConnection has a getLastModified() method.

> A potential workaround would be to reload all resources in dev mode, and not to reload any one in production mode (except on some
> 'reload' signal manually generated, to avoid restarting ?)

BTW, this reminds me of a practical issue with the method I said above.
At least Tomcat 4.1 is lazy about monitoring the changes of the
resources. That is, you change the file, but then if you access it
through the servlet resource API, it will sometimes pretend *forever*
that the file was not changed... quite annoying. The workaround I did
for this is that I try to access the resource as File: Use
ServletContext.getRealPath(path), and if it is successful, then use the
File directly, rather than the servlet resource API.

-- 
Best regards,
 Daniel Dekany



Re: Autoreload and WebappLoader

Posted by Claude Brisson <cl...@savoirweb.com>.
> isSourceModified and getLastModified are basically no-ops for the WebappLoader

the main problem here is that the WebappLoader accesses resources via the servlet api (to work as well with exploded resources as
with war files), and that the actual servlet api doesn't give us any date/time information on files. Maybe that would be the kind of
feedack to give to w3c folks.

A potential workaround would be to reload all resources in dev mode, and not to reload any one in production mode (except on some
'reload' signal manually generated, to avoid restarting ?)

CloD




Re: Autoreload and WebappLoader

Posted by Claude Brisson <cl...@savoirweb.com>.
> isSourceModified and getLastModified are basically no-ops for the WebappLoader

the main problem here is that the WebappLoader accesses resources via the servlet api (to work as well with exploded resources as
with war files), and that the actual servlet api doesn't give us any date/time information on files. Maybe that would be the kind of
feedack to give to w3c folks.

A potential workaround would be to reload all resources in dev mode, and not to reload any one in production mode (except on some
'reload' signal manually generated, to avoid restarting ?)

CloD




---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Autoreload and WebappLoader

Posted by Nathan Bubna <na...@esha.com>.
Bill Boland said:
> I was migrating a web application to Velocity 1.3.1 and Velocity Tools 1.0
> this weekend and was unable to get the autoreload of libraries to work. I
> looked into the source and it seems to always return zero for the
> modification time for the WebappLoader which is used by default from the
> VelocityViewServlet. I didn't see a bug report on this...so it could just be
> me or something stupid I've done. I'm not using a war file. This does not
> seem to be a problem with templates that are not libraries so I'm not sure
> if the modification time is a problem or there is something else going on.
>
> Could someone verify that this does or doesn't work? Thanks.

hmm.  i haven't got the time to test this out or develop a fix at the moment.
too much else on my plate.  i haven't used the autoreloading of libraries
much, but i suspect that if it really doesn't work, then the problem is
related to the fact that isSourceModified and getLastModified are basically
no-ops for the WebappLoader.  in fact, i think the FileResourceLoader is the
only standard velocity resource loader that these methods are relevant for
(someone correct me if i'm wrong).

so, here's my suggestion once you've followed the docs on the relevant
velocity.properties keys and values and tested it all out and the reloading
still doesn't work:

1.  enter a bug report.  explain what you're trying to do, what resource
loaders and velocity.properties you've tried and what, if anything, happened
for them.

2. try and fix it yourself.  if it turns out that you need to have real,
working isSourceModified() and getLastModified() methods for the WebappLoader,
then you will probably want to look into the ServletContext.getResource()
method (returns a java.net.URL), and the URL.openConnection() method.  once
you have the URLConnection object, you can ask it for the file modification
info.  i don't know if there's any guarantee that those methods will return
it, but it's your best bet.  use the isSourceModified() and getLastModified()
methods in FileResourceLoader as models of how to use the info you get from
the URLConnection.

3. if you succeed in fixing it, attach a patch for the WebappLoader to the bug
report and add the "PatchAvailable" keyword to the report.

Nathan Bubna
nathan@esha.com


Re: Autoreload and WebappLoader

Posted by Nathan Bubna <na...@esha.com>.
Bill Boland said:
> I was migrating a web application to Velocity 1.3.1 and Velocity Tools 1.0
> this weekend and was unable to get the autoreload of libraries to work. I
> looked into the source and it seems to always return zero for the
> modification time for the WebappLoader which is used by default from the
> VelocityViewServlet. I didn't see a bug report on this...so it could just be
> me or something stupid I've done. I'm not using a war file. This does not
> seem to be a problem with templates that are not libraries so I'm not sure
> if the modification time is a problem or there is something else going on.
>
> Could someone verify that this does or doesn't work? Thanks.

hmm.  i haven't got the time to test this out or develop a fix at the moment.
too much else on my plate.  i haven't used the autoreloading of libraries
much, but i suspect that if it really doesn't work, then the problem is
related to the fact that isSourceModified and getLastModified are basically
no-ops for the WebappLoader.  in fact, i think the FileResourceLoader is the
only standard velocity resource loader that these methods are relevant for
(someone correct me if i'm wrong).

so, here's my suggestion once you've followed the docs on the relevant
velocity.properties keys and values and tested it all out and the reloading
still doesn't work:

1.  enter a bug report.  explain what you're trying to do, what resource
loaders and velocity.properties you've tried and what, if anything, happened
for them.

2. try and fix it yourself.  if it turns out that you need to have real,
working isSourceModified() and getLastModified() methods for the WebappLoader,
then you will probably want to look into the ServletContext.getResource()
method (returns a java.net.URL), and the URL.openConnection() method.  once
you have the URLConnection object, you can ask it for the file modification
info.  i don't know if there's any guarantee that those methods will return
it, but it's your best bet.  use the isSourceModified() and getLastModified()
methods in FileResourceLoader as models of how to use the info you get from
the URLConnection.

3. if you succeed in fixing it, attach a patch for the WebappLoader to the bug
report and add the "PatchAvailable" keyword to the report.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org