Re: T5 and Ember

2015-03-24 Thread Kalle Korhonen
On Tue, Mar 24, 2015 at 7:24 AM, Andreas Andreou  wrote:

> After having worked for more almost 2 years on (mostly) ember,
> my advice would be to completely decouple (if possible) the projects.
>
> Move ember on its own, make use of the improving cli plugins for
> developing,
> building and deploying. I'm still on a yeoman created grunt setup, so that
> could
> also work for you.
>

Yes, that's certainly an option and that's how I've approached the
prototype, but this strategy doesn't work quite as well if you are
releasing to a customer as opposed to developing company's own site where
you typically already have an http server to deploy the Ember bits to. And
if you have to figure out packaging into a .war anyway, then might make
sense to use a similar setup for development as well. In any case, thanks
for the advice. I bet the framework has changed quite a bit in your two
years. I wonder if your experience has been a positive one and if there are
any "I wish I had known this before we started" tidbits you could share.

@Ivano - if popularity was a measure, we'd all be still using Struts
instead of Tapestry, wouldn't we? Convention over configuration is one
thing, but the article you linked to is a fairly well balanced in my
opinion. For me, the biggest things to like in Ember is it's router, clean
urls, cleaner/simpler concepts and performance.

Kalle


>
>
> On Tue, Mar 24, 2015 at 5:50 AM, Kalle Korhonen <
> kalle.o.korho...@gmail.com>
> wrote:
>
> > As an experiment, I'm trying to migrate an existing Angular app to Ember
> > (with T5 back-end and serving multiple other "thin" pages). There's a lot
> > to like in Ember vs Angular but I'm wondering if there are anybody else
> > using Ember with T5 and if so, what's your setup? I'm mainly interested
> in
> > knowing if you've managed to integrate wro4j's EmberJsProcessor or
> perhaps
> > you have just overlaid an ember-cli setup over T5 folder structure? Also,
> > I'd especially like to know how you handle third-party components if you
> > are using any. Installing snippets using npm and ember-cli seems like a
> > great idea but I find a lot of outdated and broken stuff. I'm using the
> > very latest, the ember-cli 0.2.1 released today (I was battling issues
> with
> > the previous 0.2.0 release over the weekend) and ember 1.10.0. Perhaps
> I'm
> > pushing too far on the bleeding edge... if you've gone done this path,
> I'd
> > appreciate some war stories for things to watch out for.
> >
> > Kalle
> >
>
>
>
> --
> Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
> Apache Tapestry PMC / http://chesstu.be owner
> Open Source / JS Consulting
>


Re: T5 and Ember

2015-03-24 Thread Andreas Andreou
Kalle,
After having worked for more almost 2 years on (mostly) ember,
my advice would be to completely decouple (if possible) the projects.

Move ember on its own, make use of the improving cli plugins for developing,
building and deploying. I'm still on a yeoman created grunt setup, so that
could
also work for you.

Just throw in some cors headers on the tapestry side and you'll be able to
live
code against production data



On Tue, Mar 24, 2015 at 5:50 AM, Kalle Korhonen 
wrote:

> As an experiment, I'm trying to migrate an existing Angular app to Ember
> (with T5 back-end and serving multiple other "thin" pages). There's a lot
> to like in Ember vs Angular but I'm wondering if there are anybody else
> using Ember with T5 and if so, what's your setup? I'm mainly interested in
> knowing if you've managed to integrate wro4j's EmberJsProcessor or perhaps
> you have just overlaid an ember-cli setup over T5 folder structure? Also,
> I'd especially like to know how you handle third-party components if you
> are using any. Installing snippets using npm and ember-cli seems like a
> great idea but I find a lot of outdated and broken stuff. I'm using the
> very latest, the ember-cli 0.2.1 released today (I was battling issues with
> the previous 0.2.0 release over the weekend) and ember 1.10.0. Perhaps I'm
> pushing too far on the bleeding edge... if you've gone done this path, I'd
> appreciate some war stories for things to watch out for.
>
> Kalle
>



-- 
Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr
Apache Tapestry PMC / http://chesstu.be owner
Open Source / JS Consulting


Re: T5 and Ember

2015-03-24 Thread Ivano Luberti
Oh well, reading further I have found the answer by myself:

> Ember.js favors Convention over Configuration. 

sorry Kalle


Il 24/03/2015 12:00, Ivano Luberti ha scritto:
> Hi Kalle, I don't know a thing about Ember and Angular but I plan to
> learn about javascript frameworks. Hence I don't have an answer for you
> but a question instead (of course totally OT on this list).
>
> First link I get from google searching for "ember angular" is
>
> https://www.airpair.com/js/javascript-framework-comparison
>
> that is a very angular partizan article in reality.
> Maybe explanation on why is the first result is this contained phrase:
>
>> Not only does Angular have the largest community and much more online
>> content than the two others, it is also backed and promoted by Google. 
> Nonetheless motivation for the article to sponsor Angular seem reasonable.
> So question is: what is to like in ember more than in angular?
>
> Il 24/03/2015 04:50, Kalle Korhonen ha scritto:
>> As an experiment, I'm trying to migrate an existing Angular app to Ember
>> (with T5 back-end and serving multiple other "thin" pages). There's a lot
>> to like in Ember vs Angular but I'm wondering if there are anybody else
>> using Ember with T5 and if so, what's your setup? I'm mainly interested in
>> knowing if you've managed to integrate wro4j's EmberJsProcessor or perhaps
>> you have just overlaid an ember-cli setup over T5 folder structure? Also,
>> I'd especially like to know how you handle third-party components if you
>> are using any. Installing snippets using npm and ember-cli seems like a
>> great idea but I find a lot of outdated and broken stuff. I'm using the
>> very latest, the ember-cli 0.2.1 released today (I was battling issues with
>> the previous 0.2.0 release over the weekend) and ember 1.10.0. Perhaps I'm
>> pushing too far on the bleeding edge... if you've gone done this path, I'd
>> appreciate some war stories for things to watch out for.
>>
>> Kalle
>>

-- 
==
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==


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



Re: T5 and Ember

2015-03-24 Thread Ivano Luberti
Hi Kalle, I don't know a thing about Ember and Angular but I plan to
learn about javascript frameworks. Hence I don't have an answer for you
but a question instead (of course totally OT on this list).

First link I get from google searching for "ember angular" is

https://www.airpair.com/js/javascript-framework-comparison

that is a very angular partizan article in reality.
Maybe explanation on why is the first result is this contained phrase:

>
> Not only does Angular have the largest community and much more online
> content than the two others, it is also backed and promoted by Google. 

Nonetheless motivation for the article to sponsor Angular seem reasonable.
So question is: what is to like in ember more than in angular?

Il 24/03/2015 04:50, Kalle Korhonen ha scritto:
> As an experiment, I'm trying to migrate an existing Angular app to Ember
> (with T5 back-end and serving multiple other "thin" pages). There's a lot
> to like in Ember vs Angular but I'm wondering if there are anybody else
> using Ember with T5 and if so, what's your setup? I'm mainly interested in
> knowing if you've managed to integrate wro4j's EmberJsProcessor or perhaps
> you have just overlaid an ember-cli setup over T5 folder structure? Also,
> I'd especially like to know how you handle third-party components if you
> are using any. Installing snippets using npm and ember-cli seems like a
> great idea but I find a lot of outdated and broken stuff. I'm using the
> very latest, the ember-cli 0.2.1 released today (I was battling issues with
> the previous 0.2.0 release over the weekend) and ember 1.10.0. Perhaps I'm
> pushing too far on the bleeding edge... if you've gone done this path, I'd
> appreciate some war stories for things to watch out for.
>
> Kalle
>

-- 
==
dott. Ivano Mario Luberti
Archimede Informatica societa' cooperativa a r. l.
Sede Operativa
Via Gereschi 36 - 56126- Pisa
tel.: +39-050- 580959
tel/fax: +39-050-9711344
web: www.archicoop.it
==



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



Re: [T5] How can I validate if a script is present ?

2014-09-26 Thread Thiago H de Paula Figueiredo
On Fri, 26 Sep 2014 16:12:18 -0300, Carlos Gómez Montiel  
 wrote:


Thank you for your help and support Thiago, I prefer wait to T5.4  
release ;)


You can already try the 5.4-beta-24, which is very close to final.

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

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



RE: [T5] How can I validate if a script is present ?

2014-09-26 Thread Carlos Gómez Montiel
Thank you for your help and support Thiago, I prefer wait to T5.4 release ;)
Regards

-Mensaje original-
De: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com] 
Enviado el: viernes, 26 de septiembre de 2014 01:23 p.m.
Para: Tapestry users
Asunto: Re: [T5] How can I validate if a script is present ?

On Fri, 26 Sep 2014 14:04:01 -0300, Carlos Gómez Montiel  
wrote:

> Hi Thiago

Hi!

> refresh
> 
> 
>  t:parameters="options">
> 

If you had mentioned before you were trying to show it in a Zone update, we 
would have understood the problem earlier. You can use blocks in non-AJAX 
scenarios too.

In your case, using your own code, not the one from tapestry5-jquery, the check 
for whether the Google Maps is already loaded should be part of your own code. 
Not a good solution.

Ultimately the solution is to use Require.js or a similar solution and let it 
handle the client-side dependencies and ensure the loading order of JavaScript 
files. Tapestry 5.4 supports it out-of-the-box.

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

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


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



Re: [T5] How can I validate if a script is present ?

2014-09-26 Thread Thiago H de Paula Figueiredo
On Fri, 26 Sep 2014 14:04:01 -0300, Carlos Gómez Montiel  
 wrote:



Hi Thiago


Hi!


refresh


t:parameters="options">




If you had mentioned before you were trying to show it in a Zone update,  
we would have understood the problem earlier. You can use blocks in  
non-AJAX scenarios too.


In your case, using your own code, not the one from tapestry5-jquery, the  
check for whether the Google Maps is already loaded should be part of your  
own code. Not a good solution.


Ultimately the solution is to use Require.js or a similar solution and let  
it handle the client-side dependencies and ensure the loading order of  
JavaScript files. Tapestry 5.4 supports it out-of-the-box.


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

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



RE: [T5] How can I validate if a script is present ?

2014-09-26 Thread Carlos Gómez Montiel
Hi Thiago

> The component being inside a block (you mean ?) shouldn't make a 
> difference. How are you rendering this block?

Yeap, to simplify the problem, the tapestry5-jquery's GMap component has the 
same problem, with the next code the component renders correctly the google map.

Test.tml

Test.java
public class Test  {
public JSONObject getOptions(){
JSONObject json = new JSONObject();
return json;
}
}

With the next code the GMap component does not render correctly the map after 
you click the refresh link (to show the block).

Test2.tml:
refresh





Test2.java:
public class Test2 {

@Inject
private Block blockResults;

Object onActionFromRefresh() {
return blockResults;
}

public JSONObject getOptions(){
JSONObject json = new JSONObject();
return json;
}
}

When you press refresh link the browser (Chrome) javascript console error is: 
"Failed to execute 'write' on 'Document': It isn't possible to write into a 
document from an asynchronously-loaded external script unless it is explicitly 
opened."


Reference: 
tapestry5-jquery's GMap component source code: 
https://github.com/got5/tapestry5-jquery/blob/master/src/main/java/org/got5/tapestry5/jquery/components/GMap.java

tapestry5-jquery's GMap component example:  http://tapestry5 
jquery.com/components/docsgmap;jsessionid=A5260C324E4C8E97299C0E556621697D.FA4B475DA717#

Thanks in advance

-Mensaje original-
De: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com] 
Enviado el: viernes, 26 de septiembre de 2014 08:20 a.m.
Para: Tapestry users
Asunto: Re: [T5] How can I validate if a script is present ?

On Fri, 26 Sep 2014 01:09:14 -0300, Carlos Gómez Montiel  
wrote:

> Hi Thiago, thank you for your answer :) I'm using Tapestry 5.3.7

Hi!

> Testing it, I have created a file (googlemaps.js) with the content of 
> the url: "https://maps.googleapis.com/maps/api/js?v=3.exp"; and 
> included it inside component:
> @Import(library =
> "classpath:mx/kka/msurvey/web/view/components/maps/googlemaps.js")
> public class GMapShow {
> }

This way (which I suggested, I'm sorry), with the external library included in 
setupRender() and your code that uses it included via @Import, the two JS files 
are included in the wrong order, because @Import is processed before 
setupRender(). Please try this:

@Inject
@Path("classpath:mx/kka/msurvey/web/view/components/maps/googlemaps.js")
private Asset myCode;

public void setupRender() {

javaScriptSupport.importJavaScriptLibrary("https://maps.googleapis.com/maps/api/js?v=3.exp";);
javaScriptSupport.importJavaScriptLibrary(myCode);
)

This will guarantee your code will be included after the Google Maps API.

> But the result is the same, the map is rendered correctly if the 
> component is outside a block but if the component is inside a block, 
> the map is not renderer.

The component being inside a block (you mean ?) shouldn't make a 
difference. How are you rendering this block?

>> That's why we ask people more information and snippets of code when 
>> asking help: the original question in the subject of the message (how 
>> can I validate if a script is present), which, by the way, is 
>> JavaScript-specific, not Tapestry-specific, wouldn't need to be asked.
>
> Ok Thiago, thank you for your feedback.
> I think the question is about tapestry because I need to validate 
> inside a tapestry's component if its parent page contains the string 
> 

Re: [T5] How can I validate if a script is present ?

2014-09-26 Thread Thiago H de Paula Figueiredo
On Fri, 26 Sep 2014 01:09:14 -0300, Carlos Gómez Montiel  
 wrote:



Hi Thiago, thank you for your answer :)
I'm using Tapestry 5.3.7


Hi!

Testing it, I have created a file (googlemaps.js) with the content of  
the url: "https://maps.googleapis.com/maps/api/js?v=3.exp"; and included  
it inside component:
@Import(library =  
"classpath:mx/kka/msurvey/web/view/components/maps/googlemaps.js")

public class GMapShow {
}


This way (which I suggested, I'm sorry), with the external library  
included in setupRender() and your code that uses it included via @Import,  
the two JS files are included in the wrong order, because @Import is  
processed before setupRender(). Please try this:


@Inject
@Path("classpath:mx/kka/msurvey/web/view/components/maps/googlemaps.js")
private Asset myCode;

public void setupRender() {

javaScriptSupport.importJavaScriptLibrary("https://maps.googleapis.com/maps/api/js?v=3.exp";);
javaScriptSupport.importJavaScriptLibrary(myCode);
)

This will guarantee your code will be included after the Google Maps API.

But the result is the same, the map is rendered correctly if the  
component is outside a block but if the component is inside a block, the  
map is not renderer.


The component being inside a block (you mean ?) shouldn't make a  
difference. How are you rendering this block?


That's why we ask people more information and snippets of code when  
asking help: the original question in the subject of the message (how  
can I validate if a script is present), which, by the way, is  
JavaScript-specific, not Tapestry-specific, wouldn't need to be asked.


Ok Thiago, thank you for your feedback.
I think the question is about tapestry because I need to validate inside  
a tapestry's component if its parent page contains the string 

RE: [T5] How can I validate if a script is present ?

2014-09-25 Thread Carlos Gómez Montiel
Hi Lance, thank you for your answer.

Yes, I have tried with exanpe library (versión 1.2.1) but it throws the 
javascript console error:
Uncaught TypeError: Cannot set property 'ajaxValidator' of undefined 
exanpe-t5-lib.js:737
No Tapestry.Initializer function for : gMapBuilder: jQuery.fn.jQuery.init[0]

Additionally I have tried with tapestry5-jquery's map component but the result 
is the same, the map is renderer ok if it is outside a block, if the component 
is inside a block the map is never renderer.

Test2.tml:

refrescar





Test2.java:
public class Test2 {

public JSONObject getOptions() {
JSONObject json = new JSONObject();
return json;
}
@Inject
private Block blockResults;

Object onActionFromRefrescar() {
return blockResults;
}
}



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



RE: [T5] How can I validate if a script is present ?

2014-09-25 Thread Carlos Gómez Montiel
Hi Thiago, thank you for your answer :)
I'm using Tapestry 5.3.7

> Where's your JavaScript?
For google maps, you have to access the javascript library from a URL, so my 
javascript is inside the url: "https://maps.googleapis.com/maps/api/js?v=3.exp";

