Re: [ANN] Manning Publications translates my Tapestry 5 book

2010-06-18 Thread Peter Stavrinides
Hi Igor,

Please let us know when the book is ready for pre-order.

thanks,
Peter

- Original Message -
From: Robin Komiwes robin.komi...@gmail.com
To: Tapestry users users@tapestry.apache.org, adam saltiel 
adam.salt...@gmail.com
Sent: Saturday, 12 June, 2010 23:38:34 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: Re: [ANN] Manning Publications translates my Tapestry 5 book

Igor, it just rocks.

On Sat, Jun 12, 2010 at 5:31 PM, Adam Saltiel adam.salt...@gmail.com wrote:
 Well done. Are you allowed to update it as necessary? My understanding is 
 that it is very comprehensive. This is good news for everyone interested in 
 Tapestry development.
 I have worked on a site architected by Igor using good Tapestry solutions. So 
 certainly interests me.

 Adam
 --Original Message--
 From: Markus Feindler
 To: Tapestry users
 ReplyTo: Tapestry users
 Subject: Re: [ANN] Manning Publications translates my Tapestry 5 book
 Sent: 11 Jun 2010 19:35

 Great news, I enjoyed reading the german version of your book!
 Congratulations !! ;-)


 El 11/06/2010 1:03, Igor Drobiazko escribió:
 Hello folks,

 great news for all of you who wished my Tapestry 5 book to be translated
 into English. Manning Publications informed me today that the
 translation
 agreement is finalized. We start working on the English version of
 the book.

 Read more on my blog:

 http://blog.tapestry5.de/index.php/2010/06/11/manning-publications-translates-my-tapestry-5-book/





 -
 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



 Sent using BlackBerry® from Orange

-
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: [ANN] Manning Publications translates my Tapestry 5 book

2010-06-18 Thread Joachim Van der Auwera

Don't know when it will be available, but some info for (future) searching.

Title: Tapestry 5: Easy Development of Web Applications
ISBN 13: 978-1-61729-005-3

On 06/18/2010 10:57 AM, Peter Stavrinides wrote:

Hi Igor,

Please let us know when the book is ready for pre-order.

thanks,
Peter

- Original Message -
From: Robin Komiwesrobin.komi...@gmail.com
To: Tapestry usersusers@tapestry.apache.org, adam 
saltieladam.salt...@gmail.com
Sent: Saturday, 12 June, 2010 23:38:34 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: Re: [ANN] Manning Publications translates my Tapestry 5 book

Igor, it just rocks.

On Sat, Jun 12, 2010 at 5:31 PM, Adam Saltieladam.salt...@gmail.com  wrote:
   

Well done. Are you allowed to update it as necessary? My understanding is that 
it is very comprehensive. This is good news for everyone interested in Tapestry 
development.
I have worked on a site architected by Igor using good Tapestry solutions. So 
certainly interests me.

Adam
--Original Message--
From: Markus Feindler
To: Tapestry users
ReplyTo: Tapestry users
Subject: Re: [ANN] Manning Publications translates my Tapestry 5 book
Sent: 11 Jun 2010 19:35

Great news, I enjoyed reading the german version of your book!
 

Congratulations !! ;-)


El 11/06/2010 1:03, Igor Drobiazko escribió:
   

Hello folks,

great news for all of you who wished my Tapestry 5 book to be translated
into English. Manning Publications informed me today that the
translation
agreement is finalized. We start working on the English version of
the book.

Read more on my blog:

http://blog.tapestry5.de/index.php/2010/06/11/manning-publications-translates-my-tapestry-5-book/



 


-
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



Sent using BlackBerry® from Orange
 

-
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

   



--
Joachim Van der Auwera
PROGS bvba, progs.be


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



Re: Hidden doesn't handle nulls like TextField

2010-06-18 Thread Christophe Cordenier
Hi

