You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeromy Evans <je...@blueskyminds.com.au> on 2007/10/06 14:21:28 UTC

How to improve dojo performance in Struts 2.0.9

I thought I'd share the instructions I prepared for creating a dojo 
0.4.2 custom profile for Struts 2.0.9.  The objective is to bundle all 
the required dojo resources into dojo.js to avoid the numerous slow 
sequential requests for resources. This makes a massive performance 
improvement to the default ajax theme.

Instructions for improving the performance of dojo 0.4.2 in Struts 2.0.9:

$resources$ is assumed to be your web resources directory

1. First, configure struts to serve the static files directly from 
$resources$/struts instead of from within struts-core-2.0.9.jar:
   
    a. extract struts2-core-2.0.9.jar/org/apache/struts2/static/* to 
$resources$/struts/
    b. edit struts.properties and set struts.serve.static=false
    c. also extract the javascript and css files from 
struts2-core-2.0.9.jar/templates/* to $resources$/struts/ as this will 
be helpful later
          eg. $resources$/struts/ajax/dojoRequire.js

Confirm that your application still works before proceeding. It's 
essential that resources are loaded from the directory rather than the jar.

2. Download the source of dojo 0.4.2.  You won't need to modify it.  The 
download location doesn't matter.  We assume it's in release-0.4.2/

   > svn export http://svn.dojotoolkit.org/dojo/tags/release-0.4.2

This is almost identical to the version bundled with struts2.0.9.

3. Use an editor to create a dojo custom profile as the file 
release-0.4.2/buildscripts/profiles/struts2.profile.js.  This file 
defines which dojo resources you use directly.  Essentially it specifies 
which code will be included in dojo.js.  An example that includes almost 
everything is provided at the end of this email.

4. Copy the struts widgets into the dojo directory so they can be 
included within dojo.js.  That is, copy $resources$/struts/dojo/struts/* 
to release-0.4.2/struts.
This is the directory that contains the widget and widgets 
subdirectories, css and some images.

5. Build dojo using ant.  This will create a new dojo.js file:

 > cd release-0.4.2/buildscripts
 > ant -Dprofile=struts2 -Dstrip_and_compress=true clean release 
intern-strings strip-resource-comments

(You may be asked to run it twice).

Pay some attention to the build process.  In particular, note whether it 
finds the struts widgets and 'internalises' the related resources. If 
not, see Step 4.  You'll probably notice a lot of things are included 
that you don't need.  That will be helpful later for optimizations.  
Some errors will occur while stripping the comments but these are ok.

6. When the build process completes the release directory will contain 
all the files you need.  The content of the release directory can be 
copied over the top of $resources$/struts/dojo.  You'll notice it's 
almost exactly the same as the original, although dojo.js is probably 
larger.

It's okay to delete the demo, test and release subfolders before copying 
to your application.  The src subfolder must be distributed with your 
application as it contains images used by dojo.

7. Clear your browser cache and test your application again.  You should 
note the larger dojo.js file being loaded and significantly fewer 
requests for resources by dojo   Hopefully it's also a lot faster.

That's it.  Now you can go back and optimize the profile by removing 
resources you don't need.  There's examples in the profiles directory.  
Repeat the build/test process to find the right balance.
I also recommend editing $resources$/struts/ajax/dojoRequire.js to 
remove the reference to the Editor2 if you don't use this as it's a 
very,very heavy-weight resource.

Hope that helps someone else.  Improvements & comments welcome.  See 
reference [3] below for detailed instructions and rationale.

regards,
 Jeromy Evans

Resources
[1] http://struts.apache.org/2.x/docs/performance-tuning.html
[2] 
http://www.nabble.com/-s2--Struts-head-tag-KILLS-%28%3E-10s%29-page-load-time-tf4490390.html#a13047981
[3] 
http://www.dojotoolkit.org/book/dojo-book-0-4/part-6-customizing-dojo-builds-better-performance

The following profile includes almost everything in dojo.js.  It assumes 
the struts widgets have been copied into the directory as mentioned at 
step 4.
struts2.profile.js:

var dependencies = [
   "dojo.lang.*",
    "dojo.html.*",
   "dojo.debug",
    "dojo.html.display",
    "dojo.html.layout",
    "dojo.html.util",
    "dojo.lfx.*",
    "dojo.event.*",
    "dojo.logging.*",
    "dojo.io.*",
    "dojo.io.IframeIO",
    "dojo.date",
    "dojo.string.*",
    "dojo.regex",
    "dojo.rpc.*",
    "dojo.xml.*",
    // "dojo.flash.*",
    // "dojo.storage.*",
    "dojo.undo.*",
    "dojo.crypto.*",
    //"dojo.collections.*",
    "dojo.collections.ArrayList",
    "dojo.collections.Collections",
    "dojo.collections.Queue",
    "dojo.collections.Stack",
    "dojo.dnd.*",
    "dojo.widget.*",
   "dojo.widget.TabContainer",
   "dojo.widget.PageContainer",
   "dojo.widget.LinkPane",
   //"dojo.widget.Editor2",
   //"dojo.widget.RichText",
   //"dojo.widget.Editor2Toolbar",
   //"dojo.widget.ColorPalette",
    "dojo.math.*",
    //"dojo.reflect.*",
    "dojo.uri.*",      
   "struts.widget.Bind",
   "struts.widget.Bind",
   "struts.widget.BindDiv",
   "struts.widget.BindAnchor",
   "struts.widget.ComboBox",
   "struts.widget.StrutsTimePicker",
   "struts.widget.StrutsTimePicker"
];

dependencies.prefixes = [
   ["struts", "struts"]
];

load("getDependencyList.js");



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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Manos Batsis <ma...@geekologue.com>.
Quoting Roberto Nunnari <ro...@supsi.ch>:
> Yes.. I believe that's right, but wouldn't it be great if we were
> able to tell tomcat/struts to keep some static web resources from jar
> files in cache (already decompressed and ready to be sent to
> clients)?

That is exactly the approach we have applied  for our internal JS
libraries. They are packaged as Maven artifacts (see our
maven-jstools-plugin howto at [1]), then those artifacts are used as
dependencies in our web projects. At runtime, the scripts are provided
to the browser and optionally cached and/or gzipped by our
JavascriptDependencyFilter [2], which is available in the webapp by
adding the JSTools plugin as a dependency for it. If you want to
centralize caching in httpd or something, you can also use
JavascriptDependencyFilter for dependency resolution only. Not sure if
struts2 is build with Maven, or whether dojo artifacts are available,
but in any case all this is apache 2 licensed so you can do whatever
with it.

[1] http://dev.abiss.gr/mvn-jstools/js-packaging.html
[2]
http://dev.abiss.gr/mvn-jstools/apidocs/gr/abiss/mvn/plugins/jstools/web/JavascriptDependencyFilter.html

Cheers,

Manos



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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Roberto Nunnari <ro...@supsi.ch>.
Hi Jeromy.

Thank you for your reply! My comments below:


jeromy.evans@blueskyminds.com.au wrote:
> Roberto Nunnari wrote:
>> Hi Jeromy and list.
>>
>> I'm trying a self built struts-2.1.1-snapshot with the dojo plugin
>> and I'm seeing very slow dojo performance.. I thought that the dojo
>> performance problem whould be solved in 2.1.1 using the plugin, but
>> it doesn't seam so now to me..
>>
> Hi Roberto,
> 
> Before anything else, try to isolate the problem a little as there's many
> of possible causes of a performance problem.
> I'd first install the FireBug plugin into Firefox to check if there's any
> javascript errors, 404's or if there really are too many requests.
> If there's lots of requests it'll be a slow experience for the user and
> that's that's when creating a custom dojo profile will help.

yes.. there were many requests, but I can't quantify as I discovered
the dojo tree widget and as it works great for what I need I moved
to that!


> 
>> So.. I have two questions:
>> 1) do the information you posted (see below) about improving 2.0.9 dojo
> performance apply to version 2.1.1-snapshot as well?
> 
> Yes, this applies to Struts2.1 as well, however a customised dojo profile
> is already distributed with the dojo plugin.  It can still be optimized,
> but it should be pretty good already.
> 
> Some people have commented that the single biggest performance improvement
> is to move dojo's static content out of the struts2 jars and serve it
> directly (preferably from apache rather than tomcat).  This is described
> on the wiki.

Yes.. I believe that's right, but wouldn't it be great if we were
able to tell tomcat/struts to keep some static web resources from jar
files in cache (already decompressed and ready to be sent to clients)?


> 
>> 2) would it be easier to use raw dojo instead? I just have to update
>> a div and at the same time notifyTopics using a <sx:a> tag.. or maybe
> the yui plugin? what would you suggest?
> 
> There's no reason why you should experience significant performance
> problems if that's all you need.

actually in my page there were about 10 <sx:a> tags.. that's maybe
an important factor to why it was so slow..


> The dojo plugin is the least effort approach for what you're doing.  I'd
> definitely devote some time to isolating why its slow.

If I get round to, I'll certantly try to find the bottleneck


> 
> Writing direct dojo code will mean you can control which resources are
> specifically loaded and you will get better performance, but it's still
> essential to build a customised dojo profile.

yes.. I guess so..


> 
> The YUI plugin itself doesn't have what you've described, although a patch
> is sitting in the issues register to add yui:div, yui:a and yui:submit.  I
> use these myself.  If you use YUI, you'd still need to write a custom
> listener to do the equivalent of notifyTopics, so it's a little more
> effort.
> 
> A significant performance issue that's often overlooked is that javascript
> is single threaded while <script> blocks are executed rendering in the
> brower is blocked.  You can improve the RENDERING of a page significantly
> simply by placing the scripts/script includes at the bottom of the body.
> My bet is that this is what causes most of the problems as dojo does a lot
> of page parsing, but only hand-crafted javascript will allow you to
> correct this.

This is a very important note.. I'll that out ASAP!

Merry Christmas and Happy New Year!

Best regards.

--
Robi


> 
> Hope that helps,
> Jeromy Evans
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


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


Re: How to improve dojo performance in Struts 2.0.9

Posted by je...@blueskyminds.com.au.
Roberto Nunnari wrote:
> Hi Jeromy and list.
>
> I'm trying a self built struts-2.1.1-snapshot with the dojo plugin
> and I'm seeing very slow dojo performance.. I thought that the dojo
> performance problem whould be solved in 2.1.1 using the plugin, but
> it doesn't seam so now to me..
>
Hi Roberto,

Before anything else, try to isolate the problem a little as there's many
of possible causes of a performance problem.
I'd first install the FireBug plugin into Firefox to check if there's any
javascript errors, 404's or if there really are too many requests.
If there's lots of requests it'll be a slow experience for the user and
that's that's when creating a custom dojo profile will help.

> So.. I have two questions:
> 1) do the information you posted (see below) about improving 2.0.9 dojo
performance apply to version 2.1.1-snapshot as well?
>

Yes, this applies to Struts2.1 as well, however a customised dojo profile
is already distributed with the dojo plugin.  It can still be optimized,
but it should be pretty good already.

Some people have commented that the single biggest performance improvement
is to move dojo's static content out of the struts2 jars and serve it
directly (preferably from apache rather than tomcat).  This is described
on the wiki.

> 2) would it be easier to use raw dojo instead? I just have to update
> a div and at the same time notifyTopics using a <sx:a> tag.. or maybe
the yui plugin? what would you suggest?
>

There's no reason why you should experience significant performance
problems if that's all you need.
The dojo plugin is the least effort approach for what you're doing.  I'd
definitely devote some time to isolating why its slow.

Writing direct dojo code will mean you can control which resources are
specifically loaded and you will get better performance, but it's still
essential to build a customised dojo profile.

The YUI plugin itself doesn't have what you've described, although a patch
is sitting in the issues register to add yui:div, yui:a and yui:submit.  I
use these myself.  If you use YUI, you'd still need to write a custom
listener to do the equivalent of notifyTopics, so it's a little more
effort.

A significant performance issue that's often overlooked is that javascript
is single threaded while <script> blocks are executed rendering in the
brower is blocked.  You can improve the RENDERING of a page significantly
simply by placing the scripts/script includes at the bottom of the body.
My bet is that this is what causes most of the problems as dojo does a lot
of page parsing, but only hand-crafted javascript will allow you to
correct this.

Hope that helps,
Jeromy Evans




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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Roberto Nunnari <ro...@supsi.ch>.
Hi Jeromy and list.

I'm trying a self built struts-2.1.1-snapshot with the dojo plugin
and I'm seeing very slow dojo performance.. I thought that the dojo
performance problem whould be solved in 2.1.1 using the plugin, but
it doesn't seam so now to me..

So.. I have two questions:
1) do the information you posted (see below) about improving 2.0.9 dojo 
performance apply to version 2.1.1-snapshot as well?

2) would it be easier to use raw dojo instead? I just have to update
a div and at the same time notifyTopics using a <sx:a> tag.. or maybe 
the yui plugin? what would you suggest?

Please excuse me if these are dumb questions..

Thank you very much!

--
Robi



Jeromy Evans wrote:
> I thought I'd share the instructions I prepared for creating a dojo 
> 0.4.2 custom profile for Struts 2.0.9.  The objective is to bundle all 
> the required dojo resources into dojo.js to avoid the numerous slow 
> sequential requests for resources. This makes a massive performance 
> improvement to the default ajax theme.
> 
> Instructions for improving the performance of dojo 0.4.2 in Struts 2.0.9:
> 
> $resources$ is assumed to be your web resources directory
> 
> 1. First, configure struts to serve the static files directly from 
> $resources$/struts instead of from within struts-core-2.0.9.jar:
>      a. extract struts2-core-2.0.9.jar/org/apache/struts2/static/* to 
> $resources$/struts/
>    b. edit struts.properties and set struts.serve.static=false
>    c. also extract the javascript and css files from 
> struts2-core-2.0.9.jar/templates/* to $resources$/struts/ as this will 
> be helpful later
>          eg. $resources$/struts/ajax/dojoRequire.js
> 
> Confirm that your application still works before proceeding. It's 
> essential that resources are loaded from the directory rather than the jar.
> 
> 2. Download the source of dojo 0.4.2.  You won't need to modify it.  The 
> download location doesn't matter.  We assume it's in release-0.4.2/
> 
>   > svn export http://svn.dojotoolkit.org/dojo/tags/release-0.4.2
> 
> This is almost identical to the version bundled with struts2.0.9.
> 
> 3. Use an editor to create a dojo custom profile as the file 
> release-0.4.2/buildscripts/profiles/struts2.profile.js.  This file 
> defines which dojo resources you use directly.  Essentially it specifies 
> which code will be included in dojo.js.  An example that includes almost 
> everything is provided at the end of this email.
> 
> 4. Copy the struts widgets into the dojo directory so they can be 
> included within dojo.js.  That is, copy $resources$/struts/dojo/struts/* 
> to release-0.4.2/struts.
> This is the directory that contains the widget and widgets 
> subdirectories, css and some images.
> 
> 5. Build dojo using ant.  This will create a new dojo.js file:
> 
>  > cd release-0.4.2/buildscripts
>  > ant -Dprofile=struts2 -Dstrip_and_compress=true clean release 
> intern-strings strip-resource-comments
> 
> (You may be asked to run it twice).
> 
> Pay some attention to the build process.  In particular, note whether it 
> finds the struts widgets and 'internalises' the related resources. If 
> not, see Step 4.  You'll probably notice a lot of things are included 
> that you don't need.  That will be helpful later for optimizations.  
> Some errors will occur while stripping the comments but these are ok.
> 
> 6. When the build process completes the release directory will contain 
> all the files you need.  The content of the release directory can be 
> copied over the top of $resources$/struts/dojo.  You'll notice it's 
> almost exactly the same as the original, although dojo.js is probably 
> larger.
> 
> It's okay to delete the demo, test and release subfolders before copying 
> to your application.  The src subfolder must be distributed with your 
> application as it contains images used by dojo.
> 
> 7. Clear your browser cache and test your application again.  You should 
> note the larger dojo.js file being loaded and significantly fewer 
> requests for resources by dojo   Hopefully it's also a lot faster.
> 
> That's it.  Now you can go back and optimize the profile by removing 
> resources you don't need.  There's examples in the profiles directory.  
> Repeat the build/test process to find the right balance.
> I also recommend editing $resources$/struts/ajax/dojoRequire.js to 
> remove the reference to the Editor2 if you don't use this as it's a 
> very,very heavy-weight resource.
> 
> Hope that helps someone else.  Improvements & comments welcome.  See 
> reference [3] below for detailed instructions and rationale.
> 
> regards,
> Jeromy Evans
> 
> Resources
> [1] http://struts.apache.org/2.x/docs/performance-tuning.html
> [2] 
> http://www.nabble.com/-s2--Struts-head-tag-KILLS-%28%3E-10s%29-page-load-time-tf4490390.html#a13047981 
> 
> [3] 
> http://www.dojotoolkit.org/book/dojo-book-0-4/part-6-customizing-dojo-builds-better-performance 
> 
> 
> The following profile includes almost everything in dojo.js.  It assumes 
> the struts widgets have been copied into the directory as mentioned at 
> step 4.
> struts2.profile.js:
> 
> var dependencies = [
>   "dojo.lang.*",
>    "dojo.html.*",
>   "dojo.debug",
>    "dojo.html.display",
>    "dojo.html.layout",
>    "dojo.html.util",
>    "dojo.lfx.*",
>    "dojo.event.*",
>    "dojo.logging.*",
>    "dojo.io.*",
>    "dojo.io.IframeIO",
>    "dojo.date",
>    "dojo.string.*",
>    "dojo.regex",
>    "dojo.rpc.*",
>    "dojo.xml.*",
>    // "dojo.flash.*",
>    // "dojo.storage.*",
>    "dojo.undo.*",
>    "dojo.crypto.*",
>    //"dojo.collections.*",
>    "dojo.collections.ArrayList",
>    "dojo.collections.Collections",
>    "dojo.collections.Queue",
>    "dojo.collections.Stack",
>    "dojo.dnd.*",
>    "dojo.widget.*",
>   "dojo.widget.TabContainer",
>   "dojo.widget.PageContainer",
>   "dojo.widget.LinkPane",
>   //"dojo.widget.Editor2",
>   //"dojo.widget.RichText",
>   //"dojo.widget.Editor2Toolbar",
>   //"dojo.widget.ColorPalette",
>    "dojo.math.*",
>    //"dojo.reflect.*",
>    "dojo.uri.*",        "struts.widget.Bind",
>   "struts.widget.Bind",
>   "struts.widget.BindDiv",
>   "struts.widget.BindAnchor",
>   "struts.widget.ComboBox",
>   "struts.widget.StrutsTimePicker",
>   "struts.widget.StrutsTimePicker"
> ];
> 
> dependencies.prefixes = [
>   ["struts", "struts"]
> ];
> 
> load("getDependencyList.js");
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Richard Sayre wrote:
> Is the $resources$ directory WEB-INF?
>
> On Oct 6, 2007 8:51 AM, Jeromy Evans <je...@blueskyminds.com.au> wrote:
>   
$resources$ refers to the directory that contains your web files (eg. 
the directory that contains /index.jsp and the parent directory of WEB-INF)

Better description:
http://cwiki.apache.org/confluence/display/S2WIKI/Creating+a+custom+Dojo+profile+for+Struts+2.0.x

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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Richard Sayre <ri...@gmail.com>.
Is the $resources$ directory WEB-INF?

On Oct 6, 2007 8:51 AM, Jeromy Evans <je...@blueskyminds.com.au> wrote:
> I thought I'd share the instructions I prepared for creating a dojo
> 0.4.2 custom profile for Struts 2.0.9.  The objective is to bundle all
> the required dojo resources into dojo.js to avoid the numerous slow
> sequential requests for resources. This makes a massive performance
> improvement to the default ajax theme.
>
> Instructions for improving the performance of dojo 0.4.2 in Struts 2.0.9:
>
> $resources$ is assumed to be your web resources directory
>
> 1. First, configure struts to serve the static files directly from
> $resources$/struts instead of from within struts-core-2.0.9.jar:
>
>     a. extract struts2-core-2.0.9.jar/org/apache/struts2/static/* to
> $resources$/struts/
>     b. edit struts.properties and set struts.serve.static=false
>     c. also extract the javascript and css files from
> struts2-core-2.0.9.jar/templates/* to $resources$/struts/ as this will
> be helpful later
>           eg. $resources$/struts/ajax/dojoRequire.js
>
> Confirm that your application still works before proceeding. It's
> essential that resources are loaded from the directory rather than the jar.
>
> 2. Download the source of dojo 0.4.2.  You won't need to modify it.  The
> download location doesn't matter.  We assume it's in release-0.4.2/
>
>    > svn export http://svn.dojotoolkit.org/dojo/tags/release-0.4.2
>
> This is almost identical to the version bundled with struts2.0.9.
>
> 3. Use an editor to create a dojo custom profile as the file
> release-0.4.2/buildscripts/profiles/struts2.profile.js.  This file
> defines which dojo resources you use directly.  Essentially it specifies
> which code will be included in dojo.js.  An example that includes almost
> everything is provided at the end of this email.
>
> 4. Copy the struts widgets into the dojo directory so they can be
> included within dojo.js.  That is, copy $resources$/struts/dojo/struts/*
> to release-0.4.2/struts.
> This is the directory that contains the widget and widgets
> subdirectories, css and some images.
>
> 5. Build dojo using ant.  This will create a new dojo.js file:
>
>  > cd release-0.4.2/buildscripts
>  > ant -Dprofile=struts2 -Dstrip_and_compress=true clean release
> intern-strings strip-resource-comments
>
> (You may be asked to run it twice).
>
> Pay some attention to the build process.  In particular, note whether it
> finds the struts widgets and 'internalises' the related resources. If
> not, see Step 4.  You'll probably notice a lot of things are included
> that you don't need.  That will be helpful later for optimizations.
> Some errors will occur while stripping the comments but these are ok.
>
> 6. When the build process completes the release directory will contain
> all the files you need.  The content of the release directory can be
> copied over the top of $resources$/struts/dojo.  You'll notice it's
> almost exactly the same as the original, although dojo.js is probably
> larger.
>
> It's okay to delete the demo, test and release subfolders before copying
> to your application.  The src subfolder must be distributed with your
> application as it contains images used by dojo.
>
> 7. Clear your browser cache and test your application again.  You should
> note the larger dojo.js file being loaded and significantly fewer
> requests for resources by dojo   Hopefully it's also a lot faster.
>
> That's it.  Now you can go back and optimize the profile by removing
> resources you don't need.  There's examples in the profiles directory.
> Repeat the build/test process to find the right balance.
> I also recommend editing $resources$/struts/ajax/dojoRequire.js to
> remove the reference to the Editor2 if you don't use this as it's a
> very,very heavy-weight resource.
>
> Hope that helps someone else.  Improvements & comments welcome.  See
> reference [3] below for detailed instructions and rationale.
>
> regards,
>  Jeromy Evans
>
> Resources
> [1] http://struts.apache.org/2.x/docs/performance-tuning.html
> [2]
> http://www.nabble.com/-s2--Struts-head-tag-KILLS-%28%3E-10s%29-page-load-time-tf4490390.html#a13047981
> [3]
> http://www.dojotoolkit.org/book/dojo-book-0-4/part-6-customizing-dojo-builds-better-performance
>
> The following profile includes almost everything in dojo.js.  It assumes
> the struts widgets have been copied into the directory as mentioned at
> step 4.
> struts2.profile.js:
>
> var dependencies = [
>    "dojo.lang.*",
>     "dojo.html.*",
>    "dojo.debug",
>     "dojo.html.display",
>     "dojo.html.layout",
>     "dojo.html.util",
>     "dojo.lfx.*",
>     "dojo.event.*",
>     "dojo.logging.*",
>     "dojo.io.*",
>     "dojo.io.IframeIO",
>     "dojo.date",
>     "dojo.string.*",
>     "dojo.regex",
>     "dojo.rpc.*",
>     "dojo.xml.*",
>     // "dojo.flash.*",
>     // "dojo.storage.*",
>     "dojo.undo.*",
>     "dojo.crypto.*",
>     //"dojo.collections.*",
>     "dojo.collections.ArrayList",
>     "dojo.collections.Collections",
>     "dojo.collections.Queue",
>     "dojo.collections.Stack",
>     "dojo.dnd.*",
>     "dojo.widget.*",
>    "dojo.widget.TabContainer",
>    "dojo.widget.PageContainer",
>    "dojo.widget.LinkPane",
>    //"dojo.widget.Editor2",
>    //"dojo.widget.RichText",
>    //"dojo.widget.Editor2Toolbar",
>    //"dojo.widget.ColorPalette",
>     "dojo.math.*",
>     //"dojo.reflect.*",
>     "dojo.uri.*",
>    "struts.widget.Bind",
>    "struts.widget.Bind",
>    "struts.widget.BindDiv",
>    "struts.widget.BindAnchor",
>    "struts.widget.ComboBox",
>    "struts.widget.StrutsTimePicker",
>    "struts.widget.StrutsTimePicker"
> ];
>
> dependencies.prefixes = [
>    ["struts", "struts"]
> ];
>
> load("getDependencyList.js");
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Andre Prasetya wrote:
> TQ Jerome, can i combine the struts api & core of 2.1 snapshot with 
> the plugins from 2.0.9 ?
I'm not sure as I haven't tried it, but I sure some will work and some 
won't.  You'd be better off starting a new email thread and asking 
whether the specific plugin works with 2.1.
The json plugin works.
> and do i need xwork 2.1 to use the snapshot ?
>
The catch with downloading a nightly 2.1 build is you'll have to 
download all the new dependencies yourself.  That's why I build from 
source instead.

If you follow the instructions on both the pages below you'll be able to 
build everything from source, including the latest xwork.  For most 
people it would be worth waiting for the first test release of 2.1
http://struts.apache.org/2.x/docs/building-the-framework-from-source.html
http://struts.apache.org/2.x/docs/building-with-maven.html 
<http://struts.apache.org/2.x/docs/building-the-framework-from-source.html,http://struts.apache.org/2.x/docs/building-with-maven.html>
> -Andre-
>
> Jeromy Evans wrote:
>> Andre Prasetya wrote:
>>> Any dates for 2.1.x release ? I just tried struts 2.0.9 and i like 
>>> it very much, feature that i need most is the ajax validation which 
>>> is only at 2.1.x CMIIW
>>>
>> Hi Andre,
>>
>> This thread was the last direct answer to your question:
>> http://www.nabble.com/struts-2.1-release-availlability-t4353028.html 
>> <http://www.nabble.com/struts-2.1-beta-t4509951.html>
>>
>> And:
>> http://www.nabble.com/2.1.0-Build-Release-Plan-t4534825.html
>>
>> The thread below also contains some valuable information:
>> http://www.nabble.com/struts-2.1-beta-t4509951.html
>>
>> Personally, if I was starting a new project that has a high 
>> dependency on ajax and was happy to use Dojo, I'd use 2.1 right now 
>> (built from source). However I'm not migrating existing 2.0.x 
>> projects over to 2.1 yet though.
>>
>> Hope that helps,
>> Jeromy Evans
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>


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


Re: [struts] How to improve dojo performance in Struts 2.0.9

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
I didn't notice any of these issues with the release-0.42 tag myself. 
The line "_4b=_4d.join("/")+".js";" is only present once in my compiled 
dojo.js file.

Martin, dojo.js is compressed by shortening variable names and stripping 
out comments and whitespace.  Use dojo.js.uncompressed.js to follow how 
it works if you're interested. It includes the human-readable variable 
names.

Note that the Struts 2.1 dojo plugin uses dojo 0.43.  None of the tags 
are intended to be compatible with dojo 0.9.

Martin Gainty wrote:
> (Its The last entry that I commented)
> Im trying to gain an undertstanding of dojo's architecture so those us from
> OO world can reference
> dojo.srcfilename =
>
> instead of
> _4b =
>
> in the javascript source
>
> (I have noticed a significant number of deltas in the latest 0.9 Dojo
> release from the the original 0.42 base..)
>
> If you want to follow along download firefox
> http://www.mozilla.com/en-US/firefox/
> and load in the firebug plugin
> https://addons.mozilla.org/en-US/firefox/addon/1843
> click on Tools/Firebug
>
> Thanks Dale
> M--
> ----- Original Message -----
> From: "Dale Newfield" <Da...@Newfield.org>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Friday, October 19, 2007 2:15 PM
> Subject: Re: [struts] How to improve dojo performance in Struts 2.0.9
>
>
>   
>> Martin Gainty wrote:
>>     
>>> I found the error with reference to missing src.js from DOJO
>>>       
> release-0.4.2
>   
>>> go to base dojo.js located at
>>> $CATALINA_HOME\webapps\struts2-showcase\struts\dojo\dojo.js
>>> comment out the _4d join line (as illustrated here)
>>> /*_4b=_4d.join("/")+".js";*/
>>>       
>> That line appears twice in that file...
>>
>> -Dale
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>   


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


