T5.1.05 always runing slowly when it handle the page requests

2010-07-23 Thread cleverpig
So stranger,I use Tapestry5.1.05(stable version) in these environment:
1.product environment :Tomcat6+windows 2003 server.
2.development environment :Tomcat6+windows xp.

In dev environment,everything is okay.
But in product environment,T5 takes 14~15 second almostly to handle
one page request!

I found this issue just like my
trouble:http://issues.apache.org/jira/browse/TAP5-945.
so I check out fixed version java files to take them for hotfix:
http://svn.apache.org/viewvc?view=revisionrevision=888688

They didn't work well,problem still live~

Somebody can give me advice or help me?

I created a issue and uploaded error.log:
https://issues.apache.org/jira/browse/TAP5-1214

-- 
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liu...@hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: cleverpig.name/dan/
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
or...@facebook: http://www.facebook.com/group.php?gid=8159558294

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



RE: Lots of Tapestry problems - quickstart and tutorial

2010-07-23 Thread Newham, Cameron

Thanks Andreas. Much appreciated.


-Original Message-
From: andre...@gmail.com [mailto:andre...@gmail.com] On Behalf Of Andreas 
Andreou
Sent: 22 July 2010 12:22
To: Tapestry users
Subject: Re: Lots of Tapestry problems - quickstart and tutorial

ok, my bad - i've left some https references in
http://tapestry.apache.org/archetype-catalog.xml
and that's probably causing this.

I've changed them all to http but it may take some time
before changes are propagated to public server.
In the meantime, just wget the file, change https-http
and point to that catalog file using
mvn archetype:generate -DarchetypeCatalog=myfile.xml

On Thu, Jul 22, 2010 at 14:12, Andreas Andreou andy...@di.uoa.gr wrote:
 Well, i retried here from an empty repo and it worked.
 Your problems seem to be that in one case http://tapestry.apache.org
 seems inaccessible through your proxy and in the other case (stack overflow)
 that https://ibiblio.org/maven2/ refuses connections

 Now, i'm not sure why there's the httpS there, so i'll investigate some more

 On Thu, Jul 22, 2010 at 11:58, Newham, Cameron cameron.new...@bl.uk wrote:


 -Original Message-
 From: andre...@gmail.com [mailto:andre...@gmail.com] On Behalf Of
 Andreas Andreou
 Sent: 21 July 2010 13:52
 To: Tapestry users
 Subject: Re: Lots of Tapestry problems - quickstart and tutorial

 Even better to use
 mvn archetype:generate -DarchetypeCatalog=http://tapestry.apache.org

 We've tried to move stuff away from formos infrastructure

 --



 Thanks for your comments Andreas. However, I still get the same
 problems.

 In the interests of making no errors I switched back to a clean install
 of Maven 2.2.1, removed my repository, made sure my settings.xml was
 pointing to our proxy and executed the command given by you. It chokes
 on getting the tapestry catalog, getting a NPE, as shown at the end of
 this email.

 I then deleted my repository and moved back to using maven with our
 proxy hard-coded. It downloads the catalog fine but when it now attempts
 to get

 https://www.ibiblio.org/maven2//org/apache/tapestry/quickstart/5.1.
 0.5/quickstart-5.1.0.5.jar

 It gets a stack overflow thus (short excerpt):

 --
 ...
 Downloading:
 http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-velocity/1
 .1.8/plexus-velocity-1.1.8.jar

 [INFO] [archetype:generate {execution: default-cli}]
 [INFO] Generating project in Interactive mode
 [INFO] No archetype defined. Using maven-archetype-quickstart
 (org.apache.maven.
 archetypes:maven-archetype-quickstart:1.0)
 Choose archetype:
 1: http://tapestry.apache.org - quickstart (Tapestry 5.2.0-SNAPSHOT
 Quickstart
 Project)
 2: http://tapestry.apache.org - tapestry-archetype (Tapestry 4.1.6
 Archetype)
 Choose a number: : 1
 Choose version:
 1: 5.0.19
 2: 5.1.0.5
 3: 5.2.0-SNAPSHOT
 Choose a number: : 2
 Downloading:
 https://www.ibiblio.org/maven2//org/apache/tapestry/quickstart/5.1.
 0.5/quickstart-5.1.0.5.jar
 [INFO]
 
 [ERROR] FATAL ERROR
 [INFO]
 
 [INFO] null
 [INFO]
 
 [INFO] Trace
 java.lang.StackOverflowError
        at java.lang.System.getProperty(System.java:649)
        at
 sun.security.action.GetPropertyAction.run(GetPropertyAction.java:67)
        at
 sun.security.action.GetPropertyAction.run(GetPropertyAction.java:32)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.io.BufferedWriter.init(BufferedWriter.java:91)
        at java.io.BufferedWriter.init(BufferedWriter.java:70)
        at java.io.PrintStream.init(PrintStream.java:83)
        at java.io.PrintStream.init(PrintStream.java:125)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:396)
        at sun.net.www.http.HttpClient$4.run(HttpClient.java:457)
        at java.security.AccessController.doPrivileged(Native Method)
        at
 sun.net.www.http.HttpClient.privilegedOpenServer(HttpClient.java:439)

        at sun.net.www.http.HttpClient.openServer(HttpClient.java:520)
        at
 sun.net.www.protocol.https.HttpsClient.init(HttpsClient.java:271)
        at
 sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:328)
        at
 sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:309)
        at
 sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:301)
        at
 sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.proxied
 Connect(AbstractDelegateHttpsURLConnection.java:130)
        at
 sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnec
 tion.java:1363)
        at
 sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:762)
        at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
        at
 sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnec
 

T5.2-Snapshot Can't handle components and mixins' script or css files with includeJavascript and includeStyle method.

2010-07-23 Thread cleverpig
I don't why but it really happend when I changed to use 5.2.0-snapshot.
if any script or css files which put in classpath,just not web
context,they must miss at the page.