2010/6/18 Paul Stanton p...@mapshed.com.au

 When I use a Hidden component on a form for a bean property of type Integer
 with a null value...

 input t:type=hidden value=myBean.myNullInteger /

 ... I get the following error when submitting:

 Caused by: java.lang.RuntimeException: Coercion of  to type
 java.lang.Integer (via String -- Long, Long -- Integer) failed: For input
 string: 
   at
 org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl$TargetCoercion.coerce(TypeCoercerImpl.java:69)
   at
 org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl.coerce(TypeCoercerImpl.java:133)

 However, if i change the markup to:

 input t:type=textfield value=myBean.myNullInteger
 style=display:none; /

 there is no problem.

 I guess it's because Hidden doesn't use the default null handler
 (NullFieldStrategy) like TextField, but surely they should behave the same
 in this regard?


In fact Hidden component uses ValueEncoder to encode/decode the value
parameter :

http://tapestry.apache.org/tapestry5.1/tapestry-core/ref/org/apache/tapestry5/corelib/components/Hidden.html



 bug?

 p.

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




-- 
Regards,
Christophe Cordenier.

Developer of wooki @wookicentral.com


URL encoding issue

2010-06-18 Thread Joel Halbert

Hi Folks,

I have an onSubmit from which i return a URL, which all works fine, 
unless I have a path fragment with certain characters, such a spaces.


So If I return a URL such as:

http://localhost:8080/web/buy/sports tops

I get:


Input string 'sports tops' is not valid; the character ' ' at position 7 
is not valid.

From:
org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:143) 




More suprisingly, If I URL encode the path using either + or %20 for 
spaces I get pretty the same e.g.:
Input string 'sports+tops' is not valid; the character '+' at position 7 
is not valid.

From:
org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:143) 




Any clues here? I'm using 5.1.0.5
Thx
Joel


Re: URL encoding issue

2010-06-18 Thread Christophe Cordenier
Hi

You'd better return a Link built via the LinkSource service. So Tapestry
encode the event/page context for you.

2010/6/18 Joel Halbert j...@su3analytics.com

 Hi Folks,

 I have an onSubmit from which i return a URL, which all works fine, unless
 I have a path fragment with certain characters, such a spaces.

 So If I return a URL such as:

 http://localhost:8080/web/buy/sports tops

 I get:


 Input string 'sports tops' is not valid; the character ' ' at position 7 is
 not valid.
 From:
 org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:143)



 More suprisingly, If I URL encode the path using either + or %20 for spaces
 I get pretty the same e.g.:
 Input string 'sports+tops' is not valid; the character '+' at position 7 is
 not valid.
 From:
 org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:143)



 Any clues here? I'm using 5.1.0.5
 Thx
 Joel




-- 
Regards,
Christophe Cordenier.

Developer of wooki @wookicentral.com


Re: URL encoding issue

2010-06-18 Thread Joel Halbert
As far as I understand though, I *could* return a URL, this is perfectly 
valid no?

So I'm kind of curious as to why it doesn't work


On 18/06/10 15:58, Christophe Cordenier wrote:

Hi

You'd better return a Link built via the LinkSource service. So Tapestry
encode the event/page context for you.

2010/6/18 Joel Halbertj...@su3analytics.com

   

Hi Folks,

I have an onSubmit from which i return a URL, which all works fine, unless
I have a path fragment with certain characters, such a spaces.

So If I return a URL such as:

http://localhost:8080/web/buy/sports tops

I get:


Input string 'sports tops' is not valid; the character ' ' at position 7 is
not valid.
From:
org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:143)



More suprisingly, If I URL encode the path using either + or %20 for spaces
I get pretty the same e.g.:
Input string 'sports+tops' is not valid; the character '+' at position 7 is
not valid.
From:
org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:143)



Any clues here? I'm using 5.1.0.5
Thx
Joel

 



   



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



Re: URL encoding issue

2010-06-18 Thread Christophe Cordenier
Actually, you can return return a URL but you will have to encode it with
Tapestry URLEncoder service. More generally i use URL when i want to
redirect to external web site. If i want to redirect to a page in my
application on the same server, i prefer to return an instance of page (see
@InjectPage) or a Link so the client redirect URL is generated in a safe
way.