Re: [struts] How to improve dojo performance in Struts 2.0.9

Posted by Dale Newfield <Da...@Newfield.org>.
Martin Gainty wrote:
> I found the error with reference to missing src.js from DOJO release-0.4.2
> go to base dojo.js located at
> $CATALINA_HOME\webapps\struts2-showcase\struts\dojo\dojo.js
> comment out the _4d join line (as illustrated here)
> /*_4b=_4d.join("/")+".js";*/

That line appears twice in that file...

-Dale

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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Andre Prasetya <an...@gmail.com>.
TQ Jerome, can i combine the struts api & core of 2.1 snapshot with the 
plugins from 2.0.9 ?
and do i need xwork 2.1 to use the snapshot ?

-Andre-

Jeromy Evans wrote:
> Andre Prasetya wrote:
>> Any dates for 2.1.x release ? I just tried struts 2.0.9 and i like it 
>> very much, feature that i need most is the ajax validation which is 
>> only at 2.1.x CMIIW
>>
> Hi Andre,
>
> This thread was the last direct answer to your question:
> http://www.nabble.com/struts-2.1-release-availlability-t4353028.html 
> <http://www.nabble.com/struts-2.1-beta-t4509951.html>
>
> And:
> http://www.nabble.com/2.1.0-Build-Release-Plan-t4534825.html
>
> The thread below also contains some valuable information:
> http://www.nabble.com/struts-2.1-beta-t4509951.html
>
> Personally, if I was starting a new project that has a high dependency 
> on ajax and was happy to use Dojo, I'd use 2.1 right now (built from 
> source). However I'm not migrating existing 2.0.x projects over to 2.1 
> yet though.
>
> Hope that helps,
> Jeromy Evans
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Andre Prasetya wrote:
> Any dates for 2.1.x release ? I just tried struts 2.0.9 and i like it 
> very much, feature that i need most is the ajax validation which is 
> only at 2.1.x CMIIW
>
Hi Andre,