sample code-comfirm mixin:

@IncludeJavaScriptLibrary(${my.scripts}/confirm.js)
public class Confirm {

@Parameter(value = are you sure?, defaultPrefix =
BindingConstants.LITERAL)
private String message;

@Inject
private RenderSupport renderSupport;

@InjectContainer
private ClientElement element;

@AfterRender
public void afterRender() {
renderSupport.addScript(String.format(new Confirm('%s', '%s');,
element.getClientId(), message));
}
}

I created a issue: https://issues.apache.org/jira/browse/TAP5-1215
-- 
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liu...@hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: cleverpig.name/dan/
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
or...@facebook: http://www.facebook.com/group.php?gid=8159558294

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



Re: T5.2-Snapshot Can't handle components and mixins' script or css files with includeJavascript and includeStyle method.

2010-07-23 Thread cleverpig
cool,solved!

my Tapestry5.2.0-snapshot(20100208 version) lost a important thing in AppModule:
public static void contributeRegexAuthorizer(ConfigurationString conf){
conf.add(^.*png$);
conf.add(^.*jpg$);
conf.add(^.*jpeg$);
conf.add(^.*js$);
conf.add(^.*css$);

conf.add(org/chenillekit/.*\\.((css)|(js)|(jpg)|(jpeg)|(png)|(gif)|(html)|(ico)|(swf)|(xml))$);
}

I found answer here:
https://issues.apache.org/jira/browse/TAP5-963
http://tapestry-users.832.n2.nabble.com/Tapestry-5-1-0-5-FCKEDITOR-PROBLEM-td4141853.html#a4141853

On Fri, Jul 23, 2010 at 3:50 PM, cleverpig greatclever...@gmail.com wrote:
 I don't why but it really happend when I changed to use 5.2.0-snapshot.
 if any script or css files which put in classpath,just not web
 context,they must miss at the page.

 sample code-comfirm mixin:

 @IncludeJavaScriptLibrary(${my.scripts}/confirm.js)
 public class Confirm {

   �...@parameter(value = are you sure?, defaultPrefix =
 BindingConstants.LITERAL)
    private String message;

   �...@inject
    private RenderSupport renderSupport;

   �...@injectcontainer
    private ClientElement element;

   �...@afterrender
    public void afterRender() {
            renderSupport.addScript(String.format(new Confirm('%s', '%s');,
                    element.getClientId(), message));
    }
 }

 I created a issue: https://issues.apache.org/jira/browse/TAP5-1215
 --
 cleverpig(Dan)
 Location: Beijing
 Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
 Zipcode: 100031
 MSN: great_liu...@hotmail.com
 QQ: 149291732
 Skype: cleverpigatmatrix
 Facebook ID:cleverpig
 Blog: cleverpig.name/dan/
 Tags: del.icio.us/cleverpig
 Twitter: twitter.com/cleverpig
 新浪微博: t.sina.com.cn/cleverpig
 Organization: www.beijing-open-party.org
 or...@facebook: http://www.facebook.com/group.php?gid=8159558294




-- 
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liu...@hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: cleverpig.name/dan/
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
or...@facebook: http://www.facebook.com/group.php?gid=8159558294

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



Zoneupdater mixin best practice

2010-07-23 Thread Peter Stavrinides
Hi all,

I am trying out the Zoneupdater mixin on a dropdown. What I want to do is as 
follows:

When the user selects an option from the dropdown I want to trigger an event 
that filters a list, which is then used on an autocomplete textfield. Sounds 
simple enough but I don't quite understanding how to use the Zoneupdater to 
target only specific fields in my form without changing the other fields. 

To be more specific, I am using the Zoneupdater (code below) with a zone that 
encloses a form, and the form encloses several textfields. For my use case I 
only want to target one specific form element but don't know how to avoid the 
zone refreshing everything. I.e.: As it stands now, any input in other fields 
in the form is lost whenever I make a selection from the drop down menu due to 
the zone update, is there another way? 

.tml:
div t:type=zone t:id=siteZone

 t:form 
   !-- Textfield to autocomplete--
t:textfield t:id=site value=site/
   
   t:select t:id=country value=country model=countriesModel
   t:mixins=zoneUpdater t:clientEvent=change 
t:event=changeOfCountry t:zone=siteZone/

   !-- The rest of the form elements below --

/t:form
/div

.java:

Object onChangeOfCountry() {
country = request_.getParameter(param);
return siteZone_.getBody();
}

Thanks in advance,
Peter


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



Re: Zoneupdater mixin best practice

2010-07-23 Thread Thiago H. de Paula Figueiredo
On Fri, 23 Jul 2010 07:40:18 -0300, Peter Stavrinides  
p.stavrini...@albourne.com wrote:



Hi all,


Hi!

To be more specific, I am using the Zoneupdater (code below) with a zone  
that encloses a form, and the form encloses several textfields. For my  
use case I only want to target one specific form element but don't know  
how to avoid the zone refreshing everything. I.e.: As it stands now, any  
input in other fields in the form is lost whenever I make a selection  
from the drop down menu due to the zone update, is there another way?


To not lose the field values, submit the form.

To update just one field, you can create an event and trigger and handle  
it with a little bit of custom JavaScript and the JSON classes in Tapestry.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: T5.1.05 always runing slowly when it handle the page requests

2010-07-23 Thread Thiago H. de Paula Figueiredo
On Fri, 23 Jul 2010 04:38:15 -0300, cleverpig greatclever...@gmail.com  
wrote:



In dev environment,everything is okay.
But in product environment,T5 takes 14~15 second almostly to handle
one page request!


Have you checked if the bottleneck is elsewhere? In the database access or  
a server with other high CPU or I/O apps, for example? I never had this  
problem.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: Zoneupdater mixin best practice

2010-07-23 Thread Peter Stavrinides
 To not lose the field values, submit the form.