2010/6/18 Joel Halbert j...@su3analytics.com

 As far as I understand though, I *could* return a URL, this is perfectly
 valid no?
 So I'm kind of curious as to why it doesn't work



 On 18/06/10 15:58, Christophe Cordenier wrote:

 Hi

 You'd better return a Link built via the LinkSource service. So Tapestry
 encode the event/page context for you.

 2010/6/18 Joel Halbertj...@su3analytics.com



 Hi Folks,

 I have an onSubmit from which i return a URL, which all works fine,
 unless
 I have a path fragment with certain characters, such a spaces.

 So If I return a URL such as:

 http://localhost:8080/web/buy/sports tops

 I get:


 Input string 'sports tops' is not valid; the character ' ' at position 7
 is
 not valid.
 From:

 org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:143)



 More suprisingly, If I URL encode the path using either + or %20 for
 spaces
 I get pretty the same e.g.:
 Input string 'sports+tops' is not valid; the character '+' at position 7
 is
 not valid.
 From:

 org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:143)



 Any clues here? I'm using 5.1.0.5
 Thx
 Joel









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




-- 
Regards,
Christophe Cordenier.

Developer of wooki @wookicentral.com


Re: Customising T5 URL Encoding

2010-06-18 Thread Christophe Cordenier
You can override every service of Tapestry, you have three ways to achieve
this :

1. Decoration

http://tapestry.apache.org/tapestry5.1/tapestry-ioc/decorator.html

2. Advice

http://tapestry.apache.org/tapestry5.1/tapestry-ioc/advice.html

3. Complete override

http://tapestry.apache.org/tapestry5.1/guide/alias.html

2010/6/18 Joel Halbert j...@su3analytics.com

 Tapestry appears to URL encode spaces as $0020

 e.g.
 http://localhost:8080/web/buy/sports$0020shoes


 I would much prefer to use standard encoding such as:

 http://localhost:8080/web/buy/sports+shoes
 or
 http://localhost:8080/web/buy/sports%20shoes


 Is it possible to configure or override this behaviour?




-- 
Regards,
Christophe Cordenier.

Developer of wooki @wookicentral.com


Page Navigation - Link vs Page when appending a query string to the result

2010-06-18 Thread Joel Halbert
I want to return the user to a page that has a context and some query 
params:


I can do this, using Link:

public Object onSubmit(){
Link link = ls.createPageRenderLinkWithContext(Buy.class, product);
link.addParameter(x, x);
link.addParameter(y, y);
return link;
}

Directs the user to;
http://localhost:8080/web/buy/product?x=1y=2

I want to know if I can easily do the same using Page:

@InjectPage
private Buy buy;
public Object onSubmit() {
buy.setProduct(product)
return buy;
}

And in Buy have an onPassivate to get the correct context
Buy {
String onPassivate90{return product}
}

Whch gets me the URL:
http://localhost:8080/web/buy/product

But what's the easiest way of then tacking on the query string I want?


Re: Customising T5 URL Encoding

2010-06-18 Thread Nicolas Bouillon
Hi,

Here is how i've overrided this behavior, to allow URL with %20 or other
chars as incomming request. It quite a copy/paste tweaking of the original
UrlEncoderImpl from Tapestry 5.1.0.5.

public class AppModule {
.
public static void contributeServiceOverride(
MappedConfigurationClass, Object configuration) {
configuration.add(URLEncoder.class, new MyURLEncoderImpl());
}
.
}


package org.bouil.tapestry.services;

import java.io.UnsupportedEncodingException;
import java.util.BitSet;

import org.apache.tapestry5.ioc.internal.util.Defense;
import org.apache.tapestry5.services.URLEncoder;

