Setting locale based on domain

2010-12-15 Thread Kai Weber
Hi all,

since version 5.1 the ComponentEventLinkEncoder determines and sets the
locale for the current thread.

In version 5.0 this was the job of a RequestFilter. We used a solution
like the one in the wiki[1] to set the locale based on other request
criteria.

The RequestFilter still works for normal requests, but requests which
result in an Component event (like a form submit) do not set the desired
locale because our logic is triggered but later overwritten by the
ComponentEventLinkEncoder.

Has anyone solved this problem? How should and can I set the thread's
locale? The Localization[2] documentation is no help in this case.

Regards, Kai

[1] http://wiki.apache.org/tapestry/Tapestry5HowToDomainLevelLocalization
[2] http://tapestry.apache.org/tapestry5/guide/localization.html

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



Best practice, converting a text field value

2010-12-07 Thread Kai Weber
Hi,

the user provided input from a TextField/TextArea component should be
cleaned from HTML tags. No validation is needed, the requirements are
just remove the HTML, display the result to the user.

The first variant I tried is a Translator. This solution works but
because there are other possible solutions as well I would hear your
suggestions.

The other variant which comes to my mind is to use a TypeCoercer which
coerces the values to a special type (CleanString or something like
that). But if I use a coerce I maybe miss the possibility to validate
the input field by throwing a ValidationException as I would do in the
Translator.

Any suggestions and solutions I should consider?

Regards,
Kai

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



LinkSubmit component bug (TAP5-1180)

2010-08-19 Thread Kai Weber
Hi,

we are hit by the bug described in TAP5-1180 (the same as TAP5-930,
which was closed Incomplete). The findings the reporter of the bug
Paul Stanton made are the same we suspect to be the problem.

How do other people on this list solve this problem? Does anybody use
the LinkSubmit component?

Regards, Kai

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



Looking for workaround for TAP5-856 in 5.1.0.5

2010-06-28 Thread Kai Weber
Hi,

we just upgraded from 5.0.x to 5.1.0.5. We are hit by TAP5-856. Is there
a workaround for 5.1.0.5 available? Upgrading to 5.2 is currently no
option for us.

https://issues.apache.org/jira/browse/TAP5-856

Regards, Kai

-
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-20 Thread Kai Weber
* Nicolas Bouillon nico...@bouil.org:

 The Tapestry URL encoding is not a problem for me in general, just for one
 use case when i wanted to migrate a site to tapestry and keeping the same
 URL (with accents, spaces, dashes, underscores and so on).

It is a problem if you get called by other webapps. If they call your
page with the standard URL encoding scheme you have a problem.  Say you
have

onActivate(String emailadress)

no one can call your page because the expected encoding for @ in T5 is
$0040 where the rest of the world would send you an @.

We use only query strings or numerical IDs as parameters for pages which
can get called from external sites.

I would like to see configuration option to switch or disable the
URLEncoder completly.

Kai

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



Overriding RememberMeServices in tapestry-spring-security

2010-06-11 Thread Kai Weber
Hi,

I have to override a service defined in tapestry-spring-security 2.1.0,
T5 is 5.1.0.4:

@Marker(SpringSecurityServices.class)
public static RememberMeServices build(
final UserDetailsService userDetailsService, @Inject
@Value(${spring-security.rememberme.key})
final String rememberMeKey) {
TokenBasedRememberMeServices rememberMe = new 
TokenBasedRememberMeServices();
rememberMe.setUserDetailsService(userDetailsService);
rememberMe.setKey(rememberMeKey);
return rememberMe;
}

I can define an own implemenation in my AppModule but this
implementation is not injected in the SecurityModule, maybe because the Module
uses the @SpringSecurityServices.class marker. If i try to mark my
implementation as well I get this error because of two implementations:

Unable to locate a single service assignable to type
org.springframework.security.ui.rememberme.RememberMeServices with marker
annotation(s)
nu.localhost.tapestry5.springsecurity.services.SpringSecurityServices.