Well thats kind of what I hoped to avoid

 To update just one field, you can create an event and trigger and handle  
 it with a little bit of custom JavaScript and the JSON classes in Tapestry.
If this is the best approach then can someone suggest an example please

Cheers,
Peter


- Original Message -
From: Thiago H. de Paula Figueiredo thiag...@gmail.com
To: Tapestry users users@tapestry.apache.org
Sent: Friday, 23 July, 2010 15:49:03 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: Re: Zoneupdater mixin best practice

On Fri, 23 Jul 2010 07:40:18 -0300, Peter Stavrinides  
p.stavrini...@albourne.com wrote:

 Hi all,

Hi!

 To be more specific, I am using the Zoneupdater (code below) with a zone  
 that encloses a form, and the form encloses several textfields. For my  
 use case I only want to target one specific form element but don't know  
 how to avoid the zone refreshing everything. I.e.: As it stands now, any  
 input in other fields in the form is lost whenever I make a selection  
 from the drop down menu due to the zone update, is there another way?

To not lose the field values, submit the form.

To update just one field, you can create an event and trigger and handle  
it with a little bit of custom JavaScript and the JSON classes in Tapestry.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


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



Jumpstart AssetProtectionFilter and Chenillekit Rich Editor

2010-07-23 Thread abangkis
Hello, I've emplemented jumpstart AssetProtectionFilter in my
application. And add the list bellow as the white list

final HashSetString ASSETS_WHITE_LIST = new
HashSetString(Arrays.asList(jpg, jpeg, png, gif, js,
css, ico, apk));

I have a page that uses ChenilleKit  Rich Editor component. When ever
i'm accessing that page, the CK editor component will show the denied
page instead the rich component (other fields without the CK component
is OK). If i remove the CK component, the page work just fine. My
guess is i'm still missing some of the resource but couldn't figure it
out what is the resource.

Thanks for the help

Cheers,

Abangkis

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



Re: blackbird.js and IE breaking fixed CSS background image

2010-07-23 Thread Rich

Sure, here is the current code from AppModule and MyClientInfrastructure.

AppModule

|public static ClientInfrastructure
   decorateClientInfrastructure(@InjectService(ClientInfrastructure) 
@Core

   ClientInfrastructure original, @InjectService(AssetSource) AssetSource
   assetSource) {
   return new MyClientInfrastructure(original, assetSource);
   }|

MyClientInfrastructure

|public class MyClientInfrastructure implements ClientInfrastructure {

   private ClientInfrastructure clientInfrastructure;
   @Inject private AssetSource assetSource;
   private List jsStack = new ArrayList();
  
   public MyClientInfrastructure(ClientInfrastructure original, 
AssetSource asource){
   this.assetSource = asource;   
   this.clientInfrastructure = original;
  
   System.out.println(ClientInfrastructure -  + 
clientInfrastructure);
  
   List assets = this.clientInfrastructure.getJavascriptStack();

   for (Iterator i = assets.iterator(); i.hasNext();) {
   Asset asset = (Asset) i.next();
   if (!asset.toString().contains(blackbird.js)) {
   jsStack.add(asset);
   } else {
   jsStack.add(assetSource.getAsset(null, 
context:/scripts/blackbird_1_0/blackbird.js, null));

   }
 
   }

   }
  
   public ListAsset getJavascriptStack() {

   return jsStack;
   }

   public ListAsset getStylesheetStack() {
   return clientInfrastructure.getStylesheetStack();
   }

}

|||At this point I still get a recursion issue on ClientInfrastructure 
class. I chose this permutation because that recursion seems potentially 
'easier' to solve than one on Alias or AliasOverrides.


-Rich

Robert Zeigler wrote:

Hey Rich,

Can you post the code for your various attempts? I know you said earlier you were having issues posting the code... if it still fails, you can try e-mailing me directly with the code. 
In any event, if you're basing your code on Jim's code that he posted below, the main thing that stands out to me is that messing with AliasOverrides is tricky because it's used in /so/ many places, particularly if you're not /very/ explicit about which service you want to inject.  One thing you could try is to mark, as appropriate, the various injections of the ClientInfrastructure with @Core or @Local, as the case may be: when you want tapestry's native service injected, use @Core; when you want your version of the service, use @Local.  You might try that and see if it helps with the issues where tapestry is complaining about recursion.  Theoretically, specifying the serviceid (@InjectService(somesersviceid)) should be sufficient, as well, but I've found I have better success using the Marker annotations.


HTH

Robert

On Jul 22, 2010, at 7/223:30 PM , Rich wrote:

  

No problem, I appreciate the time and effort. I've got the code using Tapestry 
1.5.0.5. I suppose this isn't the biggest bug in the world and with 5.2 on the 
horizon it might be worth just waiting, but I've also got my curiosity piqued 
as to the whole service decoration stuff now. I'm still trying to be able to 
intelligibly build on tapestry rather than just using it, and concepts like 
this seem to be vital components to that progress.

Regards,
Rich

Jim O'Callaghan wrote:


Sorry I can't be of more help Rich - we've migrated over to T5.2.0 so I
don't have a pre T5.2.0 environment I can test this under at the moment.
You're right though it shouldn't be difficult at all - I've found a lot of
these minor things have me banging my head on the desk until someone chips
in with the solution, before having the 'ahhh' moment.  Hopefully someone
here can steer you straight - what exact version of Tapestry are you using?

Regards,
Jim.

-Original Message-
From: Rich [mailto:rich...@moremagic.com] Sent: 22 July 2010 20:51
To: Tapestry users
Subject: Re: blackbird.js and IE breaking fixed CSS background image

No luck still =/

I tried it many ways:
decorateClientInfrastructure with contributeAliasOverride with bind:
java.lang.IllegalStateException: Construction of service 'AliasOverrides' has 
failed due to recursion: the service depends on itself in some way. Please 
check org.apache.tapestry5.internal.services.AliasManagerImpl(Logger, 
Collection) (at AliasManagerImpl.java:32) via 
org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at 
TapestryModule.java:251) for references to another service that is itself 
dependent on service 'AliasOverrides'.