public class MyURLEncoderImpl implements URLEncoder {
static final String ENCODED_NULL = $N;
static final String ENCODED_BLANK = $B;

/**
 * Bit set indicating which character are safe to pass through (when
 * encoding or decoding) as-is. All other characters are encoded as a
kind
 * of unicode escape.
 */
private final BitSet safeForInput = new BitSet(128);
private final BitSet safeForOutput = new BitSet(128);

{
   
markSafeForInput(aàâäbcçĉdeéèêëfgĝhĥiïîjĵklmnoôöpqrsŝtuùûüvwxyzæœ);
   
markSafeForInput(AÀÂÄBCÇĈDEÉÈÊËFGĜHĤIÏÎĤJĴKLMNOÔÖPQRSŜTUÙÛÜVWXYZÆŒ);
markSafeForInput(01234567890-_.:,');

markSafeForOuput(abcdefghijklmnopqrstuvwxyz);
markSafeForOuput(ABCDEFGHIJKLMNOPQRSTUVWXYZ);
markSafeForOuput(01234567890-_.:,');
}

private void markSafeForInput(String s) {
for (char ch : s.toCharArray()) {
safeForInput.set(ch);
}
}

private void markSafeForOuput(String s) {
for (char ch : s.toCharArray()) {
safeForOutput.set(ch);
}
}

public String encode(String input) {
if (input == null)
return ENCODED_NULL;

if (input.equals())
return ENCODED_BLANK;

boolean dirty = false;

int length = input.length();

StringBuilder output = new StringBuilder(length * 2);

for (int i = 0; i  length; i++) {
char ch = input.charAt(i);

if (ch == '$') {
output.append($$);
dirty = true;
continue;
}

int chAsInt = ch;

if (safeForOutput.get(chAsInt)) {
output.append(ch);
continue;
}

try {
return  java.net.URLEncoder.encode(new String(input),
UTF-8);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(e);
}
// output.append(String.format($%04x, chAsInt));
// dirty = true;
}

return dirty ? output.toString() : input;
}

public String decode(String input) {
Defense.notNull(input, input);

if (input.equals(ENCODED_NULL))
return null;

if (input.equals(ENCODED_BLANK))
return ;

boolean dirty = false;

int length = input.length();

StringBuilder output = new StringBuilder(length * 2);

for (int i = 0; i  length; i++) {
char ch = input.charAt(i);

if (ch == '$') {
dirty = true;

if (i + 1  length  input.charAt(i + 1) == '$') {
output.append('$');
i++;

dirty = true;
continue;
}

if (i + 4  length) {
String hex = input.substring(i + 1, i + 5);

try {
int unicode = Integer.parseInt(hex, 16);

output.append((char) unicode);
i += 4;
dirty = true;
continue;
} catch (NumberFormatException ex) {
// Ignore.
}
}

throw new IllegalArgumentException(
String
.format(
Input string '%s' is not valid;
the '$' character at position %d should be followed by another '$' or a
four digit hex number (a unicode value).,
input, i + 1));
}

if (!safeForInput.get(ch)) {
throw new IllegalArgumentException(
String
.format(
Input string '%s' is not valid;
the character '%s' at position %d is not valid.,
input, ch, i + 1));
}

output.append(ch);
}

return dirty ? output.toString() : input;
}
}



On Fri, 18 Jun 2010 16:08:09 +0100, Joel Halbert j...@su3analytics.com
wrote:
 Tapestry appears to URL encode spaces as $0020
 
 e.g.
 

Re: Page Navigation - Link vs Page when appending a query string to the result

2010-06-18 Thread Howard Lewis Ship
Currently, there isn't a good way to do what you want. I just hit a
similar problem for my client and am deciding on the right solution; I
think another callback event, much like passivate, but passed the Link
so it can be customized.

See https://issues.apache.org/jira/browse/TAP5-1190

On Fri, Jun 18, 2010 at 8:30 AM, Joel Halbert j...@su3analytics.com wrote:
 I want to return the user to a page that has a context and some query
 params:

 I can do this, using Link:

    public Object onSubmit(){
        Link link = ls.createPageRenderLinkWithContext(Buy.class, product);
        link.addParameter(x, x);
        link.addParameter(y, y);
        return link;
    }

 Directs the user to;
 http://localhost:8080/web/buy/product?x=1y=2

 I want to know if I can easily do the same using Page:

   �...@injectpage
    private Buy buy;
    public Object onSubmit() {
        buy.setProduct(product)
        return buy;
    }

 And in Buy have an onPassivate to get the correct context
 Buy {
    String onPassivate90{return product}
 }

 Whch gets me the URL:
 http://localhost:8080/web/buy/product

 But what's the easiest way of then tacking on the query string I want?




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



T5.1: No service implements the interface HibernateSessionManager

2010-06-18 Thread Robert Hailey


I'm running an experiment with classpaths  classloaders.

Although my conventional tapestry setup works well, I'm getting this  
exception in my test and would like to understand it's cause.


java.lang.RuntimeException: No service implements the interface  
org.apache.tapestry5.hibernate.HibernateSessionManager.
	at  
org 
.apache 
.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:560)
	at  
org 
.apache 
.tapestry5 
.ioc.internal.ObjectLocatorImpl.getService(ObjectLocatorImpl.java:44)
	at org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl 
$1.invoke(MasterObjectProviderImpl.java:56)
	at  
org 
.apache 
.tapestry5 
.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)