> How are you including it?

public class GMapShow {
@Inject
private JavaScriptSupport javaScriptSupport;

public void setupRender() {

javaScriptSupport.importJavaScriptLibrary("https://maps.googleapis.com/maps/api/js?v=3.exp";);
}
}

> If you put your JavaScript code inside a .js file and included using @Import 
> or JavaScriptSupport.importJavaScriptLibrary(), your code would be 
> automatically included after the library you're using.

Testing it, I have created a file (googlemaps.js) with the content of the url: 
"https://maps.googleapis.com/maps/api/js?v=3.exp"; and included it inside 
component:
@Import(library = 
"classpath:mx/kka/msurvey/web/view/components/maps/googlemaps.js")
public class GMapShow {
}

But the result is the same, the map is rendered correctly if the component is 
outside a block but if the component is inside a block, the map is not renderer.

I suppose the javascript inside 
"https://maps.googleapis.com/maps/api/js?v=3.exp"; is loading another javascript 
files and maybe the component is rendered before all all javascript libraries 
are loaded. 
The javascript has snipets that looks like:

getScript("https://maps.gstatic.com/maps-api-v3/api/js/18/5/intl/es_ALL/main.js";);
apiLoad([0.00999776482582,[[["https://mts0.googleapis.com/vt?lyrs=m@27500\u0026src=api\u0026hl=es-ES\u0026","https://mts1.googleapis.com
 .

> That's why we ask people more information and snippets of code when asking 
> help: the original question in the subject of the message (how can I validate 
> if a script is present), which, by the way, is JavaScript-specific, not 
> Tapestry-specific, wouldn't need to be asked.

Ok Thiago, thank you for your feedback. 
I think the question is about tapestry because I need to validate inside a 
tapestry's component if its parent page contains the string 

RE: [T5] How can I validate if a script is present ?

2014-09-25 Thread Lance Java
Have you seen the exanpe gmap component?

http://exanpe-t5-lib.appspot.com/components/googlemap/example2
 On 25 Sep 2014 14:45, "Carlos Gómez Montiel"  wrote:

> Hi Thiago
> Ok, I will more specific:
>
>  I'm developing a Tapestry component (GMapShow) that renders a google map.
> If I include the google maps javascript library directly in this component,
> the map is not render if the component is inside a block, so I need to
> include the library BEFORE the block (with the GMapShow component) is
> rendered.
>
> So, I have created a component to only include the Google Maps library:
> public class ImportGMapLib {
>
> @Inject
> private JavaScriptSupport javaScriptSupport;
>
> public void beginRender() {
> javaScriptSupport.importJavaScriptLibrary("
> https://maps.googleapis.com/maps/api/js?v=3.exp";);
> }
> }
>
> My "Test.tml" looks like this:
>
> 
>
> refresh
> 
> 
> 
> 
>
> I need to validate from GMapEdit component if the javascript library "
> https://maps.googleapis.com/maps/api/js?v=3.exp"; was imported, or
> validate inside GMapEdit if the ImportGMapLib component was invoked inside
> Test.tml.
>
> Thanks in advance.
>
>
> -Mensaje original-----
> De: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com]
> Enviado el: jueves, 25 de septiembre de 2014 07:29 a.m.
> Para: Tapestry users
> Asunto: Re: [T5] How can I validate if a script is present ?
>
> On Wed, 24 Sep 2014 21:59:44 -0300, Carlos Gómez Montiel 
> wrote:
>
> > Hi ¡
>
> Hi!
>
> > How can I validate from a component if a script is inside  tag
> > of a container page?
>
> I'm sorry, but I have no idea which scenario are you trying to describe
> here. Which validation is this?
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: [T5] How can I validate if a script is present ?

2014-09-25 Thread Thiago H de Paula Figueiredo
On Thu, 25 Sep 2014 10:45:44 -0300, Carlos Gómez Montiel  
 wrote:



Hi Thiago
Ok, I will more specific:


Hi!

Thanks for being more specific. :) We want to help, but it's quite hard

 I'm developing a Tapestry component (GMapShow) that renders a google  
map. If I include the google maps javascript library directly in this  
component, the map is not render if the component is inside a block, so  
I need to include the library BEFORE the block (with the GMapShow  
component) is rendered.


So, I have created a component to only include the Google Maps library:
public class ImportGMapLib {

@Inject
private JavaScriptSupport javaScriptSupport;

public void beginRender() {

javaScriptSupport.importJavaScriptLibrary("https://maps.googleapis.com/maps/api/js?v=3.exp";);
}
}


By the way, from T5.4 on, you can use https://, http:// and //: in @Import.

Where's your JavaScript? How are you including it? That's probably the  
source of your problem.
If you put your JavaScript code inside a .js file and included using  
@Import or JavaScriptSupport.importJavaScriptLibrary(), your code would be  
automatically included after the library you're using.


That's why we ask people more information and snippets of code when asking  
help: the original question in the subject of the message (how can I  
validate if a script is present), which, by the way, is  
JavaScript-specific, not Tapestry-specific, wouldn't need to be asked.


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

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



RE: [T5] How can I validate if a script is present ?

2014-09-25 Thread Carlos Gómez Montiel
Hi Thiago
Ok, I will more specific:

 I'm developing a Tapestry component (GMapShow) that renders a google map. If I 
include the google maps javascript library directly in this component, the map 
is not render if the component is inside a block, so I need to include the 
library BEFORE the block (with the GMapShow component) is rendered.

So, I have created a component to only include the Google Maps library:
public class ImportGMapLib {

@Inject
private JavaScriptSupport javaScriptSupport;

public void beginRender() {

javaScriptSupport.importJavaScriptLibrary("https://maps.googleapis.com/maps/api/js?v=3.exp";);
}
}

My "Test.tml" looks like this:



refresh





I need to validate from GMapEdit component if the javascript library 
"https://maps.googleapis.com/maps/api/js?v=3.exp"; was imported, or validate 
inside GMapEdit if the ImportGMapLib component was invoked inside Test.tml.

Thanks in advance.


-Mensaje original-
De: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com] 
Enviado el: jueves, 25 de septiembre de 2014 07:29 a.m.
Para: Tapestry users
Asunto: Re: [T5] How can I validate if a script is present ?

On Wed, 24 Sep 2014 21:59:44 -0300, Carlos Gómez Montiel  
wrote:

> Hi ¡

Hi!

> How can I validate from a component if a script is inside  tag 
> of a container page?

I'm sorry, but I have no idea which scenario are you trying to describe here. 
Which validation is this?

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

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


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



Re: [T5] How can I validate if a script is present ?

2014-09-25 Thread Thiago H de Paula Figueiredo
On Wed, 24 Sep 2014 21:59:44 -0300, Carlos Gómez Montiel  
 wrote:



Hi ¡


Hi!


How can I validate from a component if a script is inside  tag of a
container page?


I'm sorry, but I have no idea which scenario are you trying to describe  
here. Which validation is this?


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

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



Re: T5 Tynamo RestEasy, discovering all rest resources and paths

2013-10-31 Thread Alejandro Scandroli
Hi Daniel

Take a look at RESTEasy's JSAPIWriter [1] and how it was integrated
with tapestry-resteasy [2]
I think you will find everything you need in there.

If you need even more discoverability than that I'd recommend to use
something like Swagger [3]

1: 
https://svn.code.sf.net/p/resteasy/svn/trunk/jaxrs/resteasy-jsapi/src/main/java/org/jboss/resteasy/jsapi/JSAPIWriter.java
2: 
http://svn.codehaus.org/tynamo/trunk/tapestry-resteasy/src/main/java/org/tynamo/resteasy/JSAPIRequestFilter.java
3: http://jira.codehaus.org/browse/TYNAMO-231 ;-)

Cheers.
Alejandro.


On Thu, Oct 31, 2013 at 8:16 AM, Daniel Jue  wrote:
> Hi,  I have a bunch of rest services, across a couple modules.  One of the
> rest services is a meta type of service, where the methods (via
> parameter-less @Get requests) return things like canonical values/enums
> used as query values elsewhere in the system.
>
>
> Anyway, some member(s) of our team like to change the rest paths around and
> this breaks the JS front end of course.
>
> Is there a way to collect:
>
> 1) The rest services paths for each service (i.e. the @Path value on the
> class)
> 2) The individual resources' paths (i.e. the @Path on the methods)
>
> Oh and I guess knowing the root rest path as defined in your module would
> be nice too.
>
>
> If I had the complete or relative paths to the individual methods, that
> would solve my problem 100%.
>
> The plan is to then expose the available paths through a method under the
> meta rest service.
>
> It's not really HATEOAS, I just want to keep the JS guys and back end guys
> from stabbing each other (myself included)

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



Re: T5 IOC Integration Questions

2013-09-27 Thread Martin Kersten
Norman, I implemented something I called Invoker lately. It was quite easy
to do field injection and calling methods where you inject all parameters.
The mixed part was quite difficult though (provide some parameters and
inject the others). Also be aware of that the ordering of methods is not
guaranteed in any way using JDK 7 192 and above (getDeclaredMethods and
getMethods along with getConstructors now return methods in random order).
I fixed the issue by using ASM and visit each method in the order they are
stored within the class file (which is the exact order you define it in the
java file).

So beside this if you are doing invocation and injection on fields and
methods go ahead. This wont take more then an hour at most. If you need
additional help, just ask. You can even invoke and create private classes /
constructors and methods which comes quite handy in case of writing test
cases.


Cheers,

Martin (Kersten)


2013/9/27 Norman Franke 

> On Sep 27, 2013, at 1:31 PM, Thiago H de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
> > On Fri, 27 Sep 2013 13:11:33 -0300, Norman Franke 
> wrote:
> >
> >> I'm trying to better integrate Atmosphere and Tapestry 5. It would make
> life easier if there was a way for T5's IOC layer to inject into an
> existing object, instead of having it need to create objects itself. I
> can't find one, if it exists.
> >
> > Unless there's some setter we could call through injection, I don't
> think any other IoC does that (injecting stuff into already existing
> objects). Most IoC features can only be implemented because the IoC
> container is instantiating the object.
> >
> > --
> > Thiago H. de Paula Figueiredo
>
>
> Spring does, as does Guice. You lose some things, but it's better than
> nothing.
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
>
>
>
>


Re: T5 IOC Integration Questions

2013-09-27 Thread Norman Franke
On Sep 27, 2013, at 1:31 PM, Thiago H de Paula Figueiredo  
wrote:

> On Fri, 27 Sep 2013 13:11:33 -0300, Norman Franke  wrote:
> 
>> I'm trying to better integrate Atmosphere and Tapestry 5. It would make life 
>> easier if there was a way for T5's IOC layer to inject into an existing 
>> object, instead of having it need to create objects itself. I can't find 
>> one, if it exists.
> 
> Unless there's some setter we could call through injection, I don't think any 
> other IoC does that (injecting stuff into already existing objects). Most IoC 
> features can only be implemented because the IoC container is instantiating 
> the object.
> 
> -- 
> Thiago H. de Paula Figueiredo


Spring does, as does Guice. You lose some things, but it's better than nothing.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com





Re: T5 IOC Integration Questions

2013-09-27 Thread Thiago H de Paula Figueiredo

On Fri, 27 Sep 2013 13:11:33 -0300, Norman Franke  wrote:

I'm trying to better integrate Atmosphere and Tapestry 5. It would make  
life easier if there was a way for T5's IOC layer to inject into an  
existing object, instead of having it need to create objects itself. I  
can't find one, if it exists.


Unless there's some setter we could call through injection, I don't think  
any other IoC does that (injecting stuff into already existing objects).  
Most IoC features can only be implemented because the IoC container is  
instantiating the object.


--
Thiago H. de Paula Figueiredo

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



Re: T5: bind onlick handler after LinkSubmit

2013-08-21 Thread Dmitriy Vsekhvalnov
Hey thanks for ideas, i ended with for  mixin to do:

$(formId).observe(Tapestry.FORM_PROCESS_SUBMIT_EVENT, function(event)
{
//hide modal
});

by some reason  is never called.


On Wed, Aug 21, 2013 at 6:46 PM, Lenny Primak wrote:

> FlowLogix library has a mixin for this:
> http://code.google.com/p/flowlogix/wiki/TLUpdateEvent
>
> On Aug 21, 2013, at 9:15 AM, Thiago H de Paula Figueiredo wrote:
>
> > On Wed, 21 Aug 2013 09:45:33 -0300, Dmitriy Vsekhvalnov <
> dvsekhval...@gmail.com> wrote:
> >
> >> Hi all,
> >
> > Hi!
> >
> >> i'm looking for a way to bind event handler (js) to  element which
> also is LinkSubmit, but i'd like my event handler to be executed after
> >> LinkSubmit handler.
> >
> > What you actually want is to execute JavaScript when an AJAX call is
> finished. If it's a zone update, here's the solution:
> http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Trigger-a-client-side-event-AFTER-Zone-update-td3229142.html
> .
> >
> > --
> > Thiago H. de Paula Figueiredo
> >
> > -
> > 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: bind onlick handler after LinkSubmit

2013-08-21 Thread Lenny Primak
FlowLogix library has a mixin for this:
http://code.google.com/p/flowlogix/wiki/TLUpdateEvent

On Aug 21, 2013, at 9:15 AM, Thiago H de Paula Figueiredo wrote:

> On Wed, 21 Aug 2013 09:45:33 -0300, Dmitriy Vsekhvalnov 
>  wrote:
> 
>> Hi all,
> 
> Hi!
> 
>> i'm looking for a way to bind event handler (js) to  element which also 
>> is LinkSubmit, but i'd like my event handler to be executed after
>> LinkSubmit handler.
> 
> What you actually want is to execute JavaScript when an AJAX call is 
> finished. If it's a zone update, here's the solution: 
> http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Trigger-a-client-side-event-AFTER-Zone-update-td3229142.html.
> 
> -- 
> Thiago H. de Paula Figueiredo
> 
> -
> 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: bind onlick handler after LinkSubmit

2013-08-21 Thread Thiago H de Paula Figueiredo
On Wed, 21 Aug 2013 09:45:33 -0300, Dmitriy Vsekhvalnov  
 wrote:



Hi all,


Hi!

i'm looking for a way to bind event handler (js) to  element which  
also is LinkSubmit, but i'd like my event handler to be executed after

LinkSubmit handler.


What you actually want is to execute JavaScript when an AJAX call is  
finished. If it's a zone update, here's the solution:  
http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Trigger-a-client-side-event-AFTER-Zone-update-td3229142.html.


--
Thiago H. de Paula Figueiredo

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



Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-07 Thread Rural Hunter
Yes. I'm already using freemarker. Just want to use less dependencies 
and get all things unified since we already have one(Tapestry) right?


于 2013/6/7 21:04, Thiago H de Paula Figueiredo 写道:
On Fri, 07 Jun 2013 06:45:32 -0300, Rural Hunter 
 wrote:


cool, thanks! I am trying to implement a similar requirement as the 
OP which is to send html formatted mails in a background service of 
my webapp while there is no actual request/response involved. I'm 
trying to figure out how to use Tapestry template as the mail 
template in some way.


Wouldn't a general-purpose templating entigne like FreeMarker be a 
better choice for this scenario (e-mails)? Is there anything from the 
webapp that you could reuse here?





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



Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-07 Thread Thiago H de Paula Figueiredo
On Fri, 07 Jun 2013 06:45:32 -0300, Rural Hunter   
wrote:


cool, thanks! I am trying to implement a similar requirement as the OP  
which is to send html formatted mails in a background service of my  
webapp while there is no actual request/response involved. I'm trying to  
figure out how to use Tapestry template as the mail template in some way.


Wouldn't a general-purpose templating entigne like FreeMarker be a better  
choice for this scenario (e-mails)? Is there anything from the webapp that  
you could reuse here?


--
Thiago H. de Paula Figueiredo

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



Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-07 Thread Lance Java
I started to extract the logic to a separate project here
https://github.com/uklance/tapestry-offline but never got around to testing
it.

The main functionality is in this class
https://github.com/uklance/tapestry-offline/blob/master/src/main/java/org/lazan/t5/offline/services/internal/OfflineComponentRendererImpl.java

Let me know if it's useful, pull requests welcome :)


Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-07 Thread Rural Hunter
cool, thanks! I am trying to implement a similar requirement as the OP 
which is to send html formatted mails in a background service of my 
webapp while there is no actual request/response involved. I'm trying to 
figure out how to use Tapestry template as the mail template in some way.


于 2013/6/7 17:27, Lance Java 写道:

AFAIK tapx-templating will not work with the normal tapestry web jars on
the classpath and must be a separate app.

I have written a class which can render components offline within a
tapestry webapp for tapestry-cometd. The code can be found here

https://github.com/uklance/tapestry-cometd/blob/master/src/main/java/org/lazan/t5/cometd/services/internal/ComponentJSONRendererImpl.java


Note: It's a bit of a hack!




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



Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-07 Thread Lance Java
AFAIK tapx-templating will not work with the normal tapestry web jars on
the classpath and must be a separate app.

I have written a class which can render components offline within a
tapestry webapp for tapestry-cometd. The code can be found here

https://github.com/uklance/tapestry-cometd/blob/master/src/main/java/org/lazan/t5/cometd/services/internal/ComponentJSONRendererImpl.java


Note: It's a bit of a hack!


Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-07 Thread Rural Hunter

dose tapx-templating work in a tapestry webapp now?

于 2013/6/6 15:31, Lance Java 写道:

Have you considered tapx-templating and a single webapp?

https://github.com/hlship/tapx




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



Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-06 Thread Muhammad Gelbana
I strongly believe that Dmitry's suggestion is the simplest and most
efficient so far, thanks a lot for that :)