This thread was the last direct answer to your question:
http://www.nabble.com/struts-2.1-release-availlability-t4353028.html 
<http://www.nabble.com/struts-2.1-beta-t4509951.html>

And:
http://www.nabble.com/2.1.0-Build-Release-Plan-t4534825.html

The thread below also contains some valuable information:
http://www.nabble.com/struts-2.1-beta-t4509951.html

Personally, if I was starting a new project that has a high dependency 
on ajax and was happy to use Dojo, I'd use 2.1 right now (built from 
source). However I'm not migrating existing 2.0.x projects over to 2.1 
yet though.

Hope that helps,
Jeromy Evans


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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Andre Prasetya <an...@gmail.com>.
Any dates for 2.1.x release ? I just tried struts 2.0.9 and i like it 
very much, feature that i need most is the ajax validation which is only 
at 2.1.x CMIIW

-Andre-

Jeromy Evans wrote:
> Pedro Herrera wrote:
>> It´s not working to me. why don´t you leave yours jars available ?
>>
>> Herrera
>>
>>   
> Hi Pedro,
> I can't really create a jar for you because its not appropriate to 
> extract part of struts out and then redistribute it.  I could create a 
> script I suppose, but the problem is mostly solved in struts 2.1 already.
>
> If you let me know where the instructions fall-short maybe I can help 
> a little better?
>
> regards,
> Jeromy Evans


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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Pedro Herrera wrote:
> It´s not working to me. why don´t you leave yours jars available ?
>
> Herrera
>
>   
Hi Pedro,
I can't really create a jar for you because its not appropriate to 
extract part of struts out and then redistribute it.  I could create a 
script I suppose, but the problem is mostly solved in struts 2.1 already.