... 92 more

From my own experience  reading up on this exception on the lists, I  
gather that there is an issue with finding the tapestry-hibernate (or  
hibernate) classes at runtime because they have not registered  
themselves in the ioc registry. Is this correct?


If so, how does a service technically get into the registry? b/c the  
initial startup appears to work (and lists application-specific  
services!).


If not, what makes HibernateSessionManager different from tapestry's  
built-in services or those of the web-app?


--
Robert Hailey




Re: T5.1: No service implements the interface HibernateSessionManager

2010-06-18 Thread Thiago H. de Paula Figueiredo
On Fri, 18 Jun 2010 16:13:49 -0300, Robert Hailey rob...@cmediacorp.com  
wrote:


 From my own experience  reading up on this exception on the lists, I  
gather that there is an issue with finding the tapestry-hibernate (or  
hibernate) classes at runtime because they have not registered  
themselves in the ioc registry. Is this correct?


I wouldn't put it that way. I'd say that, for some reason, the  
HibernateSessionManager service wasn't defined.


If so, how does a service technically get into the registry? b/c the  
initial startup appears to work (and lists application-specific  
services!).


If not, what makes HibernateSessionManager different from tapestry's  
built-in services or those of the web-app?


It comes from a different source (another JAR), nothing beyond that.

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

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

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



Re: T5.1: No service implements the interface HibernateSessionManager

2010-06-18 Thread Robert Hailey


I've been reading up a bit on tapestry-ioc...

http://tapestry.apache.org/tapestry5/tapestry-ioc/run.html

On Jun 18, 2010, at 2:29 PM, Thiago H. de Paula Figueiredo wrote:

On Fri, 18 Jun 2010 16:13:49 -0300, Robert Hailey rob...@cmediacorp.com 
 wrote:


From my own experience  reading up on this exception on the lists,  
I gather that there is an issue with finding the tapestry-hibernate  
(or hibernate) classes at runtime because they have not registered  
themselves in the ioc registry. Is this correct?


I wouldn't put it that way. I'd say that, for some reason, the  
HibernateSessionManager service wasn't defined.


Sounds right.



If so, how does a service technically get into the registry? b/c  
the initial startup appears to work (and lists application-specific  
services!).


If not, what makes HibernateSessionManager different from  
tapestry's built-in services or those of the web-app?


It comes from a different source (another JAR), nothing beyond that.


Really? Surely there is a difference somewhere!

Here is my (basic) understanding so far:

tapestry-filter:
creates a ioc-registry
(it already contains the base-ioc services)
it adds the tapestry services
it adds (or knows-the-path-to) the services from app.services.*
it adds my AppModule ()

I suspect it is a jar-finding issue, quoting from ioc documentation...


Building the Default Registry

The default registry is available by invoking the static method  
IOCUtilities.buildDefaultRegistry(). This method builds a Registry  
using autoloading logic, where modules to load are identified via a  
JAR Manifest entry.