Any ideas? How can I override this service. Btw, I already tried _all_ the
methods described on the webpage
http://tapestry.apache.org/tapestry5.1/tapestry-ioc/cookbook/override.html

Regards, Kai

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



[Solved] Re: Overriding RememberMeServices in tapestry-spring-security

2010-06-11 Thread Kai Weber
* Kai Weber kai.we...@glorybox.de:

 Any ideas? How can I override this service. Btw, I already tried _all_ the
 methods described on the webpage
 http://tapestry.apache.org/tapestry5.1/tapestry-ioc/cookbook/override.html

Solved it. Had a typo in decorateRememberMeService which should be
decorateRememberMeServices. Do you see the small difference?

K

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



Overriding RememberMeServices in tapestry-spring-security

2010-06-11 Thread Kai Weber
Hi,

I have to override a service defined in tapestry-spring-security 2.1.0, T5 is 
5.1.0.4:

@Marker(SpringSecurityServices.class)
public static RememberMeServices build(
final UserDetailsService userDetailsService, @Inject
@Value(${spring-security.rememberme.key})
final String rememberMeKey) {
TokenBasedRememberMeServices rememberMe = new 
TokenBasedRememberMeServices();
rememberMe.setUserDetailsService(userDetailsService);
rememberMe.setKey(rememberMeKey);
return rememberMe;
}

I can define an own implemenation in my AppModule but this
implementation is not injected in the SecurityModule, maybe because the Module
uses the @SpringSecurityServices.class marker. If i try to mark my
implementation as well I get this error because of two implementations:

Unable to locate a single service assignable to type
org.springframework.security.ui.rememberme.RememberMeServices with marker
annotation(s)
nu.localhost.tapestry5.springsecurity.services.SpringSecurityServices.

Any ideas? How can I override this service. Btw, I already tried _all_ the
methods described on the webpage
http://tapestry.apache.org/tapestry5.1/tapestry-ioc/cookbook/override.html

Regards, Kai

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



[Fixed] Re: Overriding RememberMeServices in tapestry-spring-security

2010-06-11 Thread Kai Weber
* Kai Weber kai.we...@glorybox.de:

 Any ideas? How can I override this service. Btw, I already tried _all_ the
 methods described on the webpage
 http://tapestry.apache.org/tapestry5.1/tapestry-ioc/cookbook/override.html

Fixed it myself. Had a typo in the decorate* method.

Seems, you have to use the decoration approach if you must override
services which have a @Marker annotation.

K

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



Setting a default value for input fields

2010-03-16 Thread Kai Weber
Hi,

if I have a page with an input field which I want to set to a default
value. After the form was displayed and submitted the value of the input
field should be left alone and not changed anymore. What is the
recommended way to do it?  My current solution is the following, but I
feel I miss something. For a text field preferredName I do the
following:

input t:type=TextField t:id=preferredName size=30/

@Persist
private String preferredName;

public void setupRender() {
if (preferredName==null) {
// preferredName not set already, set default value
preferredName = DEFAULT;
}
}

public void setPreferredName(String name) {
this.preferredName = name;
}

public String getPreferredName() {
return this.preferredName;
}

Regards, Kai

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



Re: RenderInformals on Component With Template

2009-09-21 Thread Kai Weber
Josh Canfield schrieb:

 This component will grab the first element from the template and add
 all the informal parameters to it.

Cool.

But it grabs the first element of the outer component. If I have

+ form +
   |
   +- div
   |
   +- div
   |
   +- component

it always grabs the form-Element and then the first div. I tried and tried but 
in every render phase writer.getElement() returns only the form-Element. I want 
to get the component-Element which I get with 

Regards, Kai

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



RenderInformals on Component With Template

2009-09-18 Thread Kai Weber
Hi,

I have *exactly* the same problem as the user adamh in June 2008. He hasn't got 
an answer. Does, one year later, anyone has a glue?

http://www.nabble.com/RenderInformals-on-Component-With-Template-tt18053261.html#a18053261