decorateClientInfrastructure without contributeAliasOverride without bind:
java.lang.IllegalStateException: Construction of service 'ClientInfrastructure' 
has failed due to recursion: the service depends on itself in some way. Please 
check 
org.apache.tapestry5.internal.services.ClientInfrastructureImpl(SymbolSource
, AssetSource, ThreadLocale) (at ClientInfrastructureImpl.java:64) via 
org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) (at 
TapestryModule.java:251) for 

Re: blackbird.js and IE breaking fixed CSS background image

2010-07-23 Thread Rich
Whoops. Seems I spoke too soon. After looking at that code out of 
context it looked like the @InjectService and @Core are at stakes in the 
AppModule, and removing @InjectService allowed @Core to resolve through 
properly. Seems to be working alright now. Thanks Jim and Robert for the 
help.


Regards,
Rich

Rich wrote:

Sure, here is the current code from AppModule and MyClientInfrastructure.

AppModule

|public static ClientInfrastructure
   decorateClientInfrastructure(@InjectService(ClientInfrastructure) 
@Core
   ClientInfrastructure original, @InjectService(AssetSource) 
AssetSource

   assetSource) {
   return new MyClientInfrastructure(original, assetSource);
   }|

MyClientInfrastructure

|public class MyClientInfrastructure implements ClientInfrastructure {

   private ClientInfrastructure clientInfrastructure;
   @Inject private AssetSource assetSource;
   private List jsStack = new ArrayList();
 public MyClientInfrastructure(ClientInfrastructure original, 
AssetSource asource){
   this.assetSource = asource;  this.clientInfrastructure 
= original;
 System.out.println(ClientInfrastructure -  + 
clientInfrastructure);
 List assets = 
this.clientInfrastructure.getJavascriptStack();

   for (Iterator i = assets.iterator(); i.hasNext();) {
   Asset asset = (Asset) i.next();
   if (!asset.toString().contains(blackbird.js)) {
   jsStack.add(asset);
   } else {
   jsStack.add(assetSource.getAsset(null, 
context:/scripts/blackbird_1_0/blackbird.js, null));

   }
}
   }
 public ListAsset getJavascriptStack() {
   return jsStack;
   }

   public ListAsset getStylesheetStack() {
   return clientInfrastructure.getStylesheetStack();
   }

}

|||At this point I still get a recursion issue on ClientInfrastructure 
class. I chose this permutation because that recursion seems 
potentially 'easier' to solve than one on Alias or AliasOverrides.


-Rich

Robert Zeigler wrote:

Hey Rich,

Can you post the code for your various attempts? I know you said 
earlier you were having issues posting the code... if it still fails, 
you can try e-mailing me directly with the code. In any event, if 
you're basing your code on Jim's code that he posted below, the main 
thing that stands out to me is that messing with AliasOverrides is 
tricky because it's used in /so/ many places, particularly if you're 
not /very/ explicit about which service you want to inject.  One 
thing you could try is to mark, as appropriate, the various 
injections of the ClientInfrastructure with @Core or @Local, as the 
case may be: when you want tapestry's native service injected, use 
@Core; when you want your version of the service, use @Local.  You 
might try that and see if it helps with the issues where tapestry is 
complaining about recursion.  Theoretically, specifying the serviceid 
(@InjectService(somesersviceid)) should be sufficient, as well, but 
I've found I have better success using the Marker annotations.


HTH

Robert

On Jul 22, 2010, at 7/223:30 PM , Rich wrote:

 
No problem, I appreciate the time and effort. I've got the code 
using Tapestry 1.5.0.5. I suppose this isn't the biggest bug in the 
world and with 5.2 on the horizon it might be worth just waiting, 
but I've also got my curiosity piqued as to the whole service 
decoration stuff now. I'm still trying to be able to intelligibly 
build on tapestry rather than just using it, and concepts like this 
seem to be vital components to that progress.


Regards,
Rich

Jim O'Callaghan wrote:
   
Sorry I can't be of more help Rich - we've migrated over to T5.2.0 
so I
don't have a pre T5.2.0 environment I can test this under at the 
moment.
You're right though it shouldn't be difficult at all - I've found a 
lot of
these minor things have me banging my head on the desk until 
someone chips
in with the solution, before having the 'ahhh' moment.  Hopefully 
someone
here can steer you straight - what exact version of Tapestry are 
you using?


Regards,
Jim.

-Original Message-
From: Rich [mailto:rich...@moremagic.com] Sent: 22 July 2010 20:51
To: Tapestry users
Subject: Re: blackbird.js and IE breaking fixed CSS background image

No luck still =/

I tried it many ways:
decorateClientInfrastructure with contributeAliasOverride with bind:
java.lang.IllegalStateException: Construction of service 
'AliasOverrides' has failed due to recursion: the service depends 
on itself in some way. Please check 
org.apache.tapestry5.internal.services.AliasManagerImpl(Logger, 
Collection) (at AliasManagerImpl.java:32) via 
org.apache.tapestry5.services.TapestryModule.bind(ServiceBinder) 
(at TapestryModule.java:251) for references to another service that 
is itself dependent on service 'AliasOverrides'.


decorateClientInfrastructure without contributeAliasOverride 
without bind:
java.lang.IllegalStateException: Construction of service 
'ClientInfrastructure' 

Re: T5.1.05 always runing slowly when it handle the page requests

2010-07-23 Thread cleverpig
yes,of course.but there is nothing,I had changed tow host,the problem keeps.