If you let me know where the instructions fall-short maybe I can help a 
little better?

regards,
 Jeromy Evans
> Jeromy Evans - Blue Sky Minds wrote:
>   
>> As suggested, I've added these instructions to the community wiki.
>>
>> http://cwiki.apache.org/confluence/display/S2WIKI/Creating+a+custom+Dojo+profile+for+Struts+2.0.9
>>
>>     


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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Pedro Herrera <pe...@hotmail.com>.
It´s not working to me. why don´t you leave yours jars available ?

Herrera




Jeromy Evans - Blue Sky Minds wrote:
> 
> As suggested, I've added these instructions to the community wiki.
> 
> http://cwiki.apache.org/confluence/display/S2WIKI/Creating+a+custom+Dojo+profile+for+Struts+2.0.9
> 
> Wes Wannemacher wrote:
>> This was my original suggestion to post it into the community wiki
>> because any changes that would be made to the main wiki may not
>> propagate until the next release of struts (2.1.x?) which this may no
>> longer be an issue. I figured it could be posted there and if the
>> powers that be know a special way to tie it to the 2.0 docs, we could
>> push it in. If not, at least it would stay in the community wiki.
>>
>> -W
>>
>> On 10/9/07, Don Brown <do...@gmail.com> wrote:
>>   
>>> To add to that, there are really two wiki's - official docs (WW) and
>>> the informal docs (S2WIKI),
>>>     
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-improve-dojo-performance-in-Struts-2.0.9-tf4579700.html#a13273769
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
As suggested, I've added these instructions to the community wiki.