In short this is his problem:

Inf.tml
div existing=existing 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
Inf Component
/div

InfTest.tml
div xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;

!-- This inf component should render with 'existing' and 'inf1' attributes --
t:inf inf1=inf1Hi/t:inf

/div

Regards, Kai

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



Grid: Composed property

2009-08-21 Thread Kai Weber
Hi,

I have a Bean and want to display a combination of two fields in my Grid.

public class User {
  String getFirstname(){...}
  String getLastname(){...}
}

I use BeanModel in my Page class and tried to find a way to do it 
programmatically, but failed. This way works:

myModel = beanModelSource.createDisplayModel(User.class, 
componentResources.getMessages());

...

table t:type=grid t:model=mymodel t:source=users row=user
t:parameter name=nameCell
${user.firstname} ${user.lastname}
/t:parameter
/table 

But, is this the really the only way? I wanted to customize the display of the 
name cell in Java.

Kai


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



Re: Component API?

2009-07-23 Thread Kai Weber
* Dennis Kühn ku...@mediaworx.com:

Hallo Dennis, hier deiner alter Arbeitskollege Kai. Wenn du irgendwie
die Chance hast Tapestry nicht zu benutzen: benutz es nicht! Es ist ein
graus. Es will alles machen und macht alles anders als alle anderen.
Besser wird es dadurch nicht. Details gerne mal privat. Ich kann nur
abraten, denn ich muss es täglich benutzen.

Grüße aus der Tapestry-Welt
Kai

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



Dynamic templates

2009-07-21 Thread Kai Weber

Hello Tapestriers:

I have a template.tml with should look something like this

div xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
   ${content}
/div

${content} should be filled from properties/file/database whatever. My 
problem:

it can contain links to other pages in my application.

In the end I want dynamic templates to be as much flexible as possible 
and give my users the
ability to put anything they want in it. But I do not know how I could 
achive
flexiblity when the HTML contains Elements which are normally rendered 
through

Tapestry components (Link, Form, TextArea).

E.g.

div
   a t:id=printLinkprint/a
/div

Any ideas?

Thanks in advance,
Kai


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



Re: ActionLink in bundle message

2009-07-09 Thread Kai Weber
Thiago H. de Paula Figueiredo wrote:
 On Tue, Jul 7, 2009 at 12:15 PM, shymonshym...@poczta.onet.pl wrote:
 
 I have message with parameter which I replace using messages.format method.
 I also create link object with createEventLink() and   element using Element
 class.
 It almost works, but link created this way has no id so I cannot handle only
 it's action.
 
 You don't need a component id to handle its event: just handle the
 event normally:
 
 @OnEvent(nameOfYourEvent)
 void handle() {...}
 
 If you create more than one event link this way, generate their links
 with different event names or provide some activation context to them.
 

Could you elaborate me if i create:

a href=# t:type=ActionLink t:id=detailLink
t:context=literal:1more/a
a href=# t:type=ActionLink t:id=detailLink
t:context=literal:2more/a

and

@OnEvent(detailLink)
void handle(int id) {...}

I always get an exception that the same id is not allowed for a component.

What did I wrong?

Kai

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



Using tapestry-acegi's LogoutService

2009-07-02 Thread Kai Weber

Hi:

how would I do this: Everytime a new authentication attempt is made 
logout the current user.


What I tried to inject the LogoutService into my custom 
AuthenticationProcessingFilter, but I can not call 
logoutService.logout() because no RequestGlobals is injected into the 
LogoutService.


Any ideas?

Regards, Kai

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



Re: Using tapestry-acegi's LogoutService

2009-07-02 Thread Kai Weber

Juan E. Maya schrieb:

Kai i am not sure how to do it with Tapestry-acegi but this use case
is already supported by Spring Security:

http://static.springsource.org/spring-security/site/docs/2.0.x/reference/ns-config.html#ns-concurrent-session
  
Is it possible to use spring-security together with Tapestry? How would 
I start?