On Fri, Jul 23, 2010 at 8:50 PM, Thiago H. de Paula Figueiredo
thiag...@gmail.com wrote:
 On Fri, 23 Jul 2010 04:38:15 -0300, cleverpig greatclever...@gmail.com
 wrote:

 In dev environment,everything is okay.
 But in product environment,T5 takes 14~15 second almostly to handle
 one page request!

 Have you checked if the bottleneck is elsewhere? In the database access or a
 server with other high CPU or I/O apps, for example? I never had this
 problem.

 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
 instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br

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





-- 
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liu...@hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: cleverpig.name/dan/
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
or...@facebook: http://www.facebook.com/group.php?gid=8159558294

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



Re: blackbird.js and IE breaking fixed CSS background image

2010-07-23 Thread Robert Zeigler
A few comments:

1) You have AssetSource in your constructor definition, but you also seem to 
have the field marked with @Inject in your implementation; any particular 
reason? If you're injecting via constructor injection, you shouldn't need the 
@Inject annotation on the service field.

2) looking at this now, I'm surprised you need the marker at all in your 
decorate method. Normally, decorate will pass in a handle to the original 
service implementation.

3) The recursion is caused by the injection of AssetSource, which, itself, 
depends on cilentinfrastructure. Glad to hear that using the marker annotations 
fixed things.

4) Sorry, I jumped into this thread late, but, if all you're looking to do is 
to override the version/location of blackbird, there's a much easier way to do 
it. :)

Tapestry resolves the blackbird location via symbol. Check out these lines in 
AppModule:

public static void contributeFactoryDefaults(MappedConfigurationString, 
String configuration)
{
 ...
configuration.add(tapestry.blackbird.path, 
org/apache/tapestry5/blackbird_1_0);
configuration.add(tapestry.blackbird, 
classpath:${tapestry.blackbird.path});
 ...
}

You can easily override those values (the most important one is 
tapestry.blackbird, since that is the symbol tapestry uses everywhere else to 
resolve the component library):

public static void contributeApplicationDefaults(MappedConfigurationString, 
String configuration) 
{
configuration.add(tapestry.blackbird, 
context:/scripts/blackbird_1_0/blackbird.js);
}

Voila!  No nasty recursions, no services to implement, now tapestry uses your 
customized version of blackbird.

Cheers!

Robert

On Jul 23, 2010, at 7/239:24 AM , Rich wrote:

 Whoops. Seems I spoke too soon. After looking at that code out of context it 
 looked like the @InjectService and @Core are at stakes in the AppModule, and 
 removing @InjectService allowed @Core to resolve through properly. Seems to 
 be working alright now. Thanks Jim and Robert for the help.
 
 Regards,
 Rich
 
 Rich wrote:
 Sure, here is the current code from AppModule and MyClientInfrastructure.
 
 AppModule
 
 |public static ClientInfrastructure
   decorateClientInfrastructure(@InjectService(ClientInfrastructure) @Core
   ClientInfrastructure original, @InjectService(AssetSource) AssetSource
   assetSource) {
   return new MyClientInfrastructure(original, assetSource);
   }|
 
 MyClientInfrastructure
 
 |public class MyClientInfrastructure implements ClientInfrastructure {
 
   private ClientInfrastructure clientInfrastructure;
   @Inject private AssetSource assetSource;
   private List jsStack = new ArrayList();
 public MyClientInfrastructure(ClientInfrastructure original, AssetSource 
 asource){
   this.assetSource = asource;  this.clientInfrastructure = 
 original;
 System.out.println(ClientInfrastructure -  + 
 clientInfrastructure);
 List assets = this.clientInfrastructure.getJavascriptStack();
   for (Iterator i = assets.iterator(); i.hasNext();) {
   Asset asset = (Asset) i.next();
   if (!asset.toString().contains(blackbird.js)) {
   jsStack.add(asset);
   } else {
   jsStack.add(assetSource.getAsset(null, 
 context:/scripts/blackbird_1_0/blackbird.js, null));
   }
}
   }
 public ListAsset getJavascriptStack() {
   return jsStack;
   }
 
   public ListAsset getStylesheetStack() {
   return clientInfrastructure.getStylesheetStack();
   }
 
 }
 
 |||At this point I still get a recursion issue on ClientInfrastructure 
 class. I chose this permutation because that recursion seems potentially 
 'easier' to solve than one on Alias or AliasOverrides.
 
 -Rich
 
 Robert Zeigler wrote:
 Hey Rich,
 
 Can you post the code for your various attempts? I know you said earlier 
 you were having issues posting the code... if it still fails, you can try 
 e-mailing me directly with the code. In any event, if you're basing your 
 code on Jim's code that he posted below, the main thing that stands out to 
 me is that messing with AliasOverrides is tricky because it's used in /so/ 
 many places, particularly if you're not /very/ explicit about which service 
 you want to inject.  One thing you could try is to mark, as appropriate, 
 the various injections of the ClientInfrastructure with @Core or @Local, as 
 the case may be: when you want tapestry's native service injected, use 
 @Core; when you want your version of the service, use @Local.  You might 
 try that and see if it helps with the issues where tapestry is complaining 
 about recursion.  Theoretically, specifying the serviceid 
 (@InjectService(somesersviceid)) should be sufficient, as well, but I've 
 found I have better success using the Marker annotations.
 
 HTH
 
 Robert
 
 On Jul 22, 2010, at 7/223:30 PM , Rich wrote:
 
 
 No problem, I appreciate the time and effort. I've got the code using 
 

Re: Zoneupdater mixin best practice

2010-07-23 Thread Stefan Hagström
Hi, i just recently implemented a similar solution with Jquery