This would send an ajax request acceptable by tapestry:
ajax = new XMLHttpRequest();
ajax.open("POST", "http://localhost:8080/index:myevent/0/0/0";, true);
ajax.setRequestHeader("X-Requested-With", "XMLHttpRequest"); //This is
necessary
ajax.send(null);

Thank you all :)


On Thu, Jun 6, 2013 at 9:31 AM, Lance Java wrote:

> Have you considered tapx-templating and a single webapp?
>
> https://github.com/hlship/tapx
>


Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-06 Thread Lance Java
Have you considered tapx-templating and a single webapp?

https://github.com/hlship/tapx


Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-05 Thread Dmitry Gusev
If you only need to get HTML on the client and not on the server-side,
then you may just use Tapestry's built-in logic for handling AJAX requests.

On the server side create eventLink:

Link link = resources.createEventLink(eventType, contextValues);
return link.toAbsoluteURI();

Pass this link to client side during rendering and when needed do the AJAX
calls using, say, jQuery.ajax.

You may handle ajax request on the server side the same way I wrote in my
example above --
return block from event handler or use ajaxResponseRenderer.addRender().
On the client-side response will be the same JSON and you may extract
content from it.

Note that in both cases it is possible to render multiple blocks by one
request -- this is if you call
ajaxResponseRenderer.addRender() multiple times.


On Thu, Jun 6, 2013 at 1:12 AM, Muhammad Gelbana wrote:

> Actually Lance's second approach is what I need to do. And yes it should be
> very simple, I will only have to display regular html without controls at
> all (Hopefully it will stay this way and I actually think it will)
>
> Regards
>
>
> On Wed, Jun 5, 2013 at 8:00 PM, Dmitry Gusev 
> wrote:
>
> > The entry point is:
> >
> > String rawAddress = renderer.render(new RenderEvent(
> > "internal/companyblocks", "companyAddress", company));
> >
> >
> > You tell here that onCompanyAddress method (or method with
> > @Event("companyAddress")) should be invoked on the internal/companyblocks
> > page
> > class and if that method returns a Block - it will be rendered to a
> string.
> > company - is a parameter to that method that you may use to initialize
> > rendering context for the block.
> > You can also not return Block from the method by just addRenderer:
> >
> > ajaxResponseRenderer.addRender(addressBlockZone);
> >
> > And the addressBlockZone will be rendered to as string in this case.
> >
> > Resulting string will be serialized json object, so you can inspect its
> > structure and take the content you want like:
> >
> > String htmlAddress = new
> > JSONObject(rawAddress).getString("content");
> >
> >
> > On Wed, Jun 5, 2013 at 8:14 PM, Muhammad Gelbana  > >wrote:
> >
> > > Honestly, I can't figure out anything from these 2 resources ! It all
> > looks
> > > so complicated to me.
> > >
> > > @Dmitry
> > > What is the entry point of your code ? When an ajaxrequest is sent to
> my
> > > application, doesn't it reach your "CompanyBlocks" page ? Then when
> does
> > > all the other services begin working ?!
> > >
> > > @Lanve
> > > And I thought Dimitry's code was complicated :D
> > > Your code was even harder to look at, I also can't understand the entry
> > > point and the flow of data starting when I receive an ajax request
> till I
> > > respond with a string representation of a component's template file.
> > >
> > > Thank you all for your help :)
> > >
> > >
> > > On Thu, May 30, 2013 at 6:41 PM, Lance Java  > > >wrote:
> > >
> > > > I'm not 100% sure what your implementation will be but I've done some
> > > work
> > > > in this area.
> > > >
> > > > Take a look at PDFLink.getFoAsString() where I convert a
> RenderCommand
> > > to a
> > > > String of markup (XML in the example)
> > > >
> > > > http://tapestry-stitch.uklance.cloudbees.net/pdflinkdemo
> > > >
> > > > Also, take a look at this wiki entry
> > > >
> > > >
> > > >
> > >
> >
> http://wiki.apache.org/tapestry/Tapestry5HowToGetAnHTMLStringFromARenderCommandParameter
> > > >
> > > > Note that a Block can be type coerced to a RenderCommand
> > > >
> > >
> >
> >
> >
> > --
> > Dmitry Gusev
> >
> > AnjLab Team
> > http://anjlab.com
> >
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-05 Thread Muhammad Gelbana
Actually Lance's second approach is what I need to do. And yes it should be
very simple, I will only have to display regular html without controls at
all (Hopefully it will stay this way and I actually think it will)

Regards


On Wed, Jun 5, 2013 at 8:00 PM, Dmitry Gusev  wrote:

> The entry point is:
>
> String rawAddress = renderer.render(new RenderEvent(
> "internal/companyblocks", "companyAddress", company));
>
>
> You tell here that onCompanyAddress method (or method with
> @Event("companyAddress")) should be invoked on the internal/companyblocks
> page
> class and if that method returns a Block - it will be rendered to a string.
> company - is a parameter to that method that you may use to initialize
> rendering context for the block.
> You can also not return Block from the method by just addRenderer:
>
> ajaxResponseRenderer.addRender(addressBlockZone);
>
> And the addressBlockZone will be rendered to as string in this case.
>
> Resulting string will be serialized json object, so you can inspect its
> structure and take the content you want like:
>
> String htmlAddress = new
> JSONObject(rawAddress).getString("content");
>
>
> On Wed, Jun 5, 2013 at 8:14 PM, Muhammad Gelbana  >wrote:
>
> > Honestly, I can't figure out anything from these 2 resources ! It all
> looks
> > so complicated to me.
> >
> > @Dmitry
> > What is the entry point of your code ? When an ajaxrequest is sent to my
> > application, doesn't it reach your "CompanyBlocks" page ? Then when does
> > all the other services begin working ?!
> >
> > @Lanve
> > And I thought Dimitry's code was complicated :D
> > Your code was even harder to look at, I also can't understand the entry
> > point and the flow of data starting when I receive an ajax request till I
> > respond with a string representation of a component's template file.
> >
> > Thank you all for your help :)
> >
> >
> > On Thu, May 30, 2013 at 6:41 PM, Lance Java  > >wrote:
> >
> > > I'm not 100% sure what your implementation will be but I've done some
> > work
> > > in this area.
> > >
> > > Take a look at PDFLink.getFoAsString() where I convert a RenderCommand
> > to a
> > > String of markup (XML in the example)
> > >
> > > http://tapestry-stitch.uklance.cloudbees.net/pdflinkdemo
> > >
> > > Also, take a look at this wiki entry
> > >
> > >
> > >
> >
> http://wiki.apache.org/tapestry/Tapestry5HowToGetAnHTMLStringFromARenderCommandParameter
> > >
> > > Note that a Block can be type coerced to a RenderCommand
> > >
> >
>
>
>
> --
> Dmitry Gusev
>
> AnjLab Team
> http://anjlab.com
>


Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-05 Thread Dmitry Gusev
The entry point is:

String rawAddress = renderer.render(new RenderEvent(
"internal/companyblocks", "companyAddress", company));


You tell here that onCompanyAddress method (or method with
@Event("companyAddress")) should be invoked on the internal/companyblocks page
class and if that method returns a Block - it will be rendered to a string.
company - is a parameter to that method that you may use to initialize
rendering context for the block.
You can also not return Block from the method by just addRenderer:

ajaxResponseRenderer.addRender(addressBlockZone);

And the addressBlockZone will be rendered to as string in this case.

Resulting string will be serialized json object, so you can inspect its
structure and take the content you want like:

String htmlAddress = new JSONObject(rawAddress).getString("content");


On Wed, Jun 5, 2013 at 8:14 PM, Muhammad Gelbana wrote:

> Honestly, I can't figure out anything from these 2 resources ! It all looks
> so complicated to me.
>
> @Dmitry
> What is the entry point of your code ? When an ajaxrequest is sent to my
> application, doesn't it reach your "CompanyBlocks" page ? Then when does
> all the other services begin working ?!
>
> @Lanve
> And I thought Dimitry's code was complicated :D
> Your code was even harder to look at, I also can't understand the entry
> point and the flow of data starting when I receive an ajax request till I
> respond with a string representation of a component's template file.
>
> Thank you all for your help :)
>
>
> On Thu, May 30, 2013 at 6:41 PM, Lance Java  >wrote:
>
> > I'm not 100% sure what your implementation will be but I've done some
> work
> > in this area.
> >
> > Take a look at PDFLink.getFoAsString() where I convert a RenderCommand
> to a
> > String of markup (XML in the example)
> >
> > http://tapestry-stitch.uklance.cloudbees.net/pdflinkdemo
> >
> > Also, take a look at this wiki entry
> >
> >
> >
> http://wiki.apache.org/tapestry/Tapestry5HowToGetAnHTMLStringFromARenderCommandParameter
> >
> > Note that a Block can be type coerced to a RenderCommand
> >
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-05 Thread Lance Java
I think I need to understand how it's going to work before I go any further.



Here's one approach

1. The browser makes a request to the "other" webapp

2. The other webapp makes request(s) to the tapestry app

3. The other webapp merges it's own html with the tapestry html to create a
page

4. The page is returned to the user



Here's another approach

1. The browser makes a request to the "other" webapp

2. The other webapp returns a page with some empty divs

3. Some javascript runs on page load

4. The browser makes requests to the tapestry app

5. The tapestry app returns responses to the browser

6. Some javascript in the browser updates the innerHTML of some div's



In both approaches, you are going to be fighting an uphill battle if you
want to handle javascript and eventlink / actionlinks in your tapestry
components. If you simply want to render html fragments, without links or
javascript we might be able to help.


Re: [t5] Is it possible to return a component's generated HTML ?

2013-06-05 Thread Muhammad Gelbana
Honestly, I can't figure out anything from these 2 resources ! It all looks
so complicated to me.

@Dmitry
What is the entry point of your code ? When an ajaxrequest is sent to my
application, doesn't it reach your "CompanyBlocks" page ? Then when does
all the other services begin working ?!

@Lanve
And I thought Dimitry's code was complicated :D
Your code was even harder to look at, I also can't understand the entry
point and the flow of data starting when I receive an ajax request till I
respond with a string representation of a component's template file.

Thank you all for your help :)


On Thu, May 30, 2013 at 6:41 PM, Lance Java wrote:

> I'm not 100% sure what your implementation will be but I've done some work
> in this area.
>
> Take a look at PDFLink.getFoAsString() where I convert a RenderCommand to a
> String of markup (XML in the example)
>
> http://tapestry-stitch.uklance.cloudbees.net/pdflinkdemo
>
> Also, take a look at this wiki entry
>
>
> http://wiki.apache.org/tapestry/Tapestry5HowToGetAnHTMLStringFromARenderCommandParameter
>
> Note that a Block can be type coerced to a RenderCommand
>


Re: [t5] Is it possible to return a component's generated HTML ?

2013-05-30 Thread Lance Java
I'm not 100% sure what your implementation will be but I've done some work
in this area.

Take a look at PDFLink.getFoAsString() where I convert a RenderCommand to a
String of markup (XML in the example)

http://tapestry-stitch.uklance.cloudbees.net/pdflinkdemo

Also, take a look at this wiki entry

http://wiki.apache.org/tapestry/Tapestry5HowToGetAnHTMLStringFromARenderCommandParameter

Note that a Block can be type coerced to a RenderCommand


Re: [t5] Is it possible to return a component's generated HTML ?

2013-05-30 Thread Dmitry Gusev
You can put your component to a block and render this block.

Have a look at this thread:
http://mail-archives.apache.org/mod_mbox/tapestry-users/201304.mbox/%3cca+v6ct9um-li7vxvafem+abwrxf-b9ar3t+x40eer971zbl...@mail.gmail.com%3e

On Thu, May 30, 2013 at 8:26 PM, Muhammad Gelbana wrote:

> Hopefully I'll explain this clearly.
>
> I'm willing to integrate my tapestry web application with another web
> application. That other web application will request ajax urls from my
> application.
>
> In my application should reply in HTML. So it would be much easier to be
> able to use the regular tapestry component\page tml to construct the HTML
> response. So that I can easily bind the tml to my component\page and let
> tapestry do it's magic on generating the HTML.
>
> Is this possible in tapestry ?
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Re: T5 and AppEngine 1.7.3 dev server IllegalStateException

2013-05-17 Thread Alex Kotchnev
Alright - I'm not entirely sure if anyone will find any use for this, but I
implemented the approach suggested by Lance (thank you Lance!) and pushed
the code into BitBucket : https://bitbucket.org/akochnev/tap5-gae-utils

The project wiki explains how to use it, but in short, just include the
module either as a @SubModule or as a module in your Development
configuration.

Now my application runs just fine using the official GAE Maven plugin w/
version 1.8.0. Sweet !

Cheers -


On Fri, May 17, 2013 at 9:24 AM, Lance Java wrote:

> A much better option is to fix the bug with a RequestFilter. Wrap the
> response in a custom implementation that sets a flag to true when
> redirect() is called and returns the correct value in isComitted()
>


Re: T5 and AppEngine 1.7.3 dev server IllegalStateException

2013-05-17 Thread Lance Java
A much better option is to fix the bug with a RequestFilter. Wrap the
response in a custom implementation that sets a flag to true when
redirect() is called and returns the correct value in isComitted()


Re: T5 and AppEngine 1.7.3 dev server IllegalStateException

2013-05-17 Thread Alex Kotchnev
Just out of curiosity - this exception is thrown by Tapestry itself;
however, since it's just a "sanity check" and it only happens on the Dev
server , is there a way to disable this filter using Tapestry IoC ?

org.apache.tapestry5.internal.services.ImmediateActionRenderResponseF
ilter.handle(ImmediateActionRenderResponseFilter.java:63)

I can certainly keep plugging along w/ GAE 1.7.1 ( I don't have a reason to
upgrade); however, it would be nice if things could just work w/ just a
little tweaks.

Cheers -


On Thu, Feb 7, 2013 at 4:32 AM, arnold.mi...@gmail.com <
arnold.mi...@gmail.com> wrote:

> This is caused by this issue:
> http://code.google.com/p/googleappengine/issues/detail?id=8201
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/T5-and-AppEngine-1-7-3-dev-server-IllegalStateException-tp5717683p5719841.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: [T5 5.3.6] Dead Lock while initializing tapestry

2013-04-20 Thread mailingl...@j-b-s.de
Sorry I do not understand your response. From the stacktrace T5 is building 
your service. In the constructor of the service currently created you are 
spawning a new thread which again needs services from the T5 app in the run 
method, right?

Can't you defer thread creation to a method in your module class annotated by 
@Startup
?

Jens

Sent from my iPhone

On 18.04.2013, at 19:02, Arunas F  wrote:

> No, not at all. New Thread is spawned at some moment while initializing T5 
> app. And there is nothing special about a code:
> 
> 
> new Thread(new Runnable() {
> 
>@Override
>public void run() {
>if (logger.isDebugEnabled()) logger.debug(etlName + " 
> initializing... ");
> 
>try {
> 
>for (EtlAbstractJob job : jobs.getJobs()) {
>job.initialize();
>}
> 
>} catch (EtlJobException e) {
>logger.error(e.toString());
>e.printStackTrace();
>}
> 
>if (logger.isDebugEnabled()) logger.debug(etlName + " finished 
> initialization... ");
>}
> 
>}).start();
> 
> 
> And in the code  at line "job.initialize();" the var job are T5 IOC services 
> and these services depend on MongoDB service at some deeper level.
> 
> public class ReportStorageImpl implements ReportStorage {
> 
> .
> 
>private MongoDB mongoDB;
> 
>public ReportStorageImpl(MongoDB mongoDB) {
>this.mongoDB = mongoDB;
>}
> 
> ..
> 
>@Override
>public MongoDB getMongoDB() {
>return mongoDB;
>}
> }
> 
> About MongoDB also nothing special. The module is taken from 
> https://github.com/mlusetti/tapestry-mongodb-core (look at earlier revisions).
> 
> 
> BR,
> Arunas
> 
> 
> On 18/04/2013 18:53, mailingl...@j-b-s.de wrote:
>> Are you spawning a new thread in your MongoDBImpl.java:30 which makes use of 
>> T5 services, too? From the Stacktrace you are (well T5 IOC is) building the 
>> mongodb service right now. What happens in the ctor of your class? Can you 
>> paste some code??
>> 
>> Jens
>> 
>> Sent from my iPhone
>> 
>> On 18.04.2013, at 17:31, Arunas F  wrote:
>> 
>>> Hi,
>>> 
>>> We are using T5 version 5.3.6. I found that Tapestry runs into a dead lock 
>>> while building registry (initializing) if I start a new Thread what uses 
>>> some T5 services.
>>> Right now we have disabled multi threading while initializing app. But I 
>>> would like to know, is it a T5 bug and I should file it into JIRA or this 
>>> is an expected behavior and it is a T5 limitation.
>>> 
>>> 
>>> Problem description: If the T5 registry and new Thread tries to create same 
>>> service (from proxy) simultaneously sometimes you can run into deadlock and 
>>> T5 app wont initialize. In the stacktrace dump below, you can find that  
>>> both threads tried to create MongoDB instance and ran into a deadlock.
>>> 
>>> 
>>> Found one Java-level deadlock:
>>> =
>>> "Thread-10":
>>>  waiting for ownable synchronizer 0x0007c27e65f0, (a 
>>> java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync),
>>>  which is held by "Thread-4"
>>> "Thread-4":
>>>  waiting to lock monitor 0x7fdf5b91c658 (object 0x0007eda35c20, a 
>>> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator),
>>>  which is held by "Thread-10"
>>> 
>>> Java stack information for the threads listed above:
>>> ===
>>> "Thread-10":
>>>at sun.misc.Unsafe.park(Native Method)
>>>- parking to wait for  <0x0007c27e65f0> (a 
>>> java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync)
>>>at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
>>>at 
>>> java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
>>>at 
>>> java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:964)
>>>at 
>>> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282)
>>>at 
>>> java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731)
>>>at 
>>> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75)
>>>at 
>>> org.apache.tapestry5.ioc.internal.ModuleImpl.findOrCreate(ModuleImpl.java:213)
>>>at 
>>> org.apache.tapestry5.ioc.internal.ModuleImpl.getService(ModuleImpl.java:109)
>>>at 
>>> org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:421)
>>>at 
>>> org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:868)
>>>at 
>>> org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:57)
>>>at 
>>> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:257)
>>>at 
>>> org.apa

Re: [T5 5.3.6] Dead Lock while initializing tapestry

2013-04-18 Thread Arunas F
No, not at all. New Thread is spawned at some moment while initializing 
T5 app. And there is nothing special about a code:



new Thread(new Runnable() {

@Override
public void run() {
if (logger.isDebugEnabled()) logger.debug(etlName + " 
initializing... ");


try {

for (EtlAbstractJob job : jobs.getJobs()) {
job.initialize();
}

} catch (EtlJobException e) {
logger.error(e.toString());
e.printStackTrace();
}

if (logger.isDebugEnabled()) logger.debug(etlName + " 
finished initialization... ");

}

}).start();


And in the code  at line "job.initialize();" the var job are T5 IOC 
services and these services depend on MongoDB service at some deeper level.


public class ReportStorageImpl implements ReportStorage {

.

private MongoDB mongoDB;

public ReportStorageImpl(MongoDB mongoDB) {
this.mongoDB = mongoDB;
}

..

@Override
public MongoDB getMongoDB() {
return mongoDB;
}
}

About MongoDB also nothing special. The module is taken from 
https://github.com/mlusetti/tapestry-mongodb-core (look at earlier 
revisions).



BR,
Arunas


On 18/04/2013 18:53, mailingl...@j-b-s.de wrote:

Are you spawning a new thread in your MongoDBImpl.java:30 which makes use of T5 
services, too? From the Stacktrace you are (well T5 IOC is) building the 
mongodb service right now. What happens in the ctor of your class? Can you 
paste some code??

Jens

Sent from my iPhone

On 18.04.2013, at 17:31, Arunas F  wrote:


Hi,

We are using T5 version 5.3.6. I found that Tapestry runs into a dead lock 
while building registry (initializing) if I start a new Thread what uses some 
T5 services.
Right now we have disabled multi threading while initializing app. But I would 
like to know, is it a T5 bug and I should file it into JIRA or this is an 
expected behavior and it is a T5 limitation.


Problem description: If the T5 registry and new Thread tries to create same 
service (from proxy) simultaneously sometimes you can run into deadlock and T5 
app wont initialize. In the stacktrace dump below, you can find that  both 
threads tried to create MongoDB instance and ran into a deadlock.


Found one Java-level deadlock:
=
"Thread-10":
  waiting for ownable synchronizer 0x0007c27e65f0, (a 
java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync),
  which is held by "Thread-4"
"Thread-4":
  waiting to lock monitor 0x7fdf5b91c658 (object 0x0007eda35c20, a 
org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator),
  which is held by "Thread-10"

Java stack information for the threads listed above:
===
"Thread-10":
at sun.misc.Unsafe.park(Native Method)
- parking to wait for  <0x0007c27e65f0> (a 
java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
at 
java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
at 
java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:964)
at 
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282)
at 
java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731)
at 
org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75)
at 
org.apache.tapestry5.ioc.internal.ModuleImpl.findOrCreate(ModuleImpl.java:213)
at 
org.apache.tapestry5.ioc.internal.ModuleImpl.getService(ModuleImpl.java:109)
at 
org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:421)
at 
org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:868)
at 
org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:57)
at 
org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:257)
at 
org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:50)
at 
org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:289)
at 
org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:286)
at 
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)
at 
org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
at 
org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)
at 
org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:293)
at 
org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(

Re: [T5 5.3.6] Dead Lock while initializing tapestry

2013-04-18 Thread mailingl...@j-b-s.de

Are you spawning a new thread in your MongoDBImpl.java:30 which makes use of T5 
services, too? From the Stacktrace you are (well T5 IOC is) building the 
mongodb service right now. What happens in the ctor of your class? Can you 
paste some code??

Jens

Sent from my iPhone

On 18.04.2013, at 17:31, Arunas F  wrote:

> Hi,
> 
> We are using T5 version 5.3.6. I found that Tapestry runs into a dead lock 
> while building registry (initializing) if I start a new Thread what uses some 
> T5 services.
> Right now we have disabled multi threading while initializing app. But I 
> would like to know, is it a T5 bug and I should file it into JIRA or this is 
> an expected behavior and it is a T5 limitation.
> 
> 
> Problem description: If the T5 registry and new Thread tries to create same 
> service (from proxy) simultaneously sometimes you can run into deadlock and 
> T5 app wont initialize. In the stacktrace dump below, you can find that  both 
> threads tried to create MongoDB instance and ran into a deadlock.
> 
> 
> Found one Java-level deadlock:
> =
> "Thread-10":
>  waiting for ownable synchronizer 0x0007c27e65f0, (a 
> java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync),
>  which is held by "Thread-4"
> "Thread-4":
>  waiting to lock monitor 0x7fdf5b91c658 (object 0x0007eda35c20, a 
> org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator),
>  which is held by "Thread-10"
> 
> Java stack information for the threads listed above:
> ===
> "Thread-10":
>at sun.misc.Unsafe.park(Native Method)
>- parking to wait for  <0x0007c27e65f0> (a 
> java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync)
>at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
>at 
> java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
>at 
> java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:964)
>at 
> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282)
>at 
> java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731)
>at 
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75)
>at 
> org.apache.tapestry5.ioc.internal.ModuleImpl.findOrCreate(ModuleImpl.java:213)
>at 
> org.apache.tapestry5.ioc.internal.ModuleImpl.getService(ModuleImpl.java:109)
>at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:421)
>at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:868)
>at 
> org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:57)
>at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateInjection(InternalUtils.java:257)
>at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils.access$000(InternalUtils.java:50)
>at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:289)
>at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils$4.invoke(InternalUtils.java:286)
>at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)
>at 
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
>at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)
>at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:293)
>at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(InternalUtils.java:1488)
>at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils$23.invoke(InternalUtils.java:1483)
>at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)
>at 
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
>at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)
>at 
> org.apache.tapestry5.ioc.internal.util.InternalUtils.createConstructorConstructionPlan(InternalUtils.java:1480)
>at 
> org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.getPlan(ConstructorServiceCreator.java:52)
>at 
> org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:61)
>at 
> org.apache.tapestry5.ioc.internal.OperationTrackingObjectCreator$1.invoke(OperationTrackingObjectCreator.java:45)
>at 
> org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)
>at 
> org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
>at 
> org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)
>at 
> org.apache.tapestry5.ioc.interna

Re: [T5] Avoid logs in error for wrong urls and missing components ?

2013-04-09 Thread Ivan Khalopik
What about configuring robots.txt?


On Sat, Apr 6, 2013 at 1:50 PM, Nicolas Bouillon wrote:

> Thanks for your thoughts, and that leads me to the following suggestion to
> resolve my problem:
>
> I've already contributed a custom RequestExceptionHandler using
> binder.bind(RequestExceptionHandler.class,
> CustomRequestExceptionHandler.class)
>   .withId("CustomRequestExceptionHandler");
>
> That is this service which is responsible of my log error message
>
> (org.apache.tapestry5.internal.services.DefaultRequestExceptionHandler#handleRequestException).
>
> In my Custom RequestExceptionHandler, I could check the user agent to match
> against bots, and then instead of rendering the exception page, give them a
> 404 response code so they could stop crawling the page (and me skipping
> logger.error at the top of the handleRequestException method).
>
> Best regards.
>
>
>
> 2013/4/6 Muhammad Gelbana 
>
> > When you create a tapestry project using maven's archtype, it creates the
> > below request filter (slightly modified) to log how much time each
> request
> > consumed.
> >
> > // Service building
> > public RequestFilter buildTimingFilter(final Logger log) {
> > return new RequestFilter() {
> > @Override
> > public boolean service(Request request, Response response,
> > RequestHandler handler) throws IOException {
> > long startTime = System.currentTimeMillis();
> > try {
> > // The responsibility of a filter is to invoke the
> > corresponding method
> > // in the handler. When you chain multiple filters
> > together, each filter
> > // received a handler that is a bridge to the next
> filter.
> > return handler.service(request, response);
> > } finally {
> > long elapsed = System.currentTimeMillis() - startTime;
> > if (TimeUnit.MILLISECONDS.toSeconds(elapsed) >= 10) {
> > log.warn(String.format("Request time: %d ms",
> > elapsed));
> >  }
> > }
> > }
> > };
> > }
> >
> > // Service contribution
> > public void contributeRequestHandler(OrderedConfiguration
> > configuration, @Local RequestFilter filter) {
> > // Each contribution to an ordered configuration has a name, When
> > necessary, you may
> > // set constraints to precisely control the invocation order of the
> > contributed filter
> > // within the pipeline.
> > configuration.add("Timing", filter);
> > }
> >
> > From there, if you find a pattern for requests coming from bots, you can
> > drop these requests if that suits you. This way these bots will also
> learn
> > that the links they are requesting doesn't exists anymore and will
> > eventually stop bothering you, if they are smart enough !
> >
> > Regards
> >
> >
> > On Fri, Apr 5, 2013 at 10:08 PM, Nicolas Bouillon  > >wrote:
> >
> > > Dear all,
> > >
> > > I'm working on a e-commerce website in Tapestry 5 since a couple of
> years
> > > and we are making our website evolving constantly, adding some features
> > and
> > > changing stuff here and there.
> > >
> > > I'm closely monitoring application logs but i'm very annoyed by robots
> > who
> > > reminds some URLs that are not valid anymore.
> > >
> > > For example, they remind (or follow old links) to webpages that used to
> > be
> > > coded in PHP and where the URL contained special chars, not allowed in
> > > Tapestry URLs. Or those spiders try to access an URL of a grid pager
> > event,
> > > but the Grid component is not there anymore (or has a different name).
> > Each
> > > of those hit generate a log.error message, and that hide the important
> > > errors messages inside many noise. (I know, "Cool URI don't change",
> but
> > > for page events, it could be quite had to keep old URLs...)
> > >
> > > The error log is something like that :
> > > org.apache.tapestry5.ioc.util.UnknownValueException: Component
> > > product/domain/PriceList does not contain embedded component 'v3grid'.
> > >
> > > It's seems to be too wide to ignore totally "UnknownValueException" log
> > > appender, because it might hide real mistakes in the web application.
> > >
> > > Is there a way to avoid this kind of behavior ? How do you treat error
> > logs
> > > from your applications ?
> > >
> > > Thanks.
> > >
> > > Nicolas.
> > >
> >
>



-- 
BR
Ivan


Re: [T5] Avoid logs in error for wrong urls and missing components ?

2013-04-06 Thread Nicolas Bouillon
Thanks for your thoughts, and that leads me to the following suggestion to
resolve my problem:

I've already contributed a custom RequestExceptionHandler using
binder.bind(RequestExceptionHandler.class,
CustomRequestExceptionHandler.class)
  .withId("CustomRequestExceptionHandler");

That is this service which is responsible of my log error message
(org.apache.tapestry5.internal.services.DefaultRequestExceptionHandler#handleRequestException).

In my Custom RequestExceptionHandler, I could check the user agent to match
against bots, and then instead of rendering the exception page, give them a
404 response code so they could stop crawling the page (and me skipping
logger.error at the top of the handleRequestException method).

Best regards.



2013/4/6 Muhammad Gelbana 

> When you create a tapestry project using maven's archtype, it creates the
> below request filter (slightly modified) to log how much time each request
> consumed.
>
> // Service building
> public RequestFilter buildTimingFilter(final Logger log) {
> return new RequestFilter() {
> @Override
> public boolean service(Request request, Response response,
> RequestHandler handler) throws IOException {
> long startTime = System.currentTimeMillis();
> try {
> // The responsibility of a filter is to invoke the
> corresponding method
> // in the handler. When you chain multiple filters
> together, each filter
> // received a handler that is a bridge to the next filter.
> return handler.service(request, response);
> } finally {
> long elapsed = System.currentTimeMillis() - startTime;
> if (TimeUnit.MILLISECONDS.toSeconds(elapsed) >= 10) {
> log.warn(String.format("Request time: %d ms",
> elapsed));
>  }
> }
> }
> };
> }
>
> // Service contribution
> public void contributeRequestHandler(OrderedConfiguration
> configuration, @Local RequestFilter filter) {
> // Each contribution to an ordered configuration has a name, When
> necessary, you may
> // set constraints to precisely control the invocation order of the
> contributed filter
> // within the pipeline.
> configuration.add("Timing", filter);
> }
>
> From there, if you find a pattern for requests coming from bots, you can
> drop these requests if that suits you. This way these bots will also learn
> that the links they are requesting doesn't exists anymore and will
> eventually stop bothering you, if they are smart enough !
>
> Regards
>
>
> On Fri, Apr 5, 2013 at 10:08 PM, Nicolas Bouillon  >wrote:
>
> > Dear all,
> >
> > I'm working on a e-commerce website in Tapestry 5 since a couple of years
> > and we are making our website evolving constantly, adding some features
> and
> > changing stuff here and there.
> >
> > I'm closely monitoring application logs but i'm very annoyed by robots
> who
> > reminds some URLs that are not valid anymore.
> >
> > For example, they remind (or follow old links) to webpages that used to
> be
> > coded in PHP and where the URL contained special chars, not allowed in
> > Tapestry URLs. Or those spiders try to access an URL of a grid pager
> event,
> > but the Grid component is not there anymore (or has a different name).
> Each
> > of those hit generate a log.error message, and that hide the important
> > errors messages inside many noise. (I know, "Cool URI don't change", but
> > for page events, it could be quite had to keep old URLs...)
> >
> > The error log is something like that :
> > org.apache.tapestry5.ioc.util.UnknownValueException: Component
> > product/domain/PriceList does not contain embedded component 'v3grid'.
> >
> > It's seems to be too wide to ignore totally "UnknownValueException" log
> > appender, because it might hide real mistakes in the web application.
> >
> > Is there a way to avoid this kind of behavior ? How do you treat error
> logs
> > from your applications ?
> >
> > Thanks.
> >
> > Nicolas.
> >
>


Re: [T5] Avoid logs in error for wrong urls and missing components ?

2013-04-06 Thread Muhammad Gelbana
When you create a tapestry project using maven's archtype, it creates the
below request filter (slightly modified) to log how much time each request
consumed.

// Service building
public RequestFilter buildTimingFilter(final Logger log) {
return new RequestFilter() {
@Override
public boolean service(Request request, Response response,
RequestHandler handler) throws IOException {
long startTime = System.currentTimeMillis();
try {
// The responsibility of a filter is to invoke the
corresponding method
// in the handler. When you chain multiple filters
together, each filter
// received a handler that is a bridge to the next filter.
return handler.service(request, response);
} finally {
long elapsed = System.currentTimeMillis() - startTime;
if (TimeUnit.MILLISECONDS.toSeconds(elapsed) >= 10) {
log.warn(String.format("Request time: %d ms", elapsed));
 }
}
}
};
}

// Service contribution
public void contributeRequestHandler(OrderedConfiguration
configuration, @Local RequestFilter filter) {
// Each contribution to an ordered configuration has a name, When
necessary, you may
// set constraints to precisely control the invocation order of the
contributed filter
// within the pipeline.
configuration.add("Timing", filter);
}

>From there, if you find a pattern for requests coming from bots, you can
drop these requests if that suits you. This way these bots will also learn
that the links they are requesting doesn't exists anymore and will
eventually stop bothering you, if they are smart enough !

Regards


On Fri, Apr 5, 2013 at 10:08 PM, Nicolas Bouillon wrote:

> Dear all,
>
> I'm working on a e-commerce website in Tapestry 5 since a couple of years
> and we are making our website evolving constantly, adding some features and
> changing stuff here and there.
>
> I'm closely monitoring application logs but i'm very annoyed by robots who
> reminds some URLs that are not valid anymore.
>
> For example, they remind (or follow old links) to webpages that used to be
> coded in PHP and where the URL contained special chars, not allowed in
> Tapestry URLs. Or those spiders try to access an URL of a grid pager event,
> but the Grid component is not there anymore (or has a different name). Each
> of those hit generate a log.error message, and that hide the important
> errors messages inside many noise. (I know, "Cool URI don't change", but
> for page events, it could be quite had to keep old URLs...)
>
> The error log is something like that :
> org.apache.tapestry5.ioc.util.UnknownValueException: Component
> product/domain/PriceList does not contain embedded component 'v3grid'.
>
> It's seems to be too wide to ignore totally "UnknownValueException" log
> appender, because it might hide real mistakes in the web application.
>
> Is there a way to avoid this kind of behavior ? How do you treat error logs
> from your applications ?
>
> Thanks.
>
> Nicolas.
>


Re: T5 and AppEngine 1.7.3 dev server IllegalStateException

2013-02-07 Thread arnold.mi...@gmail.com
This is caused by this issue:
http://code.google.com/p/googleappengine/issues/detail?id=8201



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-and-AppEngine-1-7-3-dev-server-IllegalStateException-tp5717683p5719841.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: T5 Varargs in service methods

2013-01-28 Thread Thiago H de Paula Figueiredo
On Mon, 28 Jan 2013 07:53:52 -0200, llama-king   
wrote:


Sorry to dig up an old thread but seems I'm experiencing precisely the  
same issue. Running on 5.3.6, injecting a service, calling method in  
service that takes varargs.


Any ideas what might be the cause?


This doesn't look like it's related to varargs at all.



java.lang.LinkageError: loader constraint violation: when resolving  
method

"com.albourne.web.services.AjaxRenderHelper.render([Lorg/apache/tapestry5/corelib/components/Zone;)V"
the class loader (instance of
org/apache/tapestry5/internal/plastic/PlasticClassLoader) of the current
class, com/albourne/web/components/hf/risk/ListingConditionNew, and the
class loader (instance of runjettyrun/ProjectClassLoader) for resolved
class, com/albourne/web/services/AjaxRenderHelper, have different Class
objects for the type apestry5/corelib/components/Zone;)V used in the
signature


You seem to be receiving an instance of a page or component or mixin in a  
service. Never do that. As Tapestry changes that classes in a different  
classpath when they're loaded, non-transformed classes (like your service)  
only see the original, non-transformed page, component or mixin.


The solution is to create an interface, make the page, component or mixin  
implement it and then use the new interface as the parameter in your  
service.


--
Thiago H. de Paula Figueiredo

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



Re: T5 Varargs in service methods

2013-01-28 Thread llama-king
Sorry to dig up an old thread but seems I'm experiencing precisely the same
issue. Running on 5.3.6, injecting a service, calling method in service that
takes varargs.

Any ideas what might be the cause?

java.lang.LinkageError: loader constraint violation: when resolving method
"com.albourne.web.services.AjaxRenderHelper.render([Lorg/apache/tapestry5/corelib/components/Zone;)V"
the class loader (instance of
org/apache/tapestry5/internal/plastic/PlasticClassLoader) of the current
class, com/albourne/web/components/hf/risk/ListingConditionNew, and the
class loader (instance of runjettyrun/ProjectClassLoader) for resolved
class, com/albourne/web/services/AjaxRenderHelper, have different Class
objects for the type apestry5/corelib/components/Zone;)V used in the
signature
at
com.albourne.web.components.hf.risk.ListingConditionNew.onSuccessFromNewConditionForm(ListingConditionNew.java:127)
at
com.albourne.web.components.hf.risk.ListingConditionNew.dispatchComponentEvent(ListingConditionNew.java)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:935)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1112)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3100(ComponentPageElementImpl.java:61)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1057)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1054)
at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)
at
org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
at
org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)
at
org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:146)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1053)
at
org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl.triggerContextEvent(InternalComponentResourcesImpl.java:302)
at
org.apache.tapestry5.corelib.components.Form.advised$onAction_60237a7839c(Form.java:545)
at
org.apache.tapestry5.corelib.components.Form$Invocation_onAction_60237a7839b.proceedToAdvisedMethod(Unknown
Source)
at
org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:84)
at
org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37)
at
org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86)
at org.apache.tapestry5.corelib.components.Form.onAction(Form.java)
at
org.apache.tapestry5.corelib.components.Form.dispatchComponentEvent(Form.java)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.dispatchEvent(ComponentPageElementImpl.java:935)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.processEventTriggering(ComponentPageElementImpl.java:1112)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.access$3100(ComponentPageElementImpl.java:61)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1057)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl$5.invoke(ComponentPageElementImpl.java:1054)
at
org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:74)
at
org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:87)
at
org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1124)
at
org.apache.tapestry5.internal.structure.ComponentPageElementResourcesImpl.invoke(ComponentPageElementResourcesImpl.java:146)
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1053)
at
org.apache.tapestry5.internal.services.AjaxComponentEventRequestHandler.handle(AjaxComponentEventRequestHandler.java:110)
at
org.apache.tapestry5.internal.services.ajax.AjaxFormUpdateFilter.handle(AjaxFormUpdateFilter.java:56)
at $ComponentEventRequestHandler_60237a78b89.handle(Unknown Source)
at $ComponentEventRequestHandler_60237a78b84.handle(Unknown Source)
at
org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
at $ComponentEventRequestHandler_60237a78b86.handle(Unknown Source)
at
org.apache.tapestry5.upload.internal.services.UploadExceptionFilter.handle(UploadExceptionFilter.java:75)
at $ComponentEventRequestHandl

Re: T5 Embedded Components

2012-12-07 Thread Thiago H de Paula Figueiredo
On Fri, 07 Dec 2012 10:51:44 -0200, captain_rhino  
 wrote:



Embedded components


It's a little weird to talk in Tapestry about embedded components because  
all components can be used inside another component and pages are 99% the  
same as components.


How can I pass the Text field component to the SimpleTextField Component  
to avoid the above error or is there a different approach I should be  
taking?


Tapestry components are meant to be used as black boxes, so you're not  
supposed to refer to anything declared inside a component. If you really  
need to get the component inside the component, something you should  
avoid, create a getter in the component that has the component you want.


Cheers!

--
Thiago H. de Paula Figueiredo

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



Re: T5 Embedded Components

2012-12-07 Thread Kristian Marinkovic
Hi,

first remove the id parameter from the @Component annotation; this is
only needed if the field name in the java class is different from the
t:id attribute in the template.

second because you already defined your component in the template you
don't have to declare it in your java class; so you should remove the
TextField fields from your java class; if you still want to access the
component from within java use the @InjectComponent annotation

g,
kris

On Fri, Dec 7, 2012 at 1:51 PM, captain_rhino
 wrote:
> Embedded components
>
> I have a page (welcome) in which I am looking to use a custom
> simpletextfiled component to display numerous text fields (in the future I
> envisage simpledate and simple select components,  The simpleTextfield
> contains numerous other divs, css and other components).
>
> public class Welcome{
>
> @Persist
> private String field1,field2,field3;
>
> @Component(id = "field1")
> private TextField field1Field;
>
> @Component(id = "field2")
> private TextField field2Field;
>
> @Component(id = "field3")
> private TextField field2Field;
>
> }
>
> welcome.tml
> uses
> 
>
>
> where   SimpleTextField.tml is as follows
> http://tapestry.apache.org/schema/tapestry_5_3.xsd";>
>
>  label="message:field1Field-label"  name="field1Field" size="35"
> class="height10Px"  />
>  (a custom component for helptext)
>
> 
>
> When I run this I recieved the following error
>
> Embedded component(s) field1Field are defined within component class
> com.axa.cao.pages.partner.Welcome (or a super-class of Welcome), but are not
> present in the component template
> (classpath:com/axa/cao/pages/partner/Welcome.tml).
>
> How can I pass the Text field component to the SimpleTextField Component to
> avoid the above error or is there a different approach I should be taking?
> Thanks in advance.
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/T5-Embedded-Components-tp5718541.html
> Sent from the Tapestry - User mailing list archive at Nabble.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 jQuery - how to integrate?

2012-11-06 Thread Emmanuel DEMEY
hi.

The AutoComplete is not a component. It is a mixin. You should use it like
this : 

Manu


2012/11/6 membersound 

> How do I include http://tapestry5-jquery.com/ into my application?
>
> added this to pom:
> 
> org.got5
> tapestry5-jquery
> 3.3.3
> 
>
> But when I add an example form to one of my pages:
> 
> 
> 
> 
>
> I get an ex:
> Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException: Unable
> to resolve 'jquery/autocomplete' to a component class name.
>
> Did I miss something?
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/T5-jQuery-how-to-integrate-tp5717696.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
demey.emman...@gmail.com
http://emmanueldemey.fr/

Twitter : @EmmanuelDemey


Re: T5 and AppEngine 1.7.3 dev server IllegalStateException

2012-11-05 Thread Alex Kotchnev
Correction, this issue seems to have shown up w/ GAE 1.7.2 instead of 1.7.3
. Reverting the appengine sdk to version 1.7.1.1 resolves the issue whereas
staying w/ 1.7.2 does not.

Cheers - Alex K

On Mon, Nov 5, 2012 at 11:35 PM, Alex Kotchnev  wrote:

> I was migrating an older application running on GAE to the latest app
> engine SDK and I ran into the following issue : any form submissions
> (whenever there would be a redirect-after-post), result in an
> IllegalStateException with the stacktrace below. This seems somewhat
> related to a previous message that cited the exception (
> http://tapestry.1045711.n5.nabble.com/Tapestry-Problem-on-Google-App-Engine-in-Development-td5716763.html#a5716858);
> however, I get this issue in all cases (with or without the contribution to
> enable/disable gzip encoding). I havent tried deploying this application to
> production yet to see how it behaves outside of the dev environment.
>
> Just switching the GAE version to 1.7.2 makes the application behave
> properly in the dev environment.
>
> So, this is obviously an issue w/ the GAE tooling and I want to file an
> issue w/ the GAE project  - from the stacktrace,  any thoughts of why this
> might be happening (or why Tapestry doesn't like this behavior) ?
>
> Cheers - Alex K
>
> P.S. The stacktrace is below:
>
>
>- java.lang.IllegalStateException
>Sanity check - neither a stream response nor a redirect response was
>generated for this action request.
>Filter stack framesStack trace
>   -
>   
> org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:63)
>   -
>   
> org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
>   -
>   
> org.apache.tapestry5.services.TapestryModule$41.handle(TapestryModule.java:2476)
>   -
>   
> org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)
>   -
>   
> org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39)
>   -
>   
> org.tynamo.security.SecurityComponentRequestFilter.handleComponentEvent(SecurityComponentRequestFilter.java:41)
>   -
>   
> org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46)
>   -
>   
> org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:302)
>   -
>   
> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
>   -
>   
> org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902)
>   -
>   
> org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892)
>   -
>   
> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
>   -
>   
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)
>   -
>   
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)
>   -
>   
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
>   -
>   
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)
>   -
>   
> org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:253)
>   -
>   
> org.tynamo.security.services.impl.SecurityConfiguration$1.call(SecurityConfiguration.java:55)
>   -
>   
> org.tynamo.security.services.impl.SecurityConfiguration$1.call(SecurityConfiguration.java:53)
>   -
>   
> org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
>   -
>   
> org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
>   -
>   
> org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:380)
>   -
>   
> org.tynamo.security.services.impl.SecurityConfiguration.service(SecurityConfiguration.java:53)
>   -
>   
> org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
>   -
>   
> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
>   -
>   
> org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852)
>   -
>   org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171)
>   -
>
>


Re: t5: clear cookie when browser closes

2012-10-26 Thread Thiago H de Paula Figueiredo

On Fri, 26 Oct 2012 11:22:06 -0200, sub  wrote:


Thiago,


Hi!


there already is a ticket:
https://issues.apache.org/jira/browse/TAP5-1394
I voted for it.


Ah, OK, I overlooked that. Thanks!

--
Thiago H. de Paula Figueiredo

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



Re: t5: clear cookie when browser closes

2012-10-26 Thread sub
Thiago,

there already is a ticket:
https://issues.apache.org/jira/browse/TAP5-1394

I voted for it.





--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-clear-cookie-when-browser-closes-tp3380592p5717292.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: t5: clear cookie when browser closes

2012-10-26 Thread Thiago H de Paula Figueiredo

On Fri, 26 Oct 2012 06:30:05 -0200, sub  wrote:


Well I ended up injecting the HttpServletResponse and use
HttpServletResponse.addCookie directly. I really would liked to use the
methods provided by Tapestry to keep the code clean of any workarounds,  
but I don't think this is possible for this issue.


Could you please file a JIRA asking for this missing method?

--
Thiago H. de Paula Figueiredo

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



Re: t5: clear cookie when browser closes

2012-10-26 Thread sub
Well I ended up injecting the HttpServletResponse and use
HttpServletResponse.addCookie directly. I really would liked to use the
methods provided by Tapestry to keep the code clean of any workarounds, but
I don't think this is possible for this issue.

Thanks,
Tim



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-clear-cookie-when-browser-closes-tp3380592p5717271.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: t5: clear cookie when browser closes