Regards, Kai

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



Architecture: how much logic should a component contain

2009-06-24 Thread Kai Weber

Hi,

what do you think, how much of logic a component should contain?

Say I have a service which retrieves values from somewhere. Should I 
make this service available in the component or the page containing the 
component and setting the values via a @Parameter variable in the component.


At the moment I see my components more as value providers for my (H)TML 
view logic and have all calls to backend services in the pages. But what 
do others do and think?


Regards, Kai

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



Best practice unit testing pages and components

2009-06-22 Thread Kai Weber
How would I test a page or a component when a @Parameter is not 
accessible because of its need to be a private variable?


I want to test my pages and components with unit tests as I do with my 
service classes.


Regards, Kai

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



Difference between prop: and ${...} in PageLink

2009-06-11 Thread Kai Weber

Hi,

I am a Tapestry beginner. I am far from knowing all the internals. I use 
the PageLink component in one of my as follows:


@Component(id=backLink,
parameters={
  page=${backLink},
  context=backLinkContext,
  anchor=${prev.getUniqueIdentifier()}})
private PageLink backLink;

My question is now

What does the ${...} do?

I fail to see what this means: If I replace 
context=prop:backLinkContext with context=${backLinkContext} I get a 
different link than expected. If I replace page=prop:backLink with 
page=${backLink} I get no different link. Why?


Kai

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



Serving assets from another domain

2009-06-05 Thread Kai Weber

Hello List:

I want to serve my assets (images, stylesheets, and JavaScript 
libraries) from another domain name to enhance the performance of my 
site. This is one of the recommended practices for enhanced speed from 
YSlow and Google's new Page Speed.


For example the configuration

@Inject
@Path(context:images/banner.gif)
private Asset banner;

should result in a path like 
http(s)://images.example.org/images/banner.gif where my applications 
main domain name is www.example.org.


How can I achive this? Where should I start looking to implement this 
feature?


Regards, Kai

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



SymbolConstant.SCRIPTS_AT_TOP=false does not work anymore

2009-04-30 Thread Kai Weber

Hi,

I use 5.0.18 and I cannot get SymbolConstant.SCRIPTS_AT_TOP=false to work.

What I found in the sources and by running my app with a debugger:

* TapestryModule sets SymbolConstant.SCRIPTS_AT_TOP to false in 
contributeFactoryDefaults()


* in TapestryModule.contributeMarkupRenderer()the Symbol gets injected 
and is later passed to


Create a new DocumentLinkerImpl with new 
DocumentLinkerImpl(productionMode, scriptsAtTop);


* if I set a Breakpoint in DocumentLinkerImpl's constructor scriptsAtTop 
is set to true


I have no idea when the configuration is changed. It is not touched in 
my application. Could someone help me? This are my questions:



1. Who changes the configuration? When?

2. How can I set SymbolConstant.SCRIPTS_AT_TOP to false?

3. How could I provide my own implemation of DocumentLinkerImpl?

Regards,
Kai



Re: SymbolConstant.SCRIPTS_AT_TOP=false does not work anymore

2009-04-30 Thread Kai Weber

Am 30.04.2009 15:26, schrieb Peter Stavrinides:

What version of Tapestry? Correct me if I am wrong but from 5.1.0.4 it is no 
longer required.
   
Could you tell me more, what it is no longer required means? Scripts 
are always placed on bottom of the page?


Regards, Kai

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



Re: SymbolConstant.SCRIPTS_AT_TOP=false does not work anymore

2009-04-30 Thread Kai Weber

Am 30.04.2009 16:08, schrieb Peter Stavrinides:

see this page: 
http://tapestry.formos.com/nightly/tapestry5/apidocs/org/apache/tapestry5/SymbolConstants.html#SCRIPTS_AT_TOP

SCRIPTS_AT_TOP
Deprecated. since 5.1.0.1; scripts are now always at the top (see TAP5-544)
   

Oh no.

What can I do to get the old behaviour back?

Regards, Kai

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