http://cwiki.apache.org/confluence/display/S2WIKI/Creating+a+custom+Dojo+profile+for+Struts+2.0.9

Wes Wannemacher wrote:
> This was my original suggestion to post it into the community wiki
> because any changes that would be made to the main wiki may not
> propagate until the next release of struts (2.1.x?) which this may no
> longer be an issue. I figured it could be posted there and if the
> powers that be know a special way to tie it to the 2.0 docs, we could
> push it in. If not, at least it would stay in the community wiki.
>
> -W
>
> On 10/9/07, Don Brown <do...@gmail.com> wrote:
>   
>> To add to that, there are really two wiki's - official docs (WW) and
>> the informal docs (S2WIKI),
>>     
>
>   


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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Wes Wannemacher <we...@wantii.com>.
This was my original suggestion to post it into the community wiki
because any changes that would be made to the main wiki may not
propagate until the next release of struts (2.1.x?) which this may no
longer be an issue. I figured it could be posted there and if the
powers that be know a special way to tie it to the 2.0 docs, we could
push it in. If not, at least it would stay in the community wiki.

-W

On 10/9/07, Don Brown <do...@gmail.com> wrote:
> To add to that, there are really two wiki's - official docs (WW) and
> the informal docs (S2WIKI),

-- 
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com

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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Don Brown <do...@gmail.com>.
To add to that, there are really two wiki's - official docs (WW) and
the informal docs (S2WIKI), and only the former requires a CLA.
Anyone can access and edit the S2WIKI.

The fact that the main docs require an CLA is a business decision, and
not a limitation of the wiki software.  As Dave mentioned, we decided
to require a CLA for WW because it is considered official,
distributable documentation that contains copyrightable information.

Don

On 10/10/07, Dave Newton <ne...@yahoo.com> wrote:
> --- cilquirm <aa...@gmail.com> wrote:
> > I hadn't really started fragmenting anything  yet.
> > I was engaging in conversation.
>
> As was I.
>
> > My whole point was to get around the barrier of
> > entry of engaging people to add and modify stuff.
> > Getting someone else to maybe do it doesn't seem
> > like a form of engagement.
>
> While I agree it would be better to have the
> information "somewhere" rather than nowhere, it makes
> way more sense to me to keep as much S2 documentation
> as possible on the S2 Wiki. This means it gets
> distributed with S2 itself.
>
> If filing a CLA is to high a barrier for someone then
> adding a comment to a user-list email saying "I have
> no CLA on file; could someone please add this?" seems
> easier than that person creating a wiki space and
> posting it there instead, plus then that knowledge
> becomes part of the S2 project.
>
> I'm sure there's some documentation, use-cases,
> tutorials, etc. that are more appropriate to keep
> separate from the S2 wiki, but when it's (more or
> less) core documentation I'd rather see it as part of
> the project, that's all.
>
> d.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Dave Newton <ne...@yahoo.com>.
--- cilquirm <aa...@gmail.com> wrote:
> I hadn't really started fragmenting anything  yet. 
> I was engaging in conversation.

As was I.

> My whole point was to get around the barrier of
> entry of engaging people to add and modify stuff.
> Getting someone else to maybe do it doesn't seem
> like a form of engagement.

While I agree it would be better to have the
information "somewhere" rather than nowhere, it makes
way more sense to me to keep as much S2 documentation
as possible on the S2 Wiki. This means it gets
distributed with S2 itself.

If filing a CLA is to high a barrier for someone then
adding a comment to a user-list email saying "I have
no CLA on file; could someone please add this?" seems
easier than that person creating a wiki space and
posting it there instead, plus then that knowledge
becomes part of the S2 project.

I'm sure there's some documentation, use-cases,
tutorials, etc. that are more appropriate to keep
separate from the S2 wiki, but when it's (more or
less) core documentation I'd rather see it as part of
the project, that's all.

d.


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


Re: How to improve dojo performance in Struts 2.0.9

Posted by cilquirm <aa...@gmail.com>.

I hadn't really started fragmenting anything  yet.  I was engaging in
conversation.

I'm not sure if you checked recently but the apache wiki is slow to get
updated.  I don't disagree that having a centralized place for it is
definitely the best route, but there's tons of information out there that
isn't in the wiki for one reason or another.  You're bound to end up
googling or going to your know spots , so the fragmentation issue is less
valid than you would presume.   I find it less about decentralization than
"re-centralization"

My whole point was to get around the barrier of entry of engaging people to
add and modify stuff.  Getting someone else to maybe do it doesn't seem like
a form of engagement.




newton.dave wrote:
> 
> --- cilquirm <aa...@gmail.com> wrote:
>> Any thought given to using a secondary wiki ( like
>> Wetpaint or one of the other myriad of services that
>> come up when you type in wiki into the mashable 
>> search box ) to ease the burden?
> 
> Please don't start fragmenting community
> documentation.
> 
> 
> 
> If a CLA can't be filed for some legal or corporate
> reason it's a simple matter to ask someone with wiki
> access.
> 
>  
> 
> d.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-improve-dojo-performance-in-Struts-2.0.9-tf4579700.html#a13126170
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Dave Newton <ne...@yahoo.com>.
--- cilquirm <aa...@gmail.com> wrote:
> Any thought given to using a secondary wiki ( like
> Wetpaint or one of the other myriad of services that
> come up when you type in wiki into the mashable 
> search box ) to ease the burden?