jQuery(document).ready(function() {



jQuery(#county).change(function(){

 var county = jQuery(this).val();



// Send the request and update sub category dropdown

jQuery.ajax({

type: GET,

data: post_string,

dataType: json,

cache: false,

url: '/kalender/servlet/data?action=municipalitycounty='
+county,

timeout: 2,

error: function() {

alert(An error occured: +county);

},

success: function(data) {

// Clear all options from sub category select

jQuery(select#municipality option).remove();



// Fill sub category select

jQuery.each(data, function(i, j){



var row = option value=\ + j.value + \ + j.text
+ /option;

jQuery(row).appendTo(select#municipality);

});

}

});

 });

});

Whenever the select box with id=county is changed, the select box with id
#municipality is populated.
Not a full solution to your problem, but you get the idea.


/Stefan



2010/7/23 Peter Stavrinides p.stavrini...@albourne.com

  To not lose the field values, submit the form.
 Well thats kind of what I hoped to avoid

  To update just one field, you can create an event and trigger and handle
  it with a little bit of custom JavaScript and the JSON classes in
 Tapestry.
 If this is the best approach then can someone suggest an example please

 Cheers,
 Peter


 - Original Message -
 From: Thiago H. de Paula Figueiredo thiag...@gmail.com
 To: Tapestry users users@tapestry.apache.org
 Sent: Friday, 23 July, 2010 15:49:03 GMT +02:00 Athens, Beirut, Bucharest,
 Istanbul
 Subject: Re: Zoneupdater mixin best practice

 On Fri, 23 Jul 2010 07:40:18 -0300, Peter Stavrinides
 p.stavrini...@albourne.com wrote:

  Hi all,

 Hi!

  To be more specific, I am using the Zoneupdater (code below) with a zone
  that encloses a form, and the form encloses several textfields. For my
  use case I only want to target one specific form element but don't know
  how to avoid the zone refreshing everything. I.e.: As it stands now, any
  input in other fields in the form is lost whenever I make a selection
  from the drop down menu due to the zone update, is there another way?

 To not lose the field values, submit the form.

 To update just one field, you can create an event and trigger and handle
 it with a little bit of custom JavaScript and the JSON classes in Tapestry.

 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
 and instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br

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


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




Re: T5: CMS integration - multiple templates single controller?

2010-07-23 Thread Adam Zimowski
Okay having to try both suggestions I'm finding that requirement of a
component class is what's making this simple requirement a difficult
excercise. I was able to get templates to load from a different
location on the filesystem, but that's not really my requirement.

Here is a very simplified scenario that would totally solve my problem:

* Basically all our CMS pages are static, so the controller class
would have been an empty Java class:

public class Page1 {}
public class Page2 {}
etc etc

We are totally fine with WAR based package structure

our.app.pages.cms

where all static pages go to cms package.

So to simplify my problem, all I really need is a way for Tapestry to
load all my pages in the cms package, without a Java class with a safe
assumption that it would have been empty one.

So is there a way to make Tapestry process a template without a Java
class? That's really, all I need.

Adam

On Wed, Jul 21, 2010 at 5:19 PM, Howard Lewis Ship hls...@gmail.com wrote:
 I've managed to get more of the docs working, including Javadoc, but
 not the component report yet.

 http://tapestry.formos.com/nightly/tapx/


 On Wed, Jul 21, 2010 at 11:26 AM, Adam Zimowski zimowsk...@gmail.com wrote:
 Thank you much Guys. This is definitely giving me ways to explore. I
 will share our solution when it's ready, but may post some questions
 first :)

 On Wed, Jul 21, 2010 at 11:35 AM, Thiago H. de Paula Figueiredo
 thiag...@gmail.com wrote:
 Take a look at these past discussions:

 http://old.nabble.com/Tapestry-Templates-%2B-Scripting-Language-(CMS)-to27191065s302.html#a27191192
 http://old.nabble.com/How-to-load-tml-files-from-the-filesystem-instead-of-classpath--tp28462363s302p28469434.html


 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
 instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br

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



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





 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

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

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

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



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



Re: T5: CMS integration - multiple templates single controller?

2010-07-23 Thread Thiago H. de Paula Figueiredo
On Fri, 23 Jul 2010 13:26:03 -0300, Adam Zimowski zimowsk...@gmail.com  
wrote:



So is there a way to make Tapestry process a template without a Java
class? That's really, all I need.


No. On the other hand, you can have a Tapestry page to render different  
output based on activaction context or query parameters.


If I had to implement a CMS, I would use a template engine like  
Freemarker, a WYSOWYG HTML editor like FCKeditor or even some wiki-like  
language to let users edit what they want and Tapestry for the rest.


Tapestry templates were designed to be used by developers, not end users.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



T5 AppModule best practice

2010-07-23 Thread cleverpig
Let's share a lot of that which was used in your project?

I've been looking for documentation about how the AppModule class works.
Sadly, I have only found a few examples of bind/contribute and build
methods, but nothing that explains when and what to use.

It sounds bad for newbies.

PS:
http://tapestry.apache.org/tapestry5/tapestry-ioc/index.html is too
little practice code.
-- 
cleverpig(Dan)
Location: Beijing
Address: Room 4018,No.A2 South Avenue Fuxingmen Beijing,P.R.China
Zipcode: 100031
MSN: great_liu...@hotmail.com
QQ: 149291732
Skype: cleverpigatmatrix
Facebook ID:cleverpig
Blog: cleverpig.name/dan/
Tags: del.icio.us/cleverpig
Twitter: twitter.com/cleverpig
新浪微博: t.sina.com.cn/cleverpig
Organization: www.beijing-open-party.org
or...@facebook: http://www.facebook.com/group.php?gid=8159558294

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



Re: T5: CMS integration - multiple templates single controller?

2010-07-23 Thread Adam Zimowski
I guess worst case scenario we can precompile these empty classes
during our publishing process. Need to verify if that will work but
that would be the work around.