2012-10-25 Thread sub
I also have the problem to set a so called "session cookie" with tapestry.

org.apache.tapestry5.services.Cookies Interface is missing (among others)
this method:

public void writeCookieValue(String name, String value, String path, int
maxAge)

So if you want to write a Cookie with a custom path and also a custom maxAge
you can't. The workaround that I used so far is 

public void writeCookieValue(String name, String value, String path)

and set the maxAge global via AppModule:

configuration.add(SymbolConstants.COOKIE_MAX_AGE, "720");


But now I want to switch from the persistent cookie to a session cookie, so
I changed the line to:
configuration.add(SymbolConstants.COOKIE_MAX_AGE, "-1");

which results in this exception:

Exception constructing service 'Cookies': Coercion of -1 to type
org.apache.tapestry5.ioc.util.TimeInterval (via String -->
org.apache.tapestry5.ioc.util.TimeInterval) failed: Unexpected string '-'
(in time interval '-1').

What other options do I have?

Thx
Tim






--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-clear-cookie-when-browser-closes-tp3380592p5717232.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: New article re: T5-Flash integration

2012-10-18 Thread ael
Ioko-Tapestry-Commons 1.11.0 is compatible with T5.3.6 :)

https://github.com/ioko-tapestry-commons/ioko-tapestry-commons

Just build the source to have a jar file.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/New-article-re-T5-Flash-integration-tp2422860p5717048.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: New article re: T5-Flash integration

2012-10-17 Thread ael
Any new link for this?

http://knol.google.com/k/toby-hobson/tapestry5-flash-integration/

Dead link...



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/New-article-re-T5-Flash-integration-tp2422860p5717028.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: T5 and JS UI Frameworks

2012-10-08 Thread Lenny Primak
Sounds like vaadin. We use smartgwt in our apps within tapestry. It works great 
along with an integration layer in the FlowLogix library. 

On Oct 8, 2012, at 6:38 AM, "Wechsung, Wulf"  wrote:

> Hi Everyone,
> 
> I'm currently evaluating a proprietary JavaScript UI Framework for use with 
> Tapestry5. This framework works like ExtJS in that "rich" components are 
> instantiated and placed via JavaScript (basically how you'd do UI programming 
> in Swing). Does anyone here have and experience with using a framework like 
> this together with Tapestry for a larger application?
> 
> Thanks in advance for any pointers or resources!
> 
> Kind Regards, Wulf
> 
> 

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



Re: T5 and JS UI Frameworks

2012-10-08 Thread Lance Java
Many UI frameworks work best with restful web services that return json
responses. You might find tapestry-resteasy a good fit
(http://tynamo.org/tapestry-resteasy+guide)



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-and-JS-UI-Frameworks-tp5716703p5716704.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: [T5] Select, palette, multiselect

2012-09-24 Thread nkv1
Martin Grotzke wrote
> On Fri, 2007-07-27 at 17:37 -0300, Thiago H de Paula Figueiredo wrote:
>> And has anyone implemented a Select-like component for multiple option  
>> selection? It would be very nice to have both multiselect and palette, as  
>> T4 has.
> Take a look at this thread, it's really easy to implement multiselect
> with T5:
> http://www.nabble.com/T5%3A-select-component-with-support-for-attribute-%22multiple%22-tf3880056.html#a10996038
> 
> Cheers,
> Martin
> 
> 
>> 
>> Thiago
>> 
>> -
>> To unsubscribe, e-mail: 

> users-unsubscribe@.apache

>> For additional commands, e-mail: 

> users-help@.apache

> 
> 
> 
> signature.asc (196 bytes)
> ;

link no longer exists



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-Select-palette-multiselect-tp2408343p5716472.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: t5: adding http header

2012-09-23 Thread netdawg
Thanks!! 

Yep, even though java -version on command line shows 1.6, the Eclipse (right
click) project --> properties --> java compiler shows using "JDK 1.5
compliance".  Changed that to 1.6 and sure enough no complaints on the
@Override annotation anymore.

And thanks for that typo catch  ;-).  

In fact, off-topic, but in case anyone would  like to use this code, the
whole expires date can be made redundant by using max-age in the HTTP
request header, per RFC 2616 14.21.  