In addition, the JVM system property tapestry.modules (if specified)  
is a list of additional module classes to load. This is often used  
in development, where tests may be executed against the local  
classes, not JARs, and so there no manifest to read.





So is it the case that tapestry-hibernate-*.jar presence in the web- 
app folder is what ultimately prompts it's registration?


--
Robert Hailey



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

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

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





Re: T5.1: No service implements the interface HibernateSessionManager

2010-06-18 Thread Thiago H. de Paula Figueiredo
On Fri, 18 Jun 2010 16:49:46 -0300, Robert Hailey rob...@cmediacorp.com  
wrote:



Really? Surely there is a difference somewhere!
Here is my (basic) understanding so far:

tapestry-filter:
creates a ioc-registry
(it already contains the base-ioc services)
it adds the tapestry services
it adds (or knows-the-path-to) the services from app.services.*


The above line isn't correct. Tapestry services are defined in  
TapestryModule and TapestryInternalModule, Tapestry-IoC modules classes as  
any other.
The base IoC services are a module class as any other, except that they  
are automatically loaded. No special handling.


So is it the case that tapestry-hibernate-*.jar presence in the web-app  
folder is what ultimately prompts it's registration?


Yes. The same happens to any JAR in the classpath, as long as it has the  
correct entries in their manifest files.


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

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

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



Re: T5.1: No service implements the interface HibernateSessionManager

2010-06-18 Thread Robert Hailey


On Jun 18, 2010, at 3:06 PM, Thiago H. de Paula Figueiredo wrote:

On Fri, 18 Jun 2010 16:49:46 -0300, Robert Hailey rob...@cmediacorp.com 
 wrote:


So is it the case that tapestry-hibernate-*.jar presence in the web- 
app folder is what ultimately prompts it's registration?


Yes. The same happens to any JAR in the classpath, as long as it has  
the correct entries in their manifest files.




I see, and once a registry is built it is not possible to add to it.

Is a way for one tapestry module to pragmatically require another (at  
registry-build-time) such as providing a class name/instance?


--
Robert Hailey


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



Re: T5.1: No service implements the interface HibernateSessionManager

2010-06-18 Thread Thiago H. de Paula Figueiredo
On Fri, 18 Jun 2010 17:31:19 -0300, Robert Hailey rob...@cmediacorp.com  
wrote:


Is a way for one tapestry module to pragmatically require another (at  
registry-build-time) such as providing a class name/instance?


The @SubModule annotation tells T-IoC to include one or more other modules  
in the registry.


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



BUG: T5.1/IOC: dropped exception

2010-06-18 Thread Robert Hailey
org.apache.tapestry5.ioc.RegistryBuilder.javaaround line #153author intends to set exception as cause but feeds it into format arguments--Robert Hailey

dropped_exception.patch
Description: Binary data


Re: BUG: T5.1/IOC: dropped exception

2010-06-18 Thread Thiago H. de Paula Figueiredo
On Fri, 18 Jun 2010 19:11:02 -0300, Robert Hailey rob...@cmediacorp.com  
wrote:



org.apache.tapestry5.ioc.RegistryBuilder.java
around line #153
author intends to set exception as cause but feeds it into format  
arguments


Please post it in JIRA, as it's the right place to file bugs.

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

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

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



Re: Customising T5 URL Encoding

2010-06-18 Thread Howard Lewis Ship
Tapestry does its own encoding because Jetty and Tomcat differ on
whether you get the decoded or raw strings.  Creating another option,
that would work the same across servlet containers, seemed to make
sense at the time.