On Fri, Jul 23, 2010 at 11:26 AM, Adam Zimowski zimowsk...@gmail.com wrote:
 Okay having to try both suggestions I'm finding that requirement of a
 component class is what's making this simple requirement a difficult
 excercise. I was able to get templates to load from a different
 location on the filesystem, but that's not really my requirement.

 Here is a very simplified scenario that would totally solve my problem:

 * Basically all our CMS pages are static, so the controller class
 would have been an empty Java class:

 public class Page1 {}
 public class Page2 {}
 etc etc

 We are totally fine with WAR based package structure

 our.app.pages.cms

 where all static pages go to cms package.

 So to simplify my problem, all I really need is a way for Tapestry to
 load all my pages in the cms package, without a Java class with a safe
 assumption that it would have been empty one.

 So is there a way to make Tapestry process a template without a Java
 class? That's really, all I need.

 Adam

 On Wed, Jul 21, 2010 at 5:19 PM, Howard Lewis Ship hls...@gmail.com wrote:
 I've managed to get more of the docs working, including Javadoc, but
 not the component report yet.

 http://tapestry.formos.com/nightly/tapx/


 On Wed, Jul 21, 2010 at 11:26 AM, Adam Zimowski zimowsk...@gmail.com wrote:
 Thank you much Guys. This is definitely giving me ways to explore. I
 will share our solution when it's ready, but may post some questions
 first :)

 On Wed, Jul 21, 2010 at 11:35 AM, Thiago H. de Paula Figueiredo
 thiag...@gmail.com wrote:
 Take a look at these past discussions:

 http://old.nabble.com/Tapestry-Templates-%2B-Scripting-Language-(CMS)-to27191065s302.html#a27191192
 http://old.nabble.com/How-to-load-tml-files-from-the-filesystem-instead-of-classpath--tp28462363s302p28469434.html


 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, 
 and
 instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br

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



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





 --
 Howard M. Lewis Ship

 Creator of Apache Tapestry

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

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

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




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



Re: T5: CMS integration - multiple templates single controller?

2010-07-23 Thread Thiago H. de Paula Figueiredo
On Fri, 23 Jul 2010 13:31:59 -0300, Adam Zimowski zimowsk...@gmail.com  
wrote:



I guess worst case scenario we can precompile these empty classes
during our publishing process. Need to verify if that will work but
that would be the work around.


Why not having a single page class that loads the content to be rendered  
according to activation context or query parameters?


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: T5: CMS integration - multiple templates single controller?

2010-07-23 Thread Thiago H. de Paula Figueiredo
On Fri, 23 Jul 2010 13:45:57 -0300, Adam Zimowski zimowsk...@gmail.com  
wrote:



I was thinking about that Thiago :) In fact, that's about how we do it
currently with Struts. I'm going to give this a try today.


Struts is a completely different beast when compared to Tapestry, so most  
of the approaches used in one don't apply to the other.


--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: T5: CMS integration - multiple templates single controller?

2010-07-23 Thread Robert Zeigler
That's how I've done it in the past.  With URL rewriting, this can be made even 
nicer in that you can map your more complicated url (with extra 
parameters/pathinfo) to a simpler url, and vice versa

Robert

On Jul 23, 2010, at 7/2311:45 AM , Adam Zimowski wrote:

 I was thinking about that Thiago :) In fact, that's about how we do it
 currently with Struts. I'm going to give this a try today.
 
 Adam
 
 On Fri, Jul 23, 2010 at 11:37 AM, Thiago H. de Paula Figueiredo
 thiag...@gmail.com wrote:
 On Fri, 23 Jul 2010 13:31:59 -0300, Adam Zimowski zimowsk...@gmail.com
 wrote:
 
 I guess worst case scenario we can precompile these empty classes
 during our publishing process. Need to verify if that will work but
 that would be the work around.
 
 Why not having a single page class that loads the content to be rendered
 according to activation context or query parameters?
 
 --
 Thiago H. de Paula Figueiredo
 Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and
 instructor
 Owner, Ars Machina Tecnologia da Informação Ltda.
 http://www.arsmachina.com.br
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org


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



Re: T5: CMS integration - multiple templates single controller?

2010-07-23 Thread Michael Gentry
On Fri, Jul 23, 2010 at 12:51 PM, Thiago H. de Paula Figueiredo
thiag...@gmail.com wrote:
 Struts is a completely different beast when compared to Tapestry, so most of
 the approaches used in one don't apply to the other.

I think that's why we are here, Thiago.  :-)

mrg

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



Re: Jumpstart AssetProtectionFilter and Chenillekit Rich Editor

2010-07-23 Thread abangkis
Okay, i found it. Turn out i need to add html and xml to the white
list. But since it will defeat the purpose of the filter, i think the
correct approach is add another test in the asset protection filter to
allow any path that contains chenillekit. In case someone else face
the same problem as me.


Cheers,

Abangkis

On Fri, Jul 23, 2010 at 9:08 PM, abangkis abang...@gmail.com wrote:
 Hello, I've emplemented jumpstart AssetProtectionFilter in my
 application. And add the list bellow as the white list

                final HashSetString ASSETS_WHITE_LIST = new
 HashSetString(Arrays.asList(jpg, jpeg, png, gif, js,
                                css, ico, apk));

 I have a page that uses ChenilleKit  Rich Editor component. When ever
 i'm accessing that page, the CK editor component will show the denied
 page instead the rich component (other fields without the CK component
 is OK). If i remove the CK component, the page work just fine. My
 guess is i'm still missing some of the resource but couldn't figure it
 out what is the resource.

 Thanks for the help

 Cheers,

 Abangkis


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



Re: T5: CMS integration - multiple templates single controller?

2010-07-23 Thread Adam Zimowski
Tapestry never disappoints! Single page loading content from
activation context is so simple and easy, it just feels like the right
way to go!

Here is what I've got which pretty much works. Static publishable
content wrapped around a layout. Few questions regarding possible
improvements:

* Is there anything fundamentally wrong with what I have (I haven't
coded Tapestry in years)?
* Is there a better way to store file content (cache?). Not sure if
reading it on each access is the right way to go.
* I supposed I need to look for the right file name myself based on
the locale? page1.html page1_fr.html etc etc. We do that currently, so
no problem if not, but checking if there is any helpful utility
resolver out there?

