0

I am using ext-js version 3.4 with GateIn 3.6 (jboss as 7). On GateIn some ext components are not working fine (especially tree) when GateIn as in production mode. I think this issue is due to javascript compression mechanism. I got the same issue in GateIn 3.2 then after i find that in GateIn 3.6 they changed the java compression machanism (in this GateIn they are using closure compiler) but still have the same issue. Here follows my problem with example

I created two examples which contains same code of tree loading
Example 1 :- Here the ext js related files are not compressed
Example 2 :- Here the ext js files are compressed using closure compiler
(You can run the above two example by deploying it into a server like wamp, xamp, jboss... etc)

On Example 1 it is possible to expand the tree. But on the second case (Example 2) the tree expanded only first level. Is there is any idea to resolve this issue.

I cant directly specify the ext js libraries without compression in production mode. Because in GateIn java scripts are specified inside in gatein-resources.xml file. In production mode i think by default GateIn compresses the files in gatein-resources.xml using closure compiler.

4

1 回答 1

1

如果您可以选择不压缩 ext-js 脚本,您可以:
- 使用 doHeaders 方法添加脚本,而不是使用 gatein-resources.xml:从 doHeaders() 中删除重复的标头条目
- 继续使用 gatein- resources.xml 来导入您的 javascript,并通过在 gatein/conf/controller.xml 中添加一个路由(没有获得压缩参数的路由)来使压缩例外:

<route path="/scripts/{gtn:version}/{gtn:scope}/">
  <route-param qname="gtn:handler">
    <value>script</value>
  </route-param>
  <path-param qname="gtn:version" encoding="preserve-path">
    <pattern>[^/]*</pattern>
  </path-param>
  <route path="/{gtn:resource}{gtn:lang}-min.js">
    <path-param qname="gtn:resource">
      <pattern>(ext-core-debug)</pattern>
    </path-param>
    <path-param qname="gtn:lang" capture-group="true">
      <pattern>-([A-Za-z]{2}(-[A-Za-z]{2})?)|</pattern>
    </path-param>
  </route>
</route>

<route path="/scripts/{gtn:version}/{gtn:scope}/">
  <route-param qname="gtn:handler">
    <value>script</value>
  </route-param>
  <path-param qname="gtn:version" encoding="preserve-path">
    <pattern>[^/]*</pattern>
  </path-param>
  <route path="/{gtn:resource}{gtn:lang}{gtn:compress}.js">
    <path-param qname="gtn:resource">
      <pattern>.+?</pattern>
    </path-param>
    <path-param qname="gtn:lang" capture-group="true">
      <pattern>-([A-Za-z]{2}(-[A-Za-z]{2})?)|</pattern>
    </path-param>
    <path-param qname="gtn:compress" capture-group="true">
      <pattern>-(min)|</pattern>
    </path-param>
  </route>
</route>

调整 gtn:resource 参数的模式以满足您的需求。使用其中一种解决方案,所有脚本都将被缩小,除了您在模式中定义的脚本。

于 2013-12-01T13:52:12.343 回答