On Fri, Jun 18, 2010 at 8:50 AM, Nicolas Bouillon nico...@bouil.org wrote:
 Hi,

 Here is how i've overrided this behavior, to allow URL with %20 or other
 chars as incomming request. It quite a copy/paste tweaking of the original
 UrlEncoderImpl from Tapestry 5.1.0.5.

 public class AppModule {
    .
    public static void contributeServiceOverride(
            MappedConfigurationClass, Object configuration) {
        configuration.add(URLEncoder.class, new MyURLEncoderImpl());
    }
    .
 }


 package org.bouil.tapestry.services;

 import java.io.UnsupportedEncodingException;
 import java.util.BitSet;

 import org.apache.tapestry5.ioc.internal.util.Defense;
 import org.apache.tapestry5.services.URLEncoder;

 public class MyURLEncoderImpl implements URLEncoder {
    static final String ENCODED_NULL = $N;
    static final String ENCODED_BLANK = $B;

    /**
     * Bit set indicating which character are safe to pass through (when
     * encoding or decoding) as-is. All other characters are encoded as a
 kind
     * of unicode escape.
     */
    private final BitSet safeForInput = new BitSet(128);
    private final BitSet safeForOutput = new BitSet(128);

    {

 markSafeForInput(aàâäbcçĉdeéèêëfgĝhĥiïîjĵklmnoôöpqrsŝtuùûüvwxyzæœ);

 markSafeForInput(AÀÂÄBCÇĈDEÉÈÊËFGĜHĤIÏÎĤJĴKLMNOÔÖPQRSŜTUÙÛÜVWXYZÆŒ);
        markSafeForInput(01234567890-_.:,');

        markSafeForOuput(abcdefghijklmnopqrstuvwxyz);
        markSafeForOuput(ABCDEFGHIJKLMNOPQRSTUVWXYZ);
        markSafeForOuput(01234567890-_.:,');
    }

    private void markSafeForInput(String s) {
        for (char ch : s.toCharArray()) {
            safeForInput.set(ch);
        }
    }

    private void markSafeForOuput(String s) {
        for (char ch : s.toCharArray()) {
            safeForOutput.set(ch);
        }
    }

    public String encode(String input) {
        if (input == null)
            return ENCODED_NULL;

        if (input.equals())
            return ENCODED_BLANK;

        boolean dirty = false;

        int length = input.length();

        StringBuilder output = new StringBuilder(length * 2);

        for (int i = 0; i  length; i++) {
            char ch = input.charAt(i);

            if (ch == '$') {
                output.append($$);
                dirty = true;
                continue;
            }

            int chAsInt = ch;

            if (safeForOutput.get(chAsInt)) {
                output.append(ch);
                continue;
            }

            try {
                return  java.net.URLEncoder.encode(new String(input),
 UTF-8);
            } catch (UnsupportedEncodingException e) {
                throw new IllegalArgumentException(e);
            }
            // output.append(String.format($%04x, chAsInt));
            // dirty = true;
        }

        return dirty ? output.toString() : input;
    }

    public String decode(String input) {
        Defense.notNull(input, input);

        if (input.equals(ENCODED_NULL))
            return null;

        if (input.equals(ENCODED_BLANK))
            return ;

        boolean dirty = false;

        int length = input.length();

        StringBuilder output = new StringBuilder(length * 2);

        for (int i = 0; i  length; i++) {
            char ch = input.charAt(i);

            if (ch == '$') {
                dirty = true;

                if (i + 1  length  input.charAt(i + 1) == '$') {
                    output.append('$');
                    i++;

                    dirty = true;
                    continue;
                }

                if (i + 4  length) {
                    String hex = input.substring(i + 1, i + 5);

                    try {
                        int unicode = Integer.parseInt(hex, 16);

                        output.append((char) unicode);
                        i += 4;
                        dirty = true;
                        continue;
                    } catch (NumberFormatException ex) {
                        // Ignore.
                    }
                }

                throw new IllegalArgumentException(
                        String
                                .format(
                                        Input string '%s' is not valid;
 the '$' character at position %d should be followed by another '$' or a
 four digit hex number (a unicode value).,
                                        input, i + 1));
            }

            if (!safeForInput.get(ch)) {
                throw new IllegalArgumentException(
                        String
                                .format(
                                        Input string '%s' is not valid;
 the character '%s' at position %d is not valid.,
                                        input, ch, i + 1));