my.app.tapestry.components
public class Cms {

@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
private String target;

@Inject
private Locale locale;

@Inject
private Logger log;

@BeginRender
void renderMessage(MarkupWriter writer) {

log.debug(locale.toString());

File f = new File(cms/ + target + .html);
try {
String s = FileUtils.readFileToString(f);
writer.writeRaw(s);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
writer.writeRaw(bERROR/b reading file);
}
}
}

my.app.tapestry.pages
public class Info {

@SuppressWarnings(unused)
@Property(write=false)
private String target;


void onActivate(String aParam) {
target = aParam;
}
}

Info.tml
t:layout xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
t:cms t:target=${target}/
/t:layout

projectRoot/cms/
 - page1.html

Requesting 127.0.0.1/info/page1.html   works like a charm :)

Adam


On Fri, Jul 23, 2010 at 12:51 PM, Michael Gentry mgen...@masslight.net wrote:
 On Fri, Jul 23, 2010 at 12:51 PM, Thiago H. de Paula Figueiredo
 thiag...@gmail.com wrote:
 Struts is a completely different beast when compared to Tapestry, so most of
 the approaches used in one don't apply to the other.

 I think that's why we are here, Thiago.  :-)

 mrg

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



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



Re: blackbird.js and IE breaking fixed CSS background image

2010-07-23 Thread Rich

Robert Zeigler wrote:

A few comments:

1) You have AssetSource in your constructor definition, but you also seem to have the 
field marked with @Inject in your implementation; any particular reason? If you're 
injecting via constructor injection, you shouldn't need the @Inject 
annotation on the service field.

  
Nope, result of mixing different versions of Jim's code by accident 
after I gave up on my own implementation. If someone else says it works 
I'll take their word for it until it breaks, but yes that @Inject did 
not make any sense thanks for pointing it out.

2) looking at this now, I'm surprised you need the marker at all in your 
decorate method. Normally, decorate will pass in a handle to the original 
service implementation.
3) The recursion is caused by the injection of AssetSource, which, itself, 
depends on cilentinfrastructure. Glad to hear that using the marker annotations 
fixed things.

4) Sorry, I jumped into this thread late, but, if all you're looking to do is 
to override the version/location of blackbird, there's a much easier way to do 
it. :)

Tapestry resolves the blackbird location via symbol. Check out these lines in 
AppModule:

public static void contributeFactoryDefaults(MappedConfigurationString, 
String configuration)
{
 ...
configuration.add(tapestry.blackbird.path, 
org/apache/tapestry5/blackbird_1_0);
configuration.add(tapestry.blackbird, 
classpath:${tapestry.blackbird.path});
 ...
}

You can easily override those values (the most important one is 
tapestry.blackbird, since that is the symbol tapestry uses everywhere else to 
resolve the component library):

public static void contributeApplicationDefaults(MappedConfigurationString, String configuration) 
{

configuration.add(tapestry.blackbird, 
context:/scripts/blackbird_1_0/blackbird.js);
  
yay, just what i was looking for. One minor adjustment though is that it 
thinks blackbird.js is a directory not a file, so I had to copy all of 
the blackbird files to /scripts/blackbird_1_0/ to get it to load 
properly, but that was an easy fix.

}

Voila!  No nasty recursions, no services to implement, now tapestry uses your 
customized version of blackbird.

Cheers!

Robert
  


Thanks!

Rich


On Jul 23, 2010, at 7/239:24 AM , Rich wrote:

  

Whoops. Seems I spoke too soon. After looking at that code out of context it 
looked like the @InjectService and @Core are at stakes in the AppModule, and 
removing @InjectService allowed @Core to resolve through properly. Seems to be 
working alright now. Thanks Jim and Robert for the help.

Regards,
Rich

Rich wrote:


Sure, here is the current code from AppModule and MyClientInfrastructure.

AppModule

|public static ClientInfrastructure
  decorateClientInfrastructure(@InjectService(ClientInfrastructure) @Core
  ClientInfrastructure original, @InjectService(AssetSource) AssetSource
  assetSource) {
  return new MyClientInfrastructure(original, assetSource);
  }|

MyClientInfrastructure

|public class MyClientInfrastructure implements ClientInfrastructure {

  private ClientInfrastructure clientInfrastructure;
  @Inject private AssetSource assetSource;
  private List jsStack = new ArrayList();
public MyClientInfrastructure(ClientInfrastructure original, AssetSource 
asource){
  this.assetSource = asource;  this.clientInfrastructure = original;
System.out.println(ClientInfrastructure -  + 
clientInfrastructure);
List assets = this.clientInfrastructure.getJavascriptStack();
  for (Iterator i = assets.iterator(); i.hasNext();) {
  Asset asset = (Asset) i.next();
  if (!asset.toString().contains(blackbird.js)) {
  jsStack.add(asset);
  } else {
  jsStack.add(assetSource.getAsset(null, 
context:/scripts/blackbird_1_0/blackbird.js, null));
  }
   }
  }
public ListAsset getJavascriptStack() {
  return jsStack;
  }

  public ListAsset getStylesheetStack() {
  return clientInfrastructure.getStylesheetStack();
  }

}

|||At this point I still get a recursion issue on ClientInfrastructure class. I 
chose this permutation because that recursion seems potentially 'easier' to 
solve than one on Alias or AliasOverrides.

-Rich

Robert Zeigler wrote:
  

Hey Rich,

Can you post the code for your various attempts? I know you said earlier you were having 
issues posting the code... if it still fails, you can try e-mailing me directly with the 
code. In any event, if you're basing your code on Jim's code that he posted below, the 
main thing that stands out to me is that messing with AliasOverrides is tricky because 
it's used in /so/ many places, particularly if you're not /very/ explicit about which 
service you want to inject.  One thing you could try is to mark, as appropriate, the 
various injections of the ClientInfrastructure with @Core or @Local, as the case may be: 
when you want tapestry's native service