Please don't start fragmenting community
documentation.

If a CLA can't be filed for some legal or corporate
reason it's a simple matter to ask someone with wiki
access.

d.


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


Re: How to improve dojo performance in Struts 2.0.9

Posted by cilquirm <aa...@gmail.com>.

Sorry to hijack this thread, because I fully agree with Wes that this is
good stuff to put into a wiki.
It's a little trickier with the apache wiki because you need to sign and
send over the CLA ( not terribly hard, but sometimes may not be possible. )

Any thought given to using a secondary wiki ( like Wetpaint or one of the
other myriad of services that come up when you type in wiki into the
mashable search box ) to ease the burden?


Wes Wannemacher wrote:
> 
> Jeromy,
> 
> I didn't verify that this works (because I am pretty sure it probably
> would), but have you thought about putting it in the community wiki?
> This topic comes up quite often and it would be helpful to many
> people.
> 
> -Wes
> 
> On 10/6/07, Jeromy Evans <je...@blueskyminds.com.au> wrote:
>> I thought I'd share the instructions I prepared for creating a dojo
>> 0.4.2 custom profile for Struts 2.0.9.  The objective is to bundle all
>> the required dojo resources into dojo.js to avoid the numerous slow
>> sequential requests for resources. This makes a massive performance
>> improvement to the default ajax theme.
>>
>> Instructions for improving the performance of dojo 0.4.2 in Struts 2.0.9:
>>
>> $resources$ is assumed to be your web resources directory
>>
>> 1. First, configure struts to serve the static files directly from
>> $resources$/struts instead of from within struts-core-2.0.9.jar:
>>
>>     a. extract struts2-core-2.0.9.jar/org/apache/struts2/static/* to
>> $resources$/struts/
>>     b. edit struts.properties and set struts.serve.static=false
>>     c. also extract the javascript and css files from
>> struts2-core-2.0.9.jar/templates/* to $resources$/struts/ as this will
>> be helpful later
>>           eg. $resources$/struts/ajax/dojoRequire.js
>>
>> Confirm that your application still works before proceeding. It's
>> essential that resources are loaded from the directory rather than the
>> jar.
>>
>> 2. Download the source of dojo 0.4.2.  You won't need to modify it.  The
>> download location doesn't matter.  We assume it's in release-0.4.2/
>>
>>    > svn export http://svn.dojotoolkit.org/dojo/tags/release-0.4.2
>>
>> This is almost identical to the version bundled with struts2.0.9.
>>
>> 3. Use an editor to create a dojo custom profile as the file
>> release-0.4.2/buildscripts/profiles/struts2.profile.js.  This file
>> defines which dojo resources you use directly.  Essentially it specifies
>> which code will be included in dojo.js.  An example that includes almost
>> everything is provided at the end of this email.
>>
>> 4. Copy the struts widgets into the dojo directory so they can be
>> included within dojo.js.  That is, copy $resources$/struts/dojo/struts/*
>> to release-0.4.2/struts.
>> This is the directory that contains the widget and widgets
>> subdirectories, css and some images.
>>
>> 5. Build dojo using ant.  This will create a new dojo.js file:
>>
>>  > cd release-0.4.2/buildscripts
>>  > ant -Dprofile=struts2 -Dstrip_and_compress=true clean release
>> intern-strings strip-resource-comments
>>
>> (You may be asked to run it twice).
>>
>> Pay some attention to the build process.  In particular, note whether it
>> finds the struts widgets and 'internalises' the related resources. If
>> not, see Step 4.  You'll probably notice a lot of things are included
>> that you don't need.  That will be helpful later for optimizations.
>> Some errors will occur while stripping the comments but these are ok.
>>
>> 6. When the build process completes the release directory will contain
>> all the files you need.  The content of the release directory can be
>> copied over the top of $resources$/struts/dojo.  You'll notice it's
>> almost exactly the same as the original, although dojo.js is probably
>> larger.
>>
>> It's okay to delete the demo, test and release subfolders before copying
>> to your application.  The src subfolder must be distributed with your
>> application as it contains images used by dojo.
>>
>> 7. Clear your browser cache and test your application again.  You should
>> note the larger dojo.js file being loaded and significantly fewer
>> requests for resources by dojo   Hopefully it's also a lot faster.
>>
>> That's it.  Now you can go back and optimize the profile by removing
>> resources you don't need.  There's examples in the profiles directory.
>> Repeat the build/test process to find the right balance.
>> I also recommend editing $resources$/struts/ajax/dojoRequire.js to
>> remove the reference to the Editor2 if you don't use this as it's a
>> very,very heavy-weight resource.
>>
>> Hope that helps someone else.  Improvements & comments welcome.  See
>> reference [3] below for detailed instructions and rationale.
>>
>> regards,
>>  Jeromy Evans
>>
>> Resources
>> [1] http://struts.apache.org/2.x/docs/performance-tuning.html
>> [2]
>> http://www.nabble.com/-s2--Struts-head-tag-KILLS-%28%3E-10s%29-page-load-time-tf4490390.html#a13047981
>> [3]
>> http://www.dojotoolkit.org/book/dojo-book-0-4/part-6-customizing-dojo-builds-better-performance
>>
>> The following profile includes almost everything in dojo.js.  It assumes
>> the struts widgets have been copied into the directory as mentioned at
>> step 4.
>> struts2.profile.js:
>>
>> var dependencies = [
>>    "dojo.lang.*",
>>     "dojo.html.*",
>>    "dojo.debug",
>>     "dojo.html.display",
>>     "dojo.html.layout",
>>     "dojo.html.util",
>>     "dojo.lfx.*",
>>     "dojo.event.*",
>>     "dojo.logging.*",
>>     "dojo.io.*",
>>     "dojo.io.IframeIO",
>>     "dojo.date",
>>     "dojo.string.*",
>>     "dojo.regex",
>>     "dojo.rpc.*",
>>     "dojo.xml.*",
>>     // "dojo.flash.*",
>>     // "dojo.storage.*",
>>     "dojo.undo.*",
>>     "dojo.crypto.*",
>>     //"dojo.collections.*",
>>     "dojo.collections.ArrayList",
>>     "dojo.collections.Collections",
>>     "dojo.collections.Queue",
>>     "dojo.collections.Stack",
>>     "dojo.dnd.*",
>>     "dojo.widget.*",
>>    "dojo.widget.TabContainer",
>>    "dojo.widget.PageContainer",
>>    "dojo.widget.LinkPane",
>>    //"dojo.widget.Editor2",
>>    //"dojo.widget.RichText",
>>    //"dojo.widget.Editor2Toolbar",
>>    //"dojo.widget.ColorPalette",
>>     "dojo.math.*",
>>     //"dojo.reflect.*",
>>     "dojo.uri.*",
>>    "struts.widget.Bind",
>>    "struts.widget.Bind",
>>    "struts.widget.BindDiv",
>>    "struts.widget.BindAnchor",
>>    "struts.widget.ComboBox",
>>    "struts.widget.StrutsTimePicker",
>>    "struts.widget.StrutsTimePicker"
>> ];
>>
>> dependencies.prefixes = [
>>    ["struts", "struts"]
>> ];
>>
>> load("getDependencyList.js");
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> -- 
> Wesley Wannemacher
> President, Head Engineer/Consultant
> WanTii, Inc.
> http://www.wantii.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-improve-dojo-performance-in-Struts-2.0.9-tf4579700.html#a13124229
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Musachy Barroso <mu...@gmail.com>.
I'm doing this "by hand" on the profile for 2.1 (profile and
instructions on how to build are on the dojo plugin folder), but we
need  to  get it done with maven so it is part of the build process,
if any maven guru would like to help with that, feel free to jump in
:)

regards
musachy

On 10/6/07, Wes Wannemacher <we...@wantii.com> wrote:
> Jeromy,
>
> I didn't verify that this works (because I am pretty sure it probably
> would), but have you thought about putting it in the community wiki?
> This topic comes up quite often and it would be helpful to many
> people.
>
> -Wes
>
> On 10/6/07, Jeromy Evans <je...@blueskyminds.com.au> wrote:
> > I thought I'd share the instructions I prepared for creating a dojo
> > 0.4.2 custom profile for Struts 2.0.9.  The objective is to bundle all
> > the required dojo resources into dojo.js to avoid the numerous slow
> > sequential requests for resources. This makes a massive performance
> > improvement to the default ajax theme.
> >
> > Instructions for improving the performance of dojo 0.4.2 in Struts 2.0.9:
> >
> > $resources$ is assumed to be your web resources directory
> >
> > 1. First, configure struts to serve the static files directly from
> > $resources$/struts instead of from within struts-core-2.0.9.jar:
> >
> >     a. extract struts2-core-2.0.9.jar/org/apache/struts2/static/* to
> > $resources$/struts/
> >     b. edit struts.properties and set struts.serve.static=false
> >     c. also extract the javascript and css files from
> > struts2-core-2.0.9.jar/templates/* to $resources$/struts/ as this will
> > be helpful later
> >           eg. $resources$/struts/ajax/dojoRequire.js
> >
> > Confirm that your application still works before proceeding. It's
> > essential that resources are loaded from the directory rather than the jar.
> >
> > 2. Download the source of dojo 0.4.2.  You won't need to modify it.  The
> > download location doesn't matter.  We assume it's in release-0.4.2/
> >
> >    > svn export http://svn.dojotoolkit.org/dojo/tags/release-0.4.2
> >
> > This is almost identical to the version bundled with struts2.0.9.
> >
> > 3. Use an editor to create a dojo custom profile as the file
> > release-0.4.2/buildscripts/profiles/struts2.profile.js.  This file
> > defines which dojo resources you use directly.  Essentially it specifies
> > which code will be included in dojo.js.  An example that includes almost
> > everything is provided at the end of this email.
> >
> > 4. Copy the struts widgets into the dojo directory so they can be
> > included within dojo.js.  That is, copy $resources$/struts/dojo/struts/*
> > to release-0.4.2/struts.
> > This is the directory that contains the widget and widgets
> > subdirectories, css and some images.
> >
> > 5. Build dojo using ant.  This will create a new dojo.js file:
> >
> >  > cd release-0.4.2/buildscripts
> >  > ant -Dprofile=struts2 -Dstrip_and_compress=true clean release
> > intern-strings strip-resource-comments
> >
> > (You may be asked to run it twice).
> >
> > Pay some attention to the build process.  In particular, note whether it
> > finds the struts widgets and 'internalises' the related resources. If
> > not, see Step 4.  You'll probably notice a lot of things are included
> > that you don't need.  That will be helpful later for optimizations.
> > Some errors will occur while stripping the comments but these are ok.
> >
> > 6. When the build process completes the release directory will contain
> > all the files you need.  The content of the release directory can be
> > copied over the top of $resources$/struts/dojo.  You'll notice it's
> > almost exactly the same as the original, although dojo.js is probably
> > larger.
> >
> > It's okay to delete the demo, test and release subfolders before copying
> > to your application.  The src subfolder must be distributed with your
> > application as it contains images used by dojo.
> >
> > 7. Clear your browser cache and test your application again.  You should
> > note the larger dojo.js file being loaded and significantly fewer
> > requests for resources by dojo   Hopefully it's also a lot faster.
> >
> > That's it.  Now you can go back and optimize the profile by removing
> > resources you don't need.  There's examples in the profiles directory.
> > Repeat the build/test process to find the right balance.
> > I also recommend editing $resources$/struts/ajax/dojoRequire.js to
> > remove the reference to the Editor2 if you don't use this as it's a
> > very,very heavy-weight resource.
> >
> > Hope that helps someone else.  Improvements & comments welcome.  See
> > reference [3] below for detailed instructions and rationale.
> >
> > regards,
> >  Jeromy Evans
> >
> > Resources
> > [1] http://struts.apache.org/2.x/docs/performance-tuning.html
> > [2]
> > http://www.nabble.com/-s2--Struts-head-tag-KILLS-%28%3E-10s%29-page-load-time-tf4490390.html#a13047981
> > [3]
> > http://www.dojotoolkit.org/book/dojo-book-0-4/part-6-customizing-dojo-builds-better-performance
> >
> > The following profile includes almost everything in dojo.js.  It assumes
> > the struts widgets have been copied into the directory as mentioned at
> > step 4.
> > struts2.profile.js:
> >
> > var dependencies = [
> >    "dojo.lang.*",
> >     "dojo.html.*",
> >    "dojo.debug",
> >     "dojo.html.display",
> >     "dojo.html.layout",
> >     "dojo.html.util",
> >     "dojo.lfx.*",
> >     "dojo.event.*",
> >     "dojo.logging.*",
> >     "dojo.io.*",
> >     "dojo.io.IframeIO",
> >     "dojo.date",
> >     "dojo.string.*",
> >     "dojo.regex",
> >     "dojo.rpc.*",
> >     "dojo.xml.*",
> >     // "dojo.flash.*",
> >     // "dojo.storage.*",
> >     "dojo.undo.*",
> >     "dojo.crypto.*",
> >     //"dojo.collections.*",
> >     "dojo.collections.ArrayList",
> >     "dojo.collections.Collections",
> >     "dojo.collections.Queue",
> >     "dojo.collections.Stack",
> >     "dojo.dnd.*",
> >     "dojo.widget.*",
> >    "dojo.widget.TabContainer",
> >    "dojo.widget.PageContainer",
> >    "dojo.widget.LinkPane",
> >    //"dojo.widget.Editor2",
> >    //"dojo.widget.RichText",
> >    //"dojo.widget.Editor2Toolbar",
> >    //"dojo.widget.ColorPalette",
> >     "dojo.math.*",
> >     //"dojo.reflect.*",
> >     "dojo.uri.*",
> >    "struts.widget.Bind",
> >    "struts.widget.Bind",
> >    "struts.widget.BindDiv",
> >    "struts.widget.BindAnchor",
> >    "struts.widget.ComboBox",
> >    "struts.widget.StrutsTimePicker",
> >    "struts.widget.StrutsTimePicker"
> > ];
> >
> > dependencies.prefixes = [
> >    ["struts", "struts"]
> > ];
> >
> > load("getDependencyList.js");
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
> --
> Wesley Wannemacher
> President, Head Engineer/Consultant
> WanTii, Inc.
> http://www.wantii.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: How to improve dojo performance in Struts 2.0.9

Posted by Wes Wannemacher <we...@wantii.com>.
Jeromy,

I didn't verify that this works (because I am pretty sure it probably
would), but have you thought about putting it in the community wiki?
This topic comes up quite often and it would be helpful to many
people.

-Wes

On 10/6/07, Jeromy Evans <je...@blueskyminds.com.au> wrote:
> I thought I'd share the instructions I prepared for creating a dojo
> 0.4.2 custom profile for Struts 2.0.9.  The objective is to bundle all
> the required dojo resources into dojo.js to avoid the numerous slow
> sequential requests for resources. This makes a massive performance
> improvement to the default ajax theme.
>
> Instructions for improving the performance of dojo 0.4.2 in Struts 2.0.9:
>
> $resources$ is assumed to be your web resources directory
>
> 1. First, configure struts to serve the static files directly from
> $resources$/struts instead of from within struts-core-2.0.9.jar:
>
>     a. extract struts2-core-2.0.9.jar/org/apache/struts2/static/* to
> $resources$/struts/
>     b. edit struts.properties and set struts.serve.static=false
>     c. also extract the javascript and css files from
> struts2-core-2.0.9.jar/templates/* to $resources$/struts/ as this will
> be helpful later
>           eg. $resources$/struts/ajax/dojoRequire.js
>
> Confirm that your application still works before proceeding. It's
> essential that resources are loaded from the directory rather than the jar.
>
> 2. Download the source of dojo 0.4.2.  You won't need to modify it.  The
> download location doesn't matter.  We assume it's in release-0.4.2/
>
>    > svn export http://svn.dojotoolkit.org/dojo/tags/release-0.4.2
>
> This is almost identical to the version bundled with struts2.0.9.
>
> 3. Use an editor to create a dojo custom profile as the file
> release-0.4.2/buildscripts/profiles/struts2.profile.js.  This file
> defines which dojo resources you use directly.  Essentially it specifies
> which code will be included in dojo.js.  An example that includes almost
> everything is provided at the end of this email.
>
> 4. Copy the struts widgets into the dojo directory so they can be
> included within dojo.js.  That is, copy $resources$/struts/dojo/struts/*
> to release-0.4.2/struts.
> This is the directory that contains the widget and widgets
> subdirectories, css and some images.
>
> 5. Build dojo using ant.  This will create a new dojo.js file:
>
>  > cd release-0.4.2/buildscripts
>  > ant -Dprofile=struts2 -Dstrip_and_compress=true clean release
> intern-strings strip-resource-comments
>
> (You may be asked to run it twice).
>
> Pay some attention to the build process.  In particular, note whether it
> finds the struts widgets and 'internalises' the related resources. If
> not, see Step 4.  You'll probably notice a lot of things are included
> that you don't need.  That will be helpful later for optimizations.
> Some errors will occur while stripping the comments but these are ok.
>
> 6. When the build process completes the release directory will contain
> all the files you need.  The content of the release directory can be
> copied over the top of $resources$/struts/dojo.  You'll notice it's
> almost exactly the same as the original, although dojo.js is probably
> larger.
>
> It's okay to delete the demo, test and release subfolders before copying
> to your application.  The src subfolder must be distributed with your
> application as it contains images used by dojo.
>
> 7. Clear your browser cache and test your application again.  You should
> note the larger dojo.js file being loaded and significantly fewer
> requests for resources by dojo   Hopefully it's also a lot faster.
>
> That's it.  Now you can go back and optimize the profile by removing
> resources you don't need.  There's examples in the profiles directory.
> Repeat the build/test process to find the right balance.
> I also recommend editing $resources$/struts/ajax/dojoRequire.js to
> remove the reference to the Editor2 if you don't use this as it's a
> very,very heavy-weight resource.
>
> Hope that helps someone else.  Improvements & comments welcome.  See
> reference [3] below for detailed instructions and rationale.
>
> regards,
>  Jeromy Evans
>
> Resources
> [1] http://struts.apache.org/2.x/docs/performance-tuning.html
> [2]
> http://www.nabble.com/-s2--Struts-head-tag-KILLS-%28%3E-10s%29-page-load-time-tf4490390.html#a13047981
> [3]
> http://www.dojotoolkit.org/book/dojo-book-0-4/part-6-customizing-dojo-builds-better-performance
>
> The following profile includes almost everything in dojo.js.  It assumes
> the struts widgets have been copied into the directory as mentioned at
> step 4.
> struts2.profile.js:
>
> var dependencies = [
>    "dojo.lang.*",
>     "dojo.html.*",
>    "dojo.debug",
>     "dojo.html.display",
>     "dojo.html.layout",
>     "dojo.html.util",
>     "dojo.lfx.*",
>     "dojo.event.*",
>     "dojo.logging.*",
>     "dojo.io.*",
>     "dojo.io.IframeIO",
>     "dojo.date",
>     "dojo.string.*",
>     "dojo.regex",
>     "dojo.rpc.*",
>     "dojo.xml.*",
>     // "dojo.flash.*",
>     // "dojo.storage.*",
>     "dojo.undo.*",
>     "dojo.crypto.*",
>     //"dojo.collections.*",
>     "dojo.collections.ArrayList",
>     "dojo.collections.Collections",
>     "dojo.collections.Queue",
>     "dojo.collections.Stack",
>     "dojo.dnd.*",
>     "dojo.widget.*",
>    "dojo.widget.TabContainer",
>    "dojo.widget.PageContainer",
>    "dojo.widget.LinkPane",
>    //"dojo.widget.Editor2",
>    //"dojo.widget.RichText",
>    //"dojo.widget.Editor2Toolbar",
>    //"dojo.widget.ColorPalette",
>     "dojo.math.*",
>     //"dojo.reflect.*",
>     "dojo.uri.*",
>    "struts.widget.Bind",
>    "struts.widget.Bind",
>    "struts.widget.BindDiv",
>    "struts.widget.BindAnchor",
>    "struts.widget.ComboBox",
>    "struts.widget.StrutsTimePicker",
>    "struts.widget.StrutsTimePicker"
> ];
>
> dependencies.prefixes = [
>    ["struts", "struts"]
> ];
>
> load("getDependencyList.js");
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com

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


Re: How to improve dojo performance in Struts 2.0.9

Posted by juanc <ju...@gmail.com>.
thanks at all, my application work fine now, the load of pages took too much
time.

Juan Carlos


Musachy Barroso wrote:
> 
> Oh, that makes more sense :), in 2.1 there will also be a property to
> specify the base url to load dojo, so you could use a different dojo
> distribution (served from any url that you like), check the "head" tag
> for details on the ajax tags.
> 
> regards
> musachy
> 
> On 10/9/07, Jeromy Evans <je...@blueskyminds.com.au> wrote:
>> Musachy, I think Juan means in 2.0.9 he want the static resources to be
>> served from a directory instead of struts2-core-2.0.9.jar as per the
>> optimization recommended at
>> http://struts.apache.org/2.x/docs/performance-tuning.html
>>
>> Juan, first, if you're new to struts 2 you don't need to be concerned
>> about this too much. It's one of the last things to worry about as it
>> only gives a marginal performance improvement.
>>
>> Also, in 2.1, you don't need to worry about it because as Musachy
>> mentioned the optimized javascript is pre-generated and stored an
>> struts-dojo-plugin.jar.
>>
>> In 2.0.9 by default, any resources with a URL that starts with /struts
>> are served by the FilterDispatcher directly from
>> struts2-core-2.0.9.jar/org/apache2/struts/static
>> The /struts URL is hardcoded in FilterDispatch and can't be changed.
>>
>> If you set struts.serve.static=false in struts.properties this feature
>> will be disabled.  You would then need to copy the same resources out of
>> the jar to the /struts url of your application which I describe at the
>> top of this thread.  I recommend this in my instructions because I copy
>> a new version of dojo into /struts/dojo without modifying the core jar.
>>
>> References to /struts are contained throughout the templates.  You could
>> move dojo to a new location if you wanted to by modifying the
>> ajax/head.ftl template but I see no reason to.
>>
>> The default directory for templates is /template in the classpath.  You
>> can change this value with the property struts.ui.templateDir=template.
>> Again, I see no reason to change it. You can modify or add templates by
>> adding a /template directory to your application classpath (this however
>> is not an optimisation)
>>
>> Hope that helps,
>> Jeromy Evans
>>
>> Musachy Barroso wrote:
>> > Everything ends up inside a jar, in this case struts-dojo-plugin.jar.
>> > It is at compile time, and before packing the jar that the javascript
>> > files should be generated.
>> >
>> > musachy
>> >
>> > On 10/9/07, Juan Carlos Serrano <ju...@gmail.com> wrote:
>> >
>> >> I am newbie in struts 2.
>> >>
>> >> How do you do that resources are loaded from the directory rather than
>> the
>> >> jar? I mean, in which configuration file the directory of dojo and
>> template
>> >> is written?
>> >>
>> >> thanks a lot
>> >> regards
>> >>
>> >>
>> >
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-improve-dojo-performance-in-Struts-2.0.9-tf4579700.html#a13142251
Sent from the Struts - User mailing list archive at Nabble.com.


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