response.setHeader(CACHE_CTRL, "no-cache, no-store, max-age=0,
must-revalidate"); 

Also see: http://www.mnot.net/blog/2007/05/15/expires_max-age

(this also has a link to an excellent tutorial on caches - must read - basic
message being cache control is probably best handled by web server, if you
can control it,  rather than in your application)



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-adding-http-header-tp3369097p5716463.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: t5: adding http header

2012-09-23 Thread Chris Mylonas
you've got a typo here :)

>  private static final String EXPIRE_DATE = "Exprires";


s/Exprires/Expires/g


i haven't tried it but may give it a go l8r, useful looking service!


off topic but [1] seems relevant
there is a jquery prefilter suggestion when using jquery

[1] = 
http://stackoverflow.com/questions/12506897/is-safari-on-ios-6-caching-ajax-results



On 24/09/2012, at 5:25 AM, netdawg wrote:

> Wulf:  Why (rather how) the @Override annotation ?  I actually had to remove
> it for it work.   
> 
> Anyhooo...here is the complete working example (right or wrong, not
> sure)...comments welcome...
> 
> Step 1.  Created a class in your src/main/java -- SERVICES package - where
> you will find AppModule.java already installed by Tapestry.  In my case, I
> created a class called RevalidateHTTPHeader 
> 
> package org.yourGroupId.yourArtifactId.services;
> 
> import java.io.IOException;
> 
> import org.apache.tapestry5.services.Request;
> import org.apache.tapestry5.services.RequestFilter;
> import org.apache.tapestry5.services.RequestHandler;
> import org.apache.tapestry5.services.Response;
> 
> 
> public class RevalidateHTTPHeader implements RequestFilter 
> {
> 
>  private static final String CACHE_CTRL = "Cache-Control";
>  private static final String EXPIRE_DATE = "Exprires";
> 
>  public boolean service(Request request, Response response,  RequestHandler
> handler) throws IOException 
>  { 
>response.setHeader(CACHE_CTRL, "no-cache, no-store, must-revalidate"); 
>response.setHeader(EXPIRE_DATE, "Sun, 07 Dec 1941  07:55:00 GMT"); 
>return handler.service(request, response);   
>  }
> }
> 
> 
> Step 2.  Within AppModule.java, do two things - 
> 
> a.  declare the following member variable
> 
> RevalidateHTTPHeader nocache = new RevalidateHTTPHeader();
> 
> b.  add the following within contributeRequestHandler method:
> 
>public void contributeRequestHandler(OrderedConfiguration
> configuration,
> @Local
> RequestFilter filter)
>{
>// Each contribution to an ordered configuration has a name, When
> necessary, you may
>// set constraints to precisely control the invocation order of the
> contributed filter
>// within the pipeline.
> 
>///
>//  ADD the custom nocache HTTP header(s)  
> 
>   configuration.add("NoCache", nocache);  
> 
>   //
>  //
> 
> 
>configuration.add("Timing", filter);
>}
> 
> Step 3:   Run Jetty to verify/examine headers - I am using Google Chrome -
> which has a free HTTP Headers extension.  
> http://localhost:8080/yourArtifactId/[yourPage]
> 
> Name   Extension
> Content-Encoding  gzip
> Exprires Sun, 07 Dec 1941  07:55:00 GMT
> Transfer-Encoding  chunked
> Server  Jetty(6.1.26)
> Content-Type text/html; charset=utf-8
> Cache-Controlno-cache, no-store, must-revalidate
> 
> 
> 
> 
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/t5-adding-http-header-tp3369097p5716459.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 



Re: t5: adding http header

2012-09-23 Thread Bob Harner
"probably", not "problem", sorry.

On Sun, Sep 23, 2012 at 3:36 PM, Bob Harner  wrote:
> If the compiler complained about @Override, you are problem using a
> 1.5 JDK and Wulf (I assume) was using 1.6.
>
> On Sun, Sep 23, 2012 at 3:25 PM, netdawg  wrote:
>> Wulf:  Why (rather how) the @Override annotation ?  I actually had to remove
>> it for it work.
>>
>> Anyhooo...here is the complete working example (right or wrong, not
>> sure)...comments welcome...
>>
>> Step 1.  Created a class in your src/main/java -- SERVICES package - where
>> you will find AppModule.java already installed by Tapestry.  In my case, I
>> created a class called RevalidateHTTPHeader
>>
>> package org.yourGroupId.yourArtifactId.services;
>>
>> import java.io.IOException;
>>
>> import org.apache.tapestry5.services.Request;
>> import org.apache.tapestry5.services.RequestFilter;
>> import org.apache.tapestry5.services.RequestHandler;
>> import org.apache.tapestry5.services.Response;
>>
>>
>> public class RevalidateHTTPHeader implements RequestFilter
>> {
>>
>>   private static final String CACHE_CTRL = "Cache-Control";
>>   private static final String EXPIRE_DATE = "Exprires";
>>
>>   public boolean service(Request request, Response response,  RequestHandler
>> handler) throws IOException
>>   {
>> response.setHeader(CACHE_CTRL, "no-cache, no-store, must-revalidate");
>> response.setHeader(EXPIRE_DATE, "Sun, 07 Dec 1941  07:55:00 GMT");
>> return handler.service(request, response);
>>   }
>> }
>>
>>
>> Step 2.  Within AppModule.java, do two things -
>>
>> a.  declare the following member variable
>>
>> RevalidateHTTPHeader nocache = new RevalidateHTTPHeader();
>>
>> b.  add the following within contributeRequestHandler method:
>>
>> public void contributeRequestHandler(OrderedConfiguration
>> configuration,
>>  @Local
>>  RequestFilter filter)
>> {
>> // Each contribution to an ordered configuration has a name, When
>> necessary, you may
>> // set constraints to precisely control the invocation order of the
>> contributed filter
>> // within the pipeline.
>>
>> ///
>> //  ADD the custom nocache HTTP header(s)
>>
>>configuration.add("NoCache", nocache);
>>
>>//
>>   //
>>
>>
>> configuration.add("Timing", filter);
>> }
>>
>> Step 3:   Run Jetty to verify/examine headers - I am using Google Chrome -
>> which has a free HTTP Headers extension.
>> http://localhost:8080/yourArtifactId/[yourPage]
>>
>> Name   Extension
>> Content-Encodinggzip
>> Exprires   Sun, 07 Dec 1941  07:55:00 GMT
>> Transfer-Encoding  chunked
>> ServerJetty(6.1.26)
>> Content-Type   text/html; charset=utf-8
>> Cache-Control  no-cache, no-store, must-revalidate
>>
>>
>>
>>
>>
>> --
>> View this message in context: 
>> http://tapestry.1045711.n5.nabble.com/t5-adding-http-header-tp3369097p5716459.html
>> Sent from the Tapestry - User mailing list archive at Nabble.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: adding http header

2012-09-23 Thread Bob Harner
If the compiler complained about @Override, you are problem using a
1.5 JDK and Wulf (I assume) was using 1.6.

On Sun, Sep 23, 2012 at 3:25 PM, netdawg  wrote:
> Wulf:  Why (rather how) the @Override annotation ?  I actually had to remove
> it for it work.
>
> Anyhooo...here is the complete working example (right or wrong, not
> sure)...comments welcome...
>
> Step 1.  Created a class in your src/main/java -- SERVICES package - where
> you will find AppModule.java already installed by Tapestry.  In my case, I
> created a class called RevalidateHTTPHeader
>
> package org.yourGroupId.yourArtifactId.services;
>
> import java.io.IOException;
>
> import org.apache.tapestry5.services.Request;
> import org.apache.tapestry5.services.RequestFilter;
> import org.apache.tapestry5.services.RequestHandler;
> import org.apache.tapestry5.services.Response;
>
>
> public class RevalidateHTTPHeader implements RequestFilter
> {
>
>   private static final String CACHE_CTRL = "Cache-Control";
>   private static final String EXPIRE_DATE = "Exprires";
>
>   public boolean service(Request request, Response response,  RequestHandler
> handler) throws IOException
>   {
> response.setHeader(CACHE_CTRL, "no-cache, no-store, must-revalidate");
> response.setHeader(EXPIRE_DATE, "Sun, 07 Dec 1941  07:55:00 GMT");
> return handler.service(request, response);
>   }
> }
>
>
> Step 2.  Within AppModule.java, do two things -
>
> a.  declare the following member variable
>
> RevalidateHTTPHeader nocache = new RevalidateHTTPHeader();
>
> b.  add the following within contributeRequestHandler method:
>
> public void contributeRequestHandler(OrderedConfiguration
> configuration,
>  @Local
>  RequestFilter filter)
> {
> // Each contribution to an ordered configuration has a name, When
> necessary, you may
> // set constraints to precisely control the invocation order of the
> contributed filter
> // within the pipeline.
>
> ///
> //  ADD the custom nocache HTTP header(s)
>
>configuration.add("NoCache", nocache);
>
>//
>   //
>
>
> configuration.add("Timing", filter);
> }
>
> Step 3:   Run Jetty to verify/examine headers - I am using Google Chrome -
> which has a free HTTP Headers extension.
> http://localhost:8080/yourArtifactId/[yourPage]
>
> Name   Extension
> Content-Encodinggzip
> Exprires   Sun, 07 Dec 1941  07:55:00 GMT
> Transfer-Encoding  chunked
> ServerJetty(6.1.26)
> Content-Type   text/html; charset=utf-8
> Cache-Control  no-cache, no-store, must-revalidate
>
>
>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/t5-adding-http-header-tp3369097p5716459.html
> Sent from the Tapestry - User mailing list archive at Nabble.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: adding http header

2012-09-23 Thread netdawg
Wulf:  Why (rather how) the @Override annotation ?  I actually had to remove
it for it work.   

Anyhooo...here is the complete working example (right or wrong, not
sure)...comments welcome...

Step 1.  Created a class in your src/main/java -- SERVICES package - where
you will find AppModule.java already installed by Tapestry.  In my case, I
created a class called RevalidateHTTPHeader 

package org.yourGroupId.yourArtifactId.services;

import java.io.IOException;

import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.RequestFilter;
import org.apache.tapestry5.services.RequestHandler;
import org.apache.tapestry5.services.Response;


public class RevalidateHTTPHeader implements RequestFilter 
{

  private static final String CACHE_CTRL = "Cache-Control";
  private static final String EXPIRE_DATE = "Exprires";
 
  public boolean service(Request request, Response response,  RequestHandler
handler) throws IOException 
  { 
response.setHeader(CACHE_CTRL, "no-cache, no-store, must-revalidate"); 
response.setHeader(EXPIRE_DATE, "Sun, 07 Dec 1941  07:55:00 GMT"); 
return handler.service(request, response);   
  }
}


Step 2.  Within AppModule.java, do two things - 

a.  declare the following member variable

RevalidateHTTPHeader nocache = new RevalidateHTTPHeader();

b.  add the following within contributeRequestHandler method:

public void contributeRequestHandler(OrderedConfiguration
configuration,
 @Local
 RequestFilter filter)
{
// Each contribution to an ordered configuration has a name, When
necessary, you may
// set constraints to precisely control the invocation order of the
contributed filter
// within the pipeline.

///
//  ADD the custom nocache HTTP header(s)  
 
   configuration.add("NoCache", nocache);  

   //
  //


configuration.add("Timing", filter);
}

Step 3:   Run Jetty to verify/examine headers - I am using Google Chrome -
which has a free HTTP Headers extension.  
http://localhost:8080/yourArtifactId/[yourPage]

Name   Extension
Content-Encodinggzip
Exprires   Sun, 07 Dec 1941  07:55:00 GMT
Transfer-Encoding  chunked
ServerJetty(6.1.26)
Content-Type   text/html; charset=utf-8
Cache-Control  no-cache, no-store, must-revalidate





--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-adding-http-header-tp3369097p5716459.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: T5 Auto Binding of DAOs

2012-08-30 Thread Dmitry Gusev
There's a typo in the code snippet, should be:

String className = interfacesPackage.getName() + ".impl." +
intf.getSimpleName() + "Impl";

We need just package name, not its toString() presentation which is
"package com.x.y.z"

On Thu, Aug 16, 2012 at 11:34 AM, Dmitry Gusev wrote:

> Thanks for sharing, Norman!
>
> Here's mine implementation:
>
> public static void bind(ServiceBinder binder) throwsClassNotFoundException
>
> {
>
> autobindServices(binder, ProjectDAO.class.getPackage());
>
> autobindServices(binder, ProjectManager.class.getPackage());
>
>
>
> ...
>
> }
>
>
> @SuppressWarnings({"unchecked", "rawtypes"})
>
> private static void autobindServices(ServiceBinder binder, Package
> interfacesPackage) throws ClassNotFoundException
>
> {
>
> List> interfaces =
> Utils.getClassesForPackage(interfacesPackage.getName());
>
> for (Class intf : interfaces) {
>
> String className = interfacesPackage + ".impl." +
> intf.getSimpleName() + "Impl";
>
> try {
>
> Class impl = Class.forName(className);
>
> binder.bind(intf, impl);
>
> }
>
> catch (ClassNotFoundException e) {
>
> logger.warn("Class not found during autobinding: {}",
> className);
>
> }
>
> }
>
> }
>
>
> On Thu, Aug 16, 2012 at 2:33 AM, Norman Franke  wrote:
>
>> Something similar was asked in another thread, but I figured others may
>> find this helpful.
>>
>> I wanted to automatically bind my interfaces and implementations of my
>> numerous DAOs in my AppModule. It's pretty easy, so here is what I idd.
>> This is called from the bind static method. Obviously you'd need to change
>> the package names. My naming convention is to put the implementation
>> packages in a sub ".impl" package, e.g. com.myasd.db.dao.impl in my case.
>> Classes then are suffixed with "Impl" to make Eclipse's package
>> auto-complete suggestions work better. I've been using this for a few
>> years, at lest.
>>
>> @SuppressWarnings({ "unchecked", "rawtypes" })
>> static void bindDAOs(ServiceBinder binder) {
>> try {
>> ClassLoader contextClassLoader =
>> Thread.currentThread().getContextClassLoader();
>> List> daos =
>> PackageEnumerator.getClassesForPackage("com.myasd.db.dao");
>> for (Class dao : daos) {
>> String pkg = dao.getPackage().getName();
>> String cls = dao.getSimpleName();
>> try {
>> Class impl =
>> contextClassLoader.loadClass(pkg+".impl."+cls+"Impl");
>> binder.bind(dao,
>> impl).scope(ScopeConstants.PERTHREAD);
>> } catch (ClassNotFoundException e) {
>> // Ignore, we just won't bind that class.
>> }
>> }
>> } catch (ClassNotFoundException e) {
>> e.printStackTrace();
>> }
>> }
>>
>>
>> Helper method borrowed from who-knows-where:
>>
>> public static List> getClassesForPackage(String packageName)
>> throws ClassNotFoundException {
>> // This will hold a list of directories matching the pckgname.
>> // There may be more than one if a package is split over multiple
>> // jars/paths
>> List> classes = new ArrayList>();
>> ArrayList directories = new ArrayList();
>> try {
>> ClassLoader cld =
>> Thread.currentThread().getContextClassLoader();
>> if (cld == null) {
>> throw new ClassNotFoundException("Can't get class
>> loader.");
>> }
>> // Ask for all resources for the path
>> Enumeration resources =
>> cld.getResources(packageName.replace('.', '/'));
>> while (resources.hasMoreElements()) {
>> URL res = resources.nextElement();
>> if (res.getProtocol().equalsIgnoreCase("jar")) {
>> JarURLConnection conn = (JarURLConnection)
>> res.openConnection();
>> JarFile jar = conn.getJarFile();
>> for (JarEntry e : Collections.list(jar.entries())) {
>>
>> if
>> (e.getName().startsWith(packageName.replace('.', '/')) &&
>> e.getName().endsWith(".class")
>> && !e.getName().contains("$")) {
>> String className = e.getName().replace("/",
>> ".").substring(0, e.getName().length() - 6);
>> System.out.println(className);
>> classes.add(Class.forName(className));
>> }
>> }
>> } else
>> directories.add(new
>> File(URLDecoder.decode(res.getPath(), "UTF-8")));
>> }
>> } catch (NullPointerException x) {
>> throw new ClassNotFoundException(packageName + 

Re: T5: how to catch the exceptions thrown by the event handler?

2012-08-20 Thread Yunhua Sang
Thanks Thiago and Lenny. It's my bad, I messed up the events chain.

On Mon, Aug 20, 2012 at 3:18 PM, Lenny Primak wrote:

> Tynamo.org has an excellent tapestry-exceptionpage module just for this
> purpose as well.
>
>
>
> On Aug 20, 2012, at 10:09 AM, Yunhua Sang  wrote:
>
> > Hi there,
> >
> > Tapestry version: 5.3.3
> >
> > How to catch the exceptions thrown by the event handler?
> >
> > e.g.:
> >try {
> >resources.triggerEvent("anEvent", new Object[]{}, null);
> >} catch (Exception e) {
> >logger.error("Error occurred.", e);
> >form.recordError(e.getMessage());
> >}
> > But seems that the catch parts never get executed, T5 just redirects the
> > request to the exception page.
> >
> > Thanks,
> > Yunhua
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: T5: how to catch the exceptions thrown by the event handler?

2012-08-20 Thread Lenny Primak
Tynamo.org has an excellent tapestry-exceptionpage module just for this purpose 
as well. 



On Aug 20, 2012, at 10:09 AM, Yunhua Sang  wrote:

> Hi there,
> 
> Tapestry version: 5.3.3
> 
> How to catch the exceptions thrown by the event handler?
> 
> e.g.:
>try {
>resources.triggerEvent("anEvent", new Object[]{}, null);
>} catch (Exception e) {
>logger.error("Error occurred.", e);
>form.recordError(e.getMessage());
>}
> But seems that the catch parts never get executed, T5 just redirects the
> request to the exception page.
> 
> Thanks,
> Yunhua

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



Re: T5: how to catch the exceptions thrown by the event handler?

2012-08-20 Thread Thiago H de Paula Figueiredo
On Mon, 20 Aug 2012 15:13:04 -0300, Yunhua Sang   
wrote:



Thanks Thiago. I am a bit confused from the API, it said:

 * @throws org.apache.tapestry5.runtime.ComponentEventException
 * if an event handler method throws a checked or  
unchecked

exception
but seems it did not go this way.


Ouch, I'm sorry, I overlooked that. I don't know what's happening in your  
case.


--
Thiago H. de Paula Figueiredo

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



Re: T5: how to catch the exceptions thrown by the event handler?

2012-08-20 Thread Yunhua Sang
Thanks Thiago. I am a bit confused from the API, it said:

 * @throws org.apache.tapestry5.runtime.ComponentEventException
 * if an event handler method throws a checked or unchecked
exception

but seems it did not go this way.


On Mon, Aug 20, 2012 at 1:07 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Mon, 20 Aug 2012 12:09:25 -0300, Yunhua Sang 
> wrote:
>
>  Hi there,
>>
>
> Hi!
>
>
>  Tapestry version: 5.3.3
>>
>> How to catch the exceptions thrown by the event handler?
>>
>> e.g.:
>> try {
>> resources.triggerEvent("**anEvent", new Object[]{},
>> null);
>> } catch (Exception e) {
>> logger.error("Error occurred.", e);
>> form.recordError(e.getMessage(**));
>> }
>>
>
> triggerEvent() just triggers the event, it doesn't handle it.
>
>
>  But seems that the catch parts never get executed, T5 just redirects the
>> request to the exception page.
>>
>
> You can use a global exception page.
>
>
> --
> Thiago H. de Paula Figueiredo
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: T5: how to catch the exceptions thrown by the event handler?

2012-08-20 Thread Thiago H de Paula Figueiredo
On Mon, 20 Aug 2012 12:09:25 -0300, Yunhua Sang   
wrote:



Hi there,


Hi!


Tapestry version: 5.3.3

How to catch the exceptions thrown by the event handler?

e.g.:
try {
resources.triggerEvent("anEvent", new Object[]{}, null);
} catch (Exception e) {
logger.error("Error occurred.", e);
form.recordError(e.getMessage());
}


triggerEvent() just triggers the event, it doesn't handle it.


But seems that the catch parts never get executed, T5 just redirects the
request to the exception page.


You can use a global exception page.


--
Thiago H. de Paula Figueiredo

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



Re: T5 Auto Binding of DAOs

2012-08-16 Thread Michael Prescott
I might.. yes.  I don't necessarily need a lot of content, but a paragraph
and a few code snippets for each service would be a fantastic jump-off
point.

One side effect of all Tapestry's injection, reflection-based config and
event binding, and literate APIs, is that the explorability suffers a bit.
 I can't rely on my IDE auto-completing the relevant events on an
interface, I've got to find some relevant documentation.

It's a very powerful thing to know what all your choices are within the IDE.

Michael

 On 15 August 2012 22:52, Thiago H de Paula Figueiredo
wrote:

> On Wed, 15 Aug 2012 19:47:50 -0300, Michael Prescott <
> michael.r.presc...@gmail.com> wrote:
>
>  That's very nifty, Norman.  This is a simultaneously inspiring and
>> depressing reminder that despite having used Tapestry since version 3, I
>> still feel like a total noob. :-)  I'd love to see a blog series on
>> "Services you never knew about and fun things to do with them!"
>>
>
> Would you guys buy a book with this kind of stuff?
>
>
> --
> Thiago H. de Paula Figueiredo
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: T5 Auto Binding of DAOs

2012-08-16 Thread Muhammad Gelbana
I remember tapestry that by searching for implementation classes in the
same package by the same name but suffixed by "Impl". Like "MySvc" as in
interface and "MySvcImpl" as the implementation.

1. When I wan'ted to extract that piece of info from the docs I couldn't
find it ! Is it deprecated ?!
2. The only advantage from the codes listed in this thread is placing the
implementation classes in a sub-package called "impl", correct ?

On Thu, Aug 16, 2012 at 1:51 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Thu, 16 Aug 2012 03:48:17 -0300, Dmitry Gusev 
> wrote:
>
>  Hi,
>>
>
> Hi!
>
>
>  correct me if I wrong, but you can't get instance of ClassNameLocator in
>> module's bind method, right? Since the registry is not started yet.
>>
>
> Nope, but maybe Tapestry-IoC could provide it anyway. JIRA please?
>
>
> --
> Thiago H. de Paula Figueiredo
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org
>
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
*Regards,*
*Muhammad Gelbana
Java Developer*


Re: T5 Auto Binding of DAOs

2012-08-16 Thread Thiago H de Paula Figueiredo
On Thu, 16 Aug 2012 03:48:17 -0300, Dmitry Gusev   
wrote:



Hi,


Hi!


correct me if I wrong, but you can't get instance of ClassNameLocator in
module's bind method, right? Since the registry is not started yet.


Nope, but maybe Tapestry-IoC could provide it anyway. JIRA please?

--
Thiago H. de Paula Figueiredo

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



Re: T5 Auto Binding of DAOs

2012-08-16 Thread Dmitry Gusev
Thanks for sharing, Norman!

Here's mine implementation:

public static void bind(ServiceBinder binder) throwsClassNotFoundException

{

autobindServices(binder, ProjectDAO.class.getPackage());

autobindServices(binder, ProjectManager.class.getPackage());



...

}


@SuppressWarnings({"unchecked", "rawtypes"})

private static void autobindServices(ServiceBinder binder, Package
interfacesPackage) throws ClassNotFoundException

{

List> interfaces =
Utils.getClassesForPackage(interfacesPackage.getName());

for (Class intf : interfaces) {

String className = interfacesPackage + ".impl." +
intf.getSimpleName() + "Impl";

try {

Class impl = Class.forName(className);

binder.bind(intf, impl);

}

catch (ClassNotFoundException e) {

logger.warn("Class not found during autobinding: {}",
className);

}

}

}


On Thu, Aug 16, 2012 at 2:33 AM, Norman Franke  wrote:

> Something similar was asked in another thread, but I figured others may
> find this helpful.
>
> I wanted to automatically bind my interfaces and implementations of my
> numerous DAOs in my AppModule. It's pretty easy, so here is what I idd.
> This is called from the bind static method. Obviously you'd need to change
> the package names. My naming convention is to put the implementation
> packages in a sub ".impl" package, e.g. com.myasd.db.dao.impl in my case.
> Classes then are suffixed with "Impl" to make Eclipse's package
> auto-complete suggestions work better. I've been using this for a few
> years, at lest.
>
> @SuppressWarnings({ "unchecked", "rawtypes" })
> static void bindDAOs(ServiceBinder binder) {
> try {
> ClassLoader contextClassLoader =
> Thread.currentThread().getContextClassLoader();
> List> daos =
> PackageEnumerator.getClassesForPackage("com.myasd.db.dao");
> for (Class dao : daos) {
> String pkg = dao.getPackage().getName();
> String cls = dao.getSimpleName();
> try {
> Class impl =
> contextClassLoader.loadClass(pkg+".impl."+cls+"Impl");
> binder.bind(dao, impl).scope(ScopeConstants.PERTHREAD);
> } catch (ClassNotFoundException e) {
> // Ignore, we just won't bind that class.
> }
> }
> } catch (ClassNotFoundException e) {
> e.printStackTrace();
> }
> }
>
>
> Helper method borrowed from who-knows-where:
>
> public static List> getClassesForPackage(String packageName)
> throws ClassNotFoundException {
> // This will hold a list of directories matching the pckgname.
> // There may be more than one if a package is split over multiple
> // jars/paths
> List> classes = new ArrayList>();
> ArrayList directories = new ArrayList();
> try {
> ClassLoader cld =
> Thread.currentThread().getContextClassLoader();
> if (cld == null) {
> throw new ClassNotFoundException("Can't get class
> loader.");
> }
> // Ask for all resources for the path
> Enumeration resources =
> cld.getResources(packageName.replace('.', '/'));
> while (resources.hasMoreElements()) {
> URL res = resources.nextElement();
> if (res.getProtocol().equalsIgnoreCase("jar")) {
> JarURLConnection conn = (JarURLConnection)
> res.openConnection();
> JarFile jar = conn.getJarFile();
> for (JarEntry e : Collections.list(jar.entries())) {
>
> if
> (e.getName().startsWith(packageName.replace('.', '/')) &&
> e.getName().endsWith(".class")
> && !e.getName().contains("$")) {
> String className = e.getName().replace("/",
> ".").substring(0, e.getName().length() - 6);
> System.out.println(className);
> classes.add(Class.forName(className));
> }
> }
> } else
> directories.add(new
> File(URLDecoder.decode(res.getPath(), "UTF-8")));
> }
> } catch (NullPointerException x) {
> throw new ClassNotFoundException(packageName + " does not
> appear to be "
> + "a valid package (Null pointer exception)");
> } catch (UnsupportedEncodingException encex) {
> throw new ClassNotFoundException(packageName + " does not
> appear to be "
> + "a valid package (Unsupported encoding)");
> } catch (IOException ioex) {
> throw new ClassNotFoundException("IOException was thrown when
> trying " + "to get all 

Re: T5 Auto Binding of DAOs

2012-08-15 Thread Dmitry Gusev
Hi,

correct me if I wrong, but you can't get instance of ClassNameLocator in
module's bind method, right?
Since the registry is not started yet.

On Thu, Aug 16, 2012 at 2:43 AM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Wed, 15 Aug 2012 19:33:24 -0300, Norman Franke 
> wrote:
>
>  Helper method borrowed from who-knows-where:
>>
>> public static List> getClassesForPackage(String packageName)
>> throws ClassNotFoundException {
>>
>
> Have you taken a look at Tapestry's ClassNameLocator and
> ClassNameLocatorImpl? When I need something like that, that's what I've
> used.
>
> --
> Thiago H. de Paula Figueiredo
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@tapestry.**apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com


Re: T5 Auto Binding of DAOs

2012-08-15 Thread Thiago H de Paula Figueiredo
On Wed, 15 Aug 2012 19:47:50 -0300, Michael Prescott  
 wrote:



That's very nifty, Norman.  This is a simultaneously inspiring and
depressing reminder that despite having used Tapestry since version 3, I
still feel like a total noob. :-)  I'd love to see a blog series on
"Services you never knew about and fun things to do with them!"


Would you guys buy a book with this kind of stuff?

--
Thiago H. de Paula Figueiredo

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



Re: T5 Auto Binding of DAOs

2012-08-15 Thread Norman Franke
It was an internal class when I first started, and I generally won't use 
classes in internal packages. I see it's been moved, so that may very well be a 
better idea.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Aug 15, 2012, at 6:43 PM, Thiago H de Paula Figueiredo wrote:

> On Wed, 15 Aug 2012 19:33:24 -0300, Norman Franke  wrote:
> 
>> Helper method borrowed from who-knows-where:
>> 
>>public static List> getClassesForPackage(String packageName) 
>> throws ClassNotFoundException {
> 
> Have you taken a look at Tapestry's ClassNameLocator and 
> ClassNameLocatorImpl? When I need something like that, that's what I've used.
> 
> -- 
> Thiago H. de Paula Figueiredo
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 



Re: T5 Auto Binding of DAOs

2012-08-15 Thread Michael Prescott
That's very nifty, Norman.  This is a simultaneously inspiring and
depressing reminder that despite having used Tapestry since version 3, I
still feel like a total noob. :-)  I'd love to see a blog series on
"Services you never knew about and fun things to do with them!"

Michael

On 15 August 2012 18:33, Norman Franke  wrote:

> Something similar was asked in another thread, but I figured others may
> find this helpful.
>
> I wanted to automatically bind my interfaces and implementations of my
> numerous DAOs in my AppModule. It's pretty easy, so here is what I idd.
> This is called from the bind static method. Obviously you'd need to change
> the package names. My naming convention is to put the implementation
> packages in a sub ".impl" package, e.g. com.myasd.db.dao.impl in my case.
> Classes then are suffixed with "Impl" to make Eclipse's package
> auto-complete suggestions work better. I've been using this for a few
> years, at lest.
>
> @SuppressWarnings({ "unchecked", "rawtypes" })
> static void bindDAOs(ServiceBinder binder) {
> try {
> ClassLoader contextClassLoader =
> Thread.currentThread().getContextClassLoader();
> List> daos =
> PackageEnumerator.getClassesForPackage("com.myasd.db.dao");
> for (Class dao : daos) {
> String pkg = dao.getPackage().getName();
> String cls = dao.getSimpleName();
> try {
> Class impl =
> contextClassLoader.loadClass(pkg+".impl."+cls+"Impl");
> binder.bind(dao, impl).scope(ScopeConstants.PERTHREAD);
> } catch (ClassNotFoundException e) {
> // Ignore, we just won't bind that class.
> }
> }
> } catch (ClassNotFoundException e) {
> e.printStackTrace();
> }
> }
>
>
> Helper method borrowed from who-knows-where:
>
> public static List> getClassesForPackage(String packageName)
> throws ClassNotFoundException {
> // This will hold a list of directories matching the pckgname.
> // There may be more than one if a package is split over multiple
> // jars/paths
> List> classes = new ArrayList>();
> ArrayList directories = new ArrayList();
> try {
> ClassLoader cld =
> Thread.currentThread().getContextClassLoader();
> if (cld == null) {
> throw new ClassNotFoundException("Can't get class
> loader.");
> }
> // Ask for all resources for the path
> Enumeration resources =
> cld.getResources(packageName.replace('.', '/'));
> while (resources.hasMoreElements()) {
> URL res = resources.nextElement();
> if (res.getProtocol().equalsIgnoreCase("jar")) {
> JarURLConnection conn = (JarURLConnection)
> res.openConnection();
> JarFile jar = conn.getJarFile();
> for (JarEntry e : Collections.list(jar.entries())) {
>
> if
> (e.getName().startsWith(packageName.replace('.', '/')) &&
> e.getName().endsWith(".class")
> && !e.getName().contains("$")) {
> String className = e.getName().replace("/",
> ".").substring(0, e.getName().length() - 6);
> System.out.println(className);
> classes.add(Class.forName(className));
> }
> }
> } else
> directories.add(new
> File(URLDecoder.decode(res.getPath(), "UTF-8")));
> }
> } catch (NullPointerException x) {
> throw new ClassNotFoundException(packageName + " does not
> appear to be "
> + "a valid package (Null pointer exception)");
> } catch (UnsupportedEncodingException encex) {
> throw new ClassNotFoundException(packageName + " does not
> appear to be "
> + "a valid package (Unsupported encoding)");
> } catch (IOException ioex) {
> throw new ClassNotFoundException("IOException was thrown when
> trying " + "to get all resources for "
> + packageName);
> }
>
> // For every directory identified capture all the .class files
> for (File directory : directories) {
> if (directory.exists()) {
> // Get the list of the files contained in the package
> String[] files = directory.list();
> for (String file : files) {
> // we are only interested in .class files
> if (file.endsWith(".class")) {
> // removes the .class extension
> classes.add(Class.forName(packageName + '.' +
> file.substring(0, file.length() - 6)));
> }
> }
> } else {
> 

Re: T5 Auto Binding of DAOs

2012-08-15 Thread Thiago H de Paula Figueiredo

On Wed, 15 Aug 2012 19:33:24 -0300, Norman Franke  wrote:


Helper method borrowed from who-knows-where:

public static List> getClassesForPackage(String  
packageName) throws ClassNotFoundException {


Have you taken a look at Tapestry's ClassNameLocator and  
ClassNameLocatorImpl? When I need something like that, that's what I've  
used.


--
Thiago H. de Paula Figueiredo

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



Re: T5: override numeric validator message for specific field

2012-08-15 Thread Thiago H de Paula Figueiredo
On Wed, 15 Aug 2012 09:16:58 -0300, Dmitriy Vsekhvalnov  
 wrote:



Hello,


Hi!



  I have BigDecimal property named: hourlyRate,  default validator  
message

is: 'You must provide numeric value for Hourly Rate'

  how i can override it with page.properties?
Neither number-format-exception nor hourlyRate-number-message keys work.


Try this:  
http://tapestry.1045711.n5.nabble.com/Override-numericformat-error-message-td4755753.html


--
Thiago H. de Paula Figueiredo

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



Re: T5: standard validator for decimal numbers with 2 digits?

2012-08-14 Thread Ray Nicholus
Either contribute a Validator and/or write some javascript.

On Tue, Aug 14, 2012 at 12:50 PM, Dmitriy Vsekhvalnov <
dvsekhval...@gmail.com> wrote:

> Hi everybody,
>
>   stupidly, but can't find it:  Can i have input field for double values,
> which restricts up to 2 digits after point?
>
> Thanks.
>


Re: T5: How to custome the GridPager ?

2012-08-13 Thread Bob.Sky
Thank you antalk ,the problem has been done.
I use this annotation
"@Component(parameters = { "source=dataSource",
"rowsPerPage=rowsPerPage", "currentPage=currentPage" })
private GridPager eloqPager;" to connect the my override pager to the
grid.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-How-to-custome-the-GridPager-tp5715219p5715376.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: T5: How to custome the GridPager ?

2012-08-10 Thread antalk
Hi,

Depends on what you want to change ?

1. Layout - colors -> change the CSS
2. Structure and or behaviour -> override the GridPager class





--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-How-to-custome-the-GridPager-tp5715219p5715220.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: T5: How to Select Component with Encoder shows multiple label?

2012-07-30 Thread Geoff Callender
Try 
http://jumpstart.doublenegative.com.au/jumpstart/examples/select/totalcontrolobject

Geoff

On 30/07/2012, at 8:23 PM, wesleywj2 wrote:

> hi,
> 
> i have a valueEncoder implemented as List of object used for select
> component, currently the label of the select component is always the id of
> object, but i want to show the label as multiple field from the object
> itself. eg. my DataObject class has 3 private fields 
> 
> 1) dataId
> 2) dataCode
> 3) dataName
> 
> currently the select component just show dataId field as the drop down
> selection.
> 
> what i want is that the label will show dataCode concatenate with dataName. 
> 
> please advice
> 
> 
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/T5-How-to-Select-Component-with-Encoder-shows-multiple-label-tp5714875.html
> Sent from the Tapestry - User mailing list archive at Nabble.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 APPLICATION_VERSION

2012-07-19 Thread Norman Franke
Thanks, BTW. Not sure how I missed that one. I guess I was looking to inject a 
service.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Jul 12, 2012, at 3:06 PM, Joost Schouten (mailing lists) wrote:

> This should do the trick:
> 
> @Inject
> @Symbol(SymbolConstants.APPLICATION_VERSION)
> private String appVersion;
> 
> Cheers,
> Joost
> 
> 
> On Jul 12, 2012, at 8:58 PM, Norman Franke wrote:
> 
>> I give up. How do I programmatically get the value of the 
>> APPLICATION_VERSION that I set in the AppModule? In my login page, I'd like 
>> to display the version. I'm not sure what to inject. I've tried a number of 
>> things, but nothing seems to work. Where is it stored?
>> 
>> Norman Franke
>> Answering Service for Directors, Inc.
>> www.myasd.com
>> 
>> 
>> 
> 



Re: T5 APPLICATION_VERSION

2012-07-12 Thread Joost Schouten (mailing lists)
This should do the trick:

@Inject
@Symbol(SymbolConstants.APPLICATION_VERSION)
private String appVersion;

 Cheers,
Joost


On Jul 12, 2012, at 8:58 PM, Norman Franke wrote:

> I give up. How do I programmatically get the value of the APPLICATION_VERSION 
> that I set in the AppModule? In my login page, I'd like to display the 
> version. I'm not sure what to inject. I've tried a number of things, but 
> nothing seems to work. Where is it stored?
> 
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
> 
> 
> 



Re: T5 template expansion for component

2012-06-19 Thread Norman Franke
On Jun 19, 2012, at 12:43 PM, Howard Lewis Ship wrote:

> How about ?
> 
> On Tue, Jun 19, 2012 at 8:47 AM, Norman Franke  wrote:
> 
>> I'm creating a list of t:checkbox items and I want to label them. I can't
>> use t:label, since I need to customize the label.
>> 
>> At first, I tried: ${component:myCheckItemID} since the documentation says
>> that should result in the clientId for the compoent. It doesn't, I get
>> basically the toString() of the Checkbox object. I can't do
>> ${component:myCheckItemID.clientId} either, since that results in an error.
>> 
>> Short of injecting the component into my class and making it a property,
>> how do I get the clientId of the checkbox component?

That would work, but I was thinking more general case. 

This document: 
http://tapestry.apache.org/component-parameters.html#ComponentParameters-bindingparameters
seems to indicate that it should give me "The id of another component within 
the same template", but really gives you the actual component and you can't use 
the dot notation to then access its properties.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com




Re: T5 template expansion for component

2012-06-19 Thread Dusko Jovanovski
I don't see why you couldn't customize t:label, it supports informal
parameters, everything you pass as an attribute will be passed down to the
 tag. In the for parameter of t:label you pass the server id of
the component.

On Tue, Jun 19, 2012 at 5:47 PM, Norman Franke  wrote:

> I'm creating a list of t:checkbox items and I want to label them. I can't
> use t:label, since I need to customize the label.
>
> At first, I tried: ${component:myCheckItemID} since the documentation says
> that should result in the clientId for the compoent. It doesn't, I get
> basically the toString() of the Checkbox object. I can't do
> ${component:myCheckItemID.clientId} either, since that results in an error.
>
> Short of injecting the component into my class and making it a property,
> how do I get the clientId of the checkbox component?
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
>
>
>
>


Re: T5 template expansion for component

2012-06-19 Thread Howard Lewis Ship
How about ?

On Tue, Jun 19, 2012 at 8:47 AM, Norman Franke  wrote:

> I'm creating a list of t:checkbox items and I want to label them. I can't
> use t:label, since I need to customize the label.
>
> At first, I tried: ${component:myCheckItemID} since the documentation says
> that should result in the clientId for the compoent. It doesn't, I get
> basically the toString() of the Checkbox object. I can't do
> ${component:myCheckItemID.clientId} either, since that results in an error.
>
> Short of injecting the component into my class and making it a property,
> how do I get the clientId of the checkbox component?
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
>
>
>
>


-- 
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


Re: T5 template expansion for component

2012-06-19 Thread Howard Lewis Ship
So you have a CustomLabel component of some kind, right?  What you need is
to pass the Checkbox component as a parameter of type Field, and invoke
Field.getLabel().




And inside CustomLabel.java:

  @Parameter(required=true)
  private Field field;

For extra credit:




And inside CustomLabel.java:

  @Parameter(required=true, defaultPrefix=BindingConstants.COMPONENT)
  private Field field;


On Tue, Jun 19, 2012 at 9:43 AM, Howard Lewis Ship  wrote:

> How about ?
>
>
> On Tue, Jun 19, 2012 at 8:47 AM, Norman Franke  wrote:
>
>> I'm creating a list of t:checkbox items and I want to label them. I can't
>> use t:label, since I need to customize the label.
>>
>> At first, I tried: ${component:myCheckItemID} since the documentation
>> says that should result in the clientId for the compoent. It doesn't, I get
>> basically the toString() of the Checkbox object. I can't do
>> ${component:myCheckItemID.clientId} either, since that results in an error.
>>
>> Short of injecting the component into my class and making it a property,
>> how do I get the clientId of the checkbox component?
>>
>> Norman Franke
>> Answering Service for Directors, Inc.
>> www.myasd.com
>>
>>
>>
>>
>
>
> --
> 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
>



-- 
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


Re: T5 and Redis

2012-06-01 Thread Howard Lewis Ship
I don't know the Redis/Jedis API, but you probably want to close the
connection you open explicitly.

See 
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/services/PerthreadManager.html#addThreadCleanupListener(org.apache.tapestry5.ioc.services.ThreadCleanupListener)

I would tend to add a method annotated with @PostConstruct that
injects the PerthreadManager as the place to register the listener,
i.e.,

  @PostConstruct
  public void registerForCleanup(PerthreadManager manager) {
manager.addThreadCleanupListener(new ThreadCleanupListener() { ... });
  }

On Thu, May 31, 2012 at 4:29 AM, Angelo C.  wrote:
> Jedis has a pool, maybe it can be implemented as Hibernate.
>
> Is there anybody using Redis with T5 and how? Thanks
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/T5-and-Redis-tp5713546p5713552.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> -
> 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



Re: T5 and Redis

2012-05-31 Thread Angelo C.
Jedis has a pool, maybe it can be implemented as Hibernate.

Is there anybody using Redis with T5 and how? Thanks

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-and-Redis-tp5713546p5713552.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: T5 and Redis

2012-05-31 Thread Lance Java
You could follow the same pattern as used for a hibernate session. See this
recent thread for how it's done
http://tapestry.1045711.n5.nabble.com/About-per-thread-service-td5713515.html

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-and-Redis-tp5713546p5713548.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: T5 How can I pass a block to a component?

2012-05-23 Thread Steve Eynon
In Test.tml you could also do:



 wrote:
> I found the solution:
>
>
> .tml:
> public class Component1 {
>
>    @Parameter
>    @Property
>    private Block block1;
> }
>
> .java:
> contenido bloque: 
>
> Test.tml:
> 
>        
>            texto bloque uno
>        
>    
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/T5-How-can-I-pass-a-block-to-a-component-tp5713371p5713372.html
> Sent from the Tapestry - User mailing list archive at Nabble.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 How can I pass a block to a component?

2012-05-23 Thread iberck
I found the solution:


.tml:
public class Component1 {

@Parameter
@Property
private Block block1;
}

.java:
contenido bloque: 

Test.tml:


texto bloque uno




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-How-can-I-pass-a-block-to-a-component-tp5713371p5713372.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: [T5] Dynamic Graphics

2012-05-23 Thread Thiago H. de Paula Figueiredo
On Wed, 23 May 2012 11:29:27 -0300, Fuhrmann, Hauke  
 wrote:



Hi there,


Hi!


is there any support to draw graphics in Tapestry?
I'm looking for some component that offers some standard Java Graphics2D
object and renders this as some possible web-graphics at the client,
e.g. HTML5 canvas with Javascript. Is there any such support?


Just use some JavaScript framework/library for that.


Additionally I'd like to be able to update the graphics via Ajax.


You can use a Zone or use some custom JS code for it.

--
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



  1   2   3   4   5   6   7   8   9   10   >