Re: Wicket and JEE6

2010-03-30 Thread Olivier Bourgeois
I do also think that it's because Wicket is not a managed framework :
everything is simple unmanaged POJOs except for your classes extending
WebPage which are managed. I've juste had a quick look at JSF 2.0 and
never worked with it - but I worked with Wicket - so I did not expected
Wicket JEE6 integration to be a drop in replacement for JSF. I do think
Wicket is an alternative framework for JEE6, not a replacement of the
reference framework.

On one hand JSF2 assumes that you are running a JEE6 AS, so it is tightly
integrated with CDI, and you got all the cool stuff like injection, scopes,
bean validation, etc. On the other hand, Wicket doesn't assume anything
except a web container implementing the servlet spec, so it can't have all
the cool stuff of CDI because it's not built around CDI.

I think the next step to make Wicket JEE6 integration going further is to
provide some Maven quickstart archetypes, the Weld team is looking for
contributors : http://in.relation.to/Bloggers/WeldArchetypesInTheSpotlight

Now that I have something working, and when I will have some spare time, my
next step is to create an archetype for Glassfish. And if some people on
this list have some time, their help is of course welcome :)


Re: Wicket and JEE6

2010-03-30 Thread Olivier Bourgeois
2010/3/30 Cemal Bayramoglu jweekend_for...@cabouge.com

 Olivier,

 I got Jame's stuff [1] up and running (thanks James) with just a few
 small changes to the POMs - maybe he has stuff already in his local
 Maven repo that is no longer on the main public repos) working with
 little effort.

 If you'd like to make (and maintain ;-) an archetype out of those
 (based on Apache implementations), or a Galssfish based one,  we would
 be happy to include those on our LegUp page [2][3].

 Regards - Cemal
 jWeekend
 OO  Java Technologies, Wicket
 Consulting, Development, Training
 http://jWeekend.com

 [1] http://svn.carmanconsulting.com/public/wicket-cdi/trunk
 [2] http://jweekend.com/dev/LegUp
 [3] http://code.google.com/p/legup/


Cemal,

thanks for the offer I'll keep this in mind.

James,

  you need an empty beans.xml file to let Weld know what to scan, this is
explained much further in this blog entry :

http://relation.to/Bloggers/WhyIsBeansxmlRequiredInCDI

And if you plan to build a Weld extension, you must know that you have to
create a file named :

META-INF/services/javax.enterprise.inject.spi.Extension

containing the full qualified name of your class implementing Extension.


Re: Wicket and JEE6

2010-03-29 Thread Olivier Bourgeois
Hi,

Wicket has very good support in Weld, but to make it work I had to update
the weld-integration.jar, otherwise the sample Numberguess application is
looking for an unexisting method in the 1.0.0 Weld API : this is your
problem.

If you don't want to do it by hand like suggested by Iskandar, you can
download one of the Glassfish nightly builds, this is what I have done. The
latest builds are integrating Weld 1.0.1-final and the problem vanishes.

If you want, I can provide you the maven profile to make the sample work
nicely when you hit the run button in Netbeans, because there is another
problem with the samples : the maven profile is not including the slf4j
libraries, so there is an error in Glassfish when you run the sample. I
assume this may be your next problem :)

Also, you may run into trouble with the JPA2 code generation if you are
using maven. But if you are using Eclipse annotation preprocessor to
generate the metadata, you won't have the problem.

--
Olivier


Re: How to change content in ModalWindow

2010-01-25 Thread Olivier Bourgeois
Aren't you missing a :

modalContentWindow.show(target)

in the onClick callback ?

2010/1/25 Chris Colman chr...@stepaheadsoftware.com

 Searching Nable shows this question has been asked before but there none
 of the solutions proposed there work for me.

 I have a link in PanelA that, when clicked, should cause PanelB to
 display in the same ModalWindow (PanelB replaced PanelA).

 The onClick event handler does something like the following:

add
(
new AjaxLink(selectionLink)
{
public void onClick(AjaxRequestTarget target)
{
PanelB panelB = new
PanelB(modalContentWindow.getContentId());

modalContentWindow.setContent(panelB);
modalContentWindow.setTitle(Hi, I'm PanelB);
target.addComponent(panelB);
}
}
);

 When the link is pressed the panel A content disappears (popup content
 goes blank) but the panel B content does not appear.

 Should this work or have I missed something?

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




Re: Wicket 1.4-rc6 Swarm

2010-01-15 Thread Olivier Bourgeois
Hi Olger,

thanks for the update. I can live with snapshots, and I am currently
using it in production without any issues too. That's just a teammate of
mine which is a little bit uncomfortable with seeing snapshots in the POM
:-)

What's the problem with the build system ? Maybe I, or someone on this list,
can help you fix it and make a new stable release.

regards,

Olivier.

2009/12/23 Olger Warnier ol...@xs4all.nl

 Hi Olivier,

 Till now, I kept it up to date till 1.4.3 based on snapshots. I ran into
 trouble with the build system and could figure out how to get that working.
 In the last few weeks a new version of TeamCity was installed. I'll give it
 another try and figure out how to create a release.

 We use the SNAPSHOTS in production without issues, so it should be no
 problem. Otherwise drop a mail.

 Kind Regards,

 Olger

 On 22 dec 2009, at 16:01, Olivier Bourgeois wrote:

  Is there any news regarding a release of Swarm 1.4 ? Because there's
 still
  only the 1.4 snapshots in the repository.
 
  For information, I'm currently using it with Wicket 1.4.3 and got no
 problem
  so far : page security and component conditional rendering works fine.
 
  2009/7/10 Luca Provenzani eufor...@gmail.com
 
  this is a very good new!
 
  thank you a lot!
 
  Luca
 
  2009/7/9 Olger Warnier ol...@xs4all.nl
 
  Hi Igor / List,
 
  Thanks for the trust.
 
  The wicket-security project trunk found at
 
 
 https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicket-securityis
  now compatible with wicket 1.4 RC6.
  If you have issues or comments, please let me know.
 
  I am not aware of your release rules, if you have a pointer, I could
  check
  if it is possibe to get it towards a release along with the wicket 1.4
  release.
 
  Kind Regards,
 
  Olger
 


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




Re: Wicket 1.4-rc6 Swarm

2009-12-22 Thread Olivier Bourgeois
Is there any news regarding a release of Swarm 1.4 ? Because there's still
only the 1.4 snapshots in the repository.

For information, I'm currently using it with Wicket 1.4.3 and got no problem
so far : page security and component conditional rendering works fine.

2009/7/10 Luca Provenzani eufor...@gmail.com

 this is a very good new!

 thank you a lot!

 Luca

 2009/7/9 Olger Warnier ol...@xs4all.nl

  Hi Igor / List,
 
  Thanks for the trust.
 
  The wicket-security project trunk found at
 
 https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicket-securityis
  now compatible with wicket 1.4 RC6.
  If you have issues or comments, please let me know.
 
  I am not aware of your release rules, if you have a pointer, I could
 check
  if it is possibe to get it towards a release along with the wicket 1.4
  release.
 
  Kind Regards,
 
  Olger



Re: Where to put HTML files?

2009-10-29 Thread Olivier Bourgeois
You can also override the template loader for the application. That's what
I've done and our templates and properties are in a different project than
the application. I also have two differents SVN repos.

The pros :

- you have instant template/properties reloading in development mode without
redeploying or complex IDE setup.
- you can edit, tag and release the templates without repackaging the war.

The cons :

- you have a more complex project setup : two projects in eclipse, two
folders.
- you don't have the templates near the classes and you cannot use tools
like wicket-bench for error detection (eg component id mispelling).


Re: Wicket Eclipse plugin, is there another?

2009-10-22 Thread Olivier Bourgeois
2009/10/21 dtoffe dto...@yahoo.com.ar


By the way, just out of curiosity, what are the specific features you
 are missing in Wicket Bench ??

 Regards,

 Daniel


 Hi,

   I tried a little bit Wicket Bench and stoped because it's missing one
important feature for me : a way to use a custom IResourceFinder to load the
templates.

  All my templates are in a different folder than the source code, so Wicket
Bench was yelling at me because it could'nt find them.


Re: Localization of values coming from my Model

2009-10-19 Thread Olivier Bourgeois
Use the StringResourceModel with properties bundle, it is very powerful
because you can add dynamic data coming from the model. I've done some
things like this, assuming infoModel.dateFormat() returns a formated date  :

new Label(tableTitle, new StringResourceModel(table.title, this, new
ModelInfoModel(infoModel)));

and in the properties english bundle :

table.title=This table was built on $dateFormat

And then you create a bundle for each locale you need.

Now for something more tricky, you could solve your problem like this.
Create the properties bundle :

gender.female = Female
gender.male = Male
active.yes = Yes
active.no = No

and in your code :

new StringResourceModel(gender_${gender}, this, getModel(;
new StringResourceModel(active_${active}, this, getModel(;

and in your model you simply return the key based on your condition, and it
will work magically.


Re: Howto accept other then first locale in HTTP header Accept-Language?

2009-10-19 Thread Olivier Bourgeois
2009/10/16 Per Newgro per.new...@gmx.ch

 Hi Olivier,

 isn't mod_jk a bit heavyweight for this little usecase?


I don't know your case, for mine, every project I worked on already had a
mod_jk. And it is a common pattern with J2EE development : simply because
when you have static resources to serve on a high traffic site, then it is
Tomcat who becomes heavyweight :)



 I like the locale usage of wicket. It is like magic and i don't have to
 worry about it.
 All i want to add to my application is the check for a supported locale on
 session startup.

 But thanks anyway.

 Per


And the overload of getLocale() would'nt work ?


Re: Howto accept other then first locale in HTTP header Accept-Language?

2009-10-19 Thread Olivier Bourgeois
Ho well, I didn't understood correctly your question, sorry.

Have you tried tho use a custom WebSession ?

- in your WebApplication class overload the newSession method :

@Override
public Session newSession(Request request, Response response) {
return new YourCustomSession(this, request);
}

- create the class YourCustomSession extending WebSession, then override
getLocale() :

@Override
public Locale getLocale() {
// TODO Auto-generated method stub
return super.getLocale();
}

in YourCustomSession you have access to the Request locale that you can
restrict to only supported values in your custom getLocale().

2009/10/19 Per Newgro per.new...@gmx.ch

 Hi Olivier

 And the overload of getLocale() would'nt work ?



 I don't see how it could solve my problem. What i try is to filter the
 locales assignable to session.
 It will be assigned in Application.newSession(Request, Response) by usage
 of the Accepted-Langauge
 value in header of response. That seems the right place to ensure only
 supported languages.

 WIth overwriting Page.getLocale() i don't see the way on howto get the
 accepted locales of client browser.

 Thanks

 Per

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




Re: Howto accept other then first locale in HTTP header Accept-Language?

2009-10-19 Thread Olivier Bourgeois
Well, you can't change the behaviour of ServletRequest.getLocale() unless
you want to patch your servlet container :)

But you make me think it would be great in the Servlet API to have something
like setAcceptedLocales(Enumeration e) and let the servlet container do the
work of matching the browser locale with your application supported locales.
Anyway, it's out of Wicket's scope :-)

What you can do is do the work in your overloaded WebSession.getLocale() :

@Override
public Locale getLocale() {
Enumeration _enum = ((WebRequest)
request).getHttpServletRequest().getLocales();
// Do your work with locales _enum here
return request.getLocale();
};

getLocales() returns what you are looking for, in my case it is :

[fr, sv, ar, bg, zh_CN, it, en]

2009/10/19 Per Newgro per.new...@gmx.ch

 Hi Olivier,

 you wrote exactly what i did. But if you check the extraction of locale
 from request
 to provide it in session, you can see that only first accepted language is
 evaluated and used if not-null.
 But if you assume that first accpeted language is CHINESE and second is
 FRENCH and the
 application is supporting FRENCH you don't have any chance to get the
 second locale.

 And thats my problem.

 Cheers

 Per

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




How to add a dynamic HTML comment ?

2009-10-19 Thread Olivier Bourgeois
Hi list,

   I'm trying to add to my page header a comment that contains some
informations extracted from my app, like this :

!-- App Version 1.0.0  -  Build: 2009-10-19 16:20:00 --

But I just can't find a way to do this in Wicket : a component inside a
comment is not recognised, and there is no Comment component.

Anyone got an idea of how to do this ?

thx

Olivier


Re: How to add a dynamic HTML comment ?

2009-10-19 Thread Olivier Bourgeois
Ha thanks Jeremy !

And I didn't think of that :(

2009/10/19 Jeremy Thomerson jer...@wickettraining.com

 add(new Label(comment, !-- foo bar --).setEscapeModelStrings(false));

 --
 Jeremy Thomerson
 http://www.wickettraining.com





Re: Howto accept other then first locale in HTTP header Accept-Language?

2009-10-16 Thread Olivier Bourgeois
If you are using Apache + Mod-JK in front of your webapp, you can use
mod_rewrite features to rewrite the HTTP headers and force the accepted
language field to a value your application supports.

Otherwise you can simply create a class that extends WebPage, then override
the getLocale() method and make all your page extend this class :

@Override
public Locale getLocale() {
// TODO Implement a locale mapping and fallback
return super.getLocale();
}


2009/10/16 Per Newgro per.new...@gmx.ch


 A solution would be to extract the accepted langauges myself from header
 and set default
 only if no supported locale is accepted by client-browser. But then i have
 to (re)-implement
 language extraction similiar to MockHttpServletRequest.getLocale(). But
 this breaks the famous
 Don't repeat yourself programmming rule :-).

 A much better approch would be to provide a list of supported locales in
 application settings.
 So the request could set in automatically and use Locale.getDefault() only
 on last exit.

 What do you think?
 Per

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




Re: Wicket Bulgarian translation (bg)

2009-10-12 Thread Olivier Bourgeois
What version of Wicket are you using ?

You should have native2ascii encoded strings in the property file :

Required=\u00d0\u0178\u00d0\u00be\u00d0\u00bb\u00d0\u00b5\u00d1\u201a\u00d0\u00be
'${label}' \u00d0\u00b5
\u00d0\u00b7\u00d0\u00b0\u00d0\u00b4\u00d1\u0160\u00d0\u00bb\u00d0\u00b6\u00d0\u00b8\u00d1\u201a\u00d0\u00b5\u00d0\u00bb\u00d0\u00bd\u00d0\u00be.


2009/10/11 Girts Ziemelis girts.zieme...@gmail.com

 Is anyone using wicket with bulgarian translations?
 It seems, the standard wicket messages for bulgarian
 Application_bg.properties are all messed up :(
 Unfortunately I do not speak/write Bulgarian, but version of survey we are
 running is also in BG and our Bulgarian colleagues are complaining about
 standard error messages being messed up.
 Site is in UTF-8 and many other non standard charset languages are working
 fine (e.g. Russian, Latvian).
 Strings in the wicket property file do not seem to contain proper Cyrillic
 characters:
 e.g: string for
 Required=Полето '${label}' е задължително.
 I do not believe is a proper cyrillic text.
 Can anyone confirm the problem, before I submit the bug report?





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




Re: Wicket Bulgarian translation (bg)

2009-10-12 Thread Olivier Bourgeois
2009/10/12 Girts Ziemelis girts.zieme...@gmail.com

 Wicket version is 4.1
 Regarding encoding - I know - it is encoded in the properties file -strings
 I posted are once the strings are decoded to UTF-8 -for IDE (Netbeans, for
 example, does this automatically for *.properties files) and for the web
 site (in UTF-8).
 For example - ASCII escapes below - first letter \u00d0 is
 http://www.fileformat.info/info/unicode/char/00d0/index.htm
 which is not a letter from Cyrillic.
 My understanding is that all cyrilic charset letters are in unicode block
  \u04xx
 http://czyborra.com/charsets/cyrillic.html

 Are you using BG translation which works correctly?


I'm using BG translations for my app, but not the Wicket default ones, and I
am using a mix of UTF-8 properties files and XML files. I just had a look
with wicket 1.4.2 and the BG translations are broken : I think something
went wrong with the native2ascii transformation.

If you look at the history of the Wicket BG translation file, it used to be
in UTF-8, but because Java properties does not hold UTF-8 it has been
encoded in ASCII. Now that Wicket 1.4.x can work with XML properties. I
think this file should be in XML, like RU file is today.


Re: Wicket Bulgarian translation (bg)

2009-10-12 Thread Olivier Bourgeois
The advantage of UTF-8 vs ASCII is that the translators can directly
read/write the property files without transcoding them, so I think it's
better to go with XML (and less risky).

But I don't know what the Wicket dev team prefer for Wicket default property
files.


2009/10/12 Girts Ziemelis girts.zieme...@gmail.com

 Olivier Bourgeois wrote:

 I'm using BG translations for my app, but not the Wicket default ones, and
 I
 am using a mix of UTF-8 properties files and XML files. I just had a look
 with wicket 1.4.2 and the BG translations are broken : I think something
 went wrong with the native2ascii transformation.

 If you look at the history of the Wicket BG translation file, it used to
 be
 in UTF-8, but because Java properties does not hold UTF-8 it has been
 encoded in ASCII. Now that Wicket 1.4.x can work with XML properties. I
 think this file should be in XML, like RU file is today.


 Yes - our BG translations from our property files also work fine - it is
 just the wicket standard messages.
 Ok, I will try to get the old translations back and encode them properly.
 It seems they are wrong since may 2006 :(
 Or is it really preferred to store them in XML? Currently russian is the
 only one in XML.




Re: How do you achieve persistency

2009-10-07 Thread Olivier Bourgeois
Why would you replace the Wicket filter ?

You can have multiple filters defined in your web.xml , they are chained by
your application server.

2009/10/7 Peter Arnulf Lustig u...@yahoo.de

 Great piece of software!

 But how did you manage to replace

 the web.xml filterclass into:


 filter-classorg.apache.cayenne.conf.WebApplicationContextFilter/filter-class

 when Wicket needs its own filter class
 filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class


For the persistency question, if you go to filesystem storage and want to
have a decent querying system, you can also consider using a JCR content
repository :

http://en.wikipedia.org/wiki/Content_repository_API_for_Java

I believe that most of web applications are manipulating hierarchical data,
and for that kind of stuff a Database ORM may not be the most efficient
tool. I think Google Storage uses that kind of approach : hirerachical
filesystem storage.

Of course if you have to do do queries with joins (like in SQL) things will
become much more complicated that with a gold old JPA + Hibernate + DBMS


Re: How do you achieve persistency

2009-10-07 Thread Olivier Bourgeois
It's not a problem, you can have multiple filters, they will be called in
sequence when you hit an URL that matches your filter-mapping. Example for
spring-security :

filter
filter-namespringSecurityFilterChain/filter-name

filter-classorg.springframework.web.filter.DelegatingFilterProxy/filter-class
/filter
filter
filter-namewicket/filter-name

filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
init-param
param-nameapplicationFactoryClassName/param-name
param-value
org.apache.wicket.spring.SpringWebApplicationFactory
/param-value
/init-param
/filter
filter-mapping
filter-namespringSecurityFilterChain/filter-name
url-pattern/*/url-pattern
/filter-mapping
filter-mapping
filter-namewicket/filter-name
url-pattern/*/url-pattern
dispatcherREQUEST/dispatcher
dispatcherERROR/dispatcher
/filter-mapping

Just add your Cayenne filter in your web.xml and you're done.

2009/10/7 Peter Arnulf Lustig u...@yahoo.de

 Cayenne needs his own filter.



 - Ursprüngliche Mail 
 Von: Olivier Bourgeois olivier.bourgeois@gmail.com
 An: users@wicket.apache.org
 Gesendet: Mittwoch, den 7. Oktober 2009, 10:10:00 Uhr
 Betreff: Re: How do you achieve persistency

 Why would you replace the Wicket filter ?

 You can have multiple filters defined in your web.xml , they are chained by
 your application server.

 2009/10/7 Peter Arnulf Lustig u...@yahoo.de




Re: Feedback messages, input and label

2009-10-07 Thread Olivier Bourgeois
Have you tried something like this in your page.java :

pwd.setLabel(new ModelString(Password));

?


2009/10/7 Tomás Rossi tro...@mecon.gov.ar

 Hi,

 lets say you have this in you html form:
 --
 ...
 label for=pwdPassword/label
 input type=password id=pwd wicket:id=inputPwd/
 ...
 --

 Then, a properties file for your app with this:
 --
 ...
 Required=Field ${label} is required!
 ...
 --

 When the required-error-message prints, it does like this:

 * Field inputPwd is required!

 Now I wish I could change it to say Field Password is required! without
 modifying wicket:id attribute nor adding specific required message for the
 component.
 Is this possible?

 Kind regards,
 Tom;

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




Re: Wicket in France

2009-09-24 Thread Olivier Bourgeois
I'm located in Paris. We are just missing somebody from Lille and Nice for a
perfect dispatch :)


Re: wicket.properties conflict 1.2.6 vs 1.4.1

2009-09-14 Thread Olivier Bourgeois
Except that you can parameter JBoss to use an optimization of its own :
UnifiedClassloader :


http://www.jboss.org/community/wiki/classloadingconfiguration

 In jboss-3.2.3, the jbossweb-tomcat41.sar is configured to use a unified
 class loader as the web application class loader. This is controlled by the
 UseJBossWebLoader attribute in the
 jbossweb-tomcat41.sar/META-INF/jboss-service.xml descriptor. The use of a
 unified class loader means that the classes available in the war inside of
 the WEB-INF/classes and WEB-INF/lib are incorporated into the default shared
 class loader repository. This may not be what you want as its contrary to
 the default servlet 2.3 class loading model and can result in sharing of
 classes/resources between web applications. You can disable this by setting
 this attribute to false.



That is, if this setting is activated all webapps are sharing the same
classloader, which is of course not J2EE standard, and you can't use two
different versions of Wicket.

2009/9/14 Igor Vaynberg igor.vaynb...@gmail.com:
 if the two apps are deployed as two separate apps then they should not
 see each other's jars and therefore should not see each other's
 wicket.properties files.

 -igor

 On Mon, Sep 14, 2009 at 4:08 AM, A. Zwaan a.zw...@finan.nl wrote:
 Sorry about the late reply, the migration was put on hold for a couple of
days as some higher priority project needed some extra resources.

 The wicket 1.2.6 jar is in an ear file, which is one of the applications.
The 1.4.1 jar is included in a war file, which is the other application.
Both are deployed with the same JBoss instance.


Re: wicket.properties conflict 1.2.6 vs 1.4.1

2009-09-14 Thread Olivier Bourgeois
I think you have to put them in different wars and not to use
UnifiedClassloader. The wars have access to the ear classloader (otherwise
they would not have access to the EJBs) so putting 1.2.3 on the ear
classpath and 1.4.x on the war classpath should not work.

2009/9/14 nino martinez wael nino.martinez.w...@gmail.com

 I meant ear files

 2009/9/14 nino martinez wael nino.martinez.w...@gmail.com:
  You can if you put them in different wars.. That will work.
 
  We have a similar setup that does this.
 
  2009/9/14 Olivier Bourgeois olivier.bourgeois@gmail.com:
  Except that you can parameter JBoss to use an optimization of its own
 :
  UnifiedClassloader :
 



Re: UTF-8

2009-09-03 Thread Olivier Bourgeois
Allright, I fed the daemon ;)

I created a new issue in
https://issues.apache.org/jira/browse/WICKET-2451 and I found that
WICKET-1443 is similar but already closed since 1 year.

2009/9/2 Eelco Hillenius eelco.hillen...@gmail.com:
 The result is in the attachment file (sorry but I don't have a quick
 way to do a patch file against SVN trunk at the moment).

 The mailing list daemon thinks attachments are delicious. The way to
 submit patches is to attach it to a JIRA issue. Did anyone already
 open a feature request for this? If not, please open an issue here:
 http://issues.apache.org/jira/browse/WICKET. Further discussion and
 patches can go there.

 Cheers,

 Eelco

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



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



Re: UTF-8

2009-09-02 Thread Olivier Bourgeois

 But I'm sure you can write a properties implementation that reads from
 UTF-8 in a few hours max, especially now that you have an example in
 Tapestry's code. Patch is welcome :-)

 Eelco

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

I just had a look at Tapestry 4.0.2 implementation and it uses 13
classes all located in the package org.apache.tapestry.util.text.* and
that are under  Apache License, Version 2.0. All other imports are
java.util.* and java.io.* so at first look it seems to be reusable.

The important point is that the reader uses an InputStreamReader that
honors the encoding you set in the application. The other 12 classes
are a nice reimplementation of the JDK Properties.load0(LineReader lr)
method. IMHO the JDK stuff is really outdated and looke like C/C++
code.

And 90% of the code in both version is here to handle comments,
whitespaces, carriage return and all that kind of stuff, so if
somebody knows a good reusable parser able to handle properties files
grammar, the job is almost done.

Later I'll have a look at T 5.1 implementation and
org.springframework.context.support.ReloadableResourceBundleMessageSource
as suggested and I'll let you know.

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



Re: UTF-8

2009-09-02 Thread Olivier Bourgeois
I had a look at T5 and Spring code :

- Spring checks if the JDK supports UTF-8 files, and if it does not
support it acts like T4 and parses the properties file. The
implementation is much more compact than in T4.

- T5 does a native2ascii conversion of the properties files on the fly.

So I figured out a quick patch that is a combination of the 3 methods :

- try to use JDK 6 native implementation
- if not available then convert on the fly to ASCII and use native JDK
=5 properties

The result is in the attachment file (sorry but I don't have a quick
way to do a patch file against SVN trunk at the moment). The method
readUTFStreamToEscapedASCII is directly borrowed from T5.1 (Apache
License 2.0), and I slightly modified PropertiesFilePropertiesLoader
constructor and loadProperties().Tell me what you think of that.

I only runed the Maven build on wicket-1.4.1 to check that the unit
tests are not broken. I think that I should use
application.getMarkupSettings().getDefaultMarkupEncoding() to set the
encoding of my InputStream, but when doing this the unit tests fail
with NullPointerException (and I don't have taken the time to look
deeper into this).

2009/9/2 Maarten Bosteels mbosteels@gmail.com:
 FYI,  spring supports UTF-8 property files as well:

 see org.springframework.context.support.ReloadableResourceBundleMessageSource

 Maarten



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

Re: UTF-8

2009-09-01 Thread Olivier Bourgeois
The people at my office handling translations are using a simple UTF-8
capable editor (that can be Eclipse for instance) and there is no need
to escape anything when you use UTF-8 in the properties files. That's
much more comfortable when working with arabic or chinese, because
people can read without unescaping, and they can also use a diff tool.

The point I was raising is that when working on a Tapestry
application, people at my office are used to have a simple property
format, and you can do this because they made a wrapper around native
Java Properties that can handle UTF-8 in properties file. When I
switched to Wicket and XML properties files, they complained that it
was much more verbose for no gain. And I don't have any objections to
this statement.

Doing the same thing with Wicket should be easy, basically it should
consists of changing the method :

PropertiesFilePropertiesLoader.loadProperties(BufferedInputStream in)

defined in PropertiesFactory class to *not* use Java Properties
directly but instead fill a new Property object from an InputStream.
And the InputStream should honor the application encoding set in the
Application settings, which in our case is UTF-8.

And you return Properties like before. That's it.

See :

http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/tapestry/util/text/LocalizedProperties.html

2009/9/1 Wojciech Żaboklicki zabia...@gmail.com:
 Man, use the native2ascii built-in JDK tool.
 It's very simple, transforms your messages into ASCII escaped.

 Regards,
 Wojtek

 Olivier Bourgeois pisze:

 That's exactly what I said : I had to use XML properties files to have
 UTF-8 localized properties.

 You can't use simple properties format because Java can't handle
 natively anything else than ISO. We use also Tapestry here, and you
 can use UTF-8 properties files (thanks to the wrapper around native
 Java properties).

 XML files are allright, but they are definitively verbose.

 2009/9/1 Eelco Hillenius eelco.hillen...@gmail.com:


 Erm
 http://chillenious.wordpress.com/2006/11/13/wicket-now-supports-resource-bundles-in-xml-format/


 Which says Wicket 2.0 (yes, it's that old), but it was also one of the
 first things backported. Loading is automatic, and .xml takes
 precedence over .properties.

 Eelco

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




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




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



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



Re: UTF-8

2009-09-01 Thread Olivier Bourgeois
Yeah, one charset to rule them all !

:-)

2009/9/1 Johan Compagner jcompag...@gmail.com:
 Everybody should stop using any other encoding then UTF-8
 Common people we should start this change from happening now :)

 Drop all charsets and all over the world. ban them everywhere, it should be
 illegal to use them, if you do still use them you should be thrown in to
 prison for at least 5 years.
 UTF-8 everywhere!


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



Re: Wicket + Spring Security (PreAuthentication)

2009-08-31 Thread Olivier Bourgeois
Looks like more of a spring-security question that a Wicket one : try
the spring-security forums. I suggest you have a look at this :

http://forum.springsource.org/showthread.php?t=52377

And this nice example up to date (but it's for wicket-swarn) :

http://out-println.blogspot.com/2009/02/wicket-swarm-spring-security-how-to.html

For your spring configuration, I think you will have to write a custom
AuthenticationProvider that handles you SSO cookie and checks the
token validity.


2009/8/28 Anders innocentl...@gmail.com:
 Hi,

 I refered to
 http://cwiki.apache.org/WICKET/spring-security-and-wicket-auth-roles.htmland
 wicket-spring example web application and it works.
 Now my company has a single-sign on web page already, like
 https:///login.cgi.
 This SSO web page will set cookies and return a token after login.
 I'd like to know how to use PreAuthentication of spring-security with my
 company's SSO web page?


 --
 --
 ~Mia は 最高!~
 --


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



Re: UTF-8

2009-08-31 Thread Olivier Bourgeois
I am using Wicket 1.4 with UTF-8 pages and properties, and I added in
my Application :

getMarkupSettings().setDefaultMarkupEncoding(UTF-8);
getRequestCycleSettings().setResponseRequestEncoding(UTF-8);

That's enough. For the localization properties files I had to use XML
properties files like this :

?xml version=1.0 encoding=UTF-8?
!DOCTYPE properties SYSTEM http://java.sun.com/dtd/properties.dtd;
properties
entry key=page.titleTitre de la page/entry
/properties

Because Wicket uses Java Properties objects and it can't handle UTF-8.
In Tapestry they made a wapper around Java Properties so that you can
use the good old properties format (ie key=value) with UTF8 encoding
and IMO it's a nice feature missing in Wicket.


2009/8/31 Douglas Ferguson doug...@douglasferguson.us:
 Excellent.

 I saw a bunch of emails floating around saying that you'd have to also

 1) Edit connectors in server.xml and add URIEncoding=UTF-8
 2) Call request.setCharacterEncoding(UTF-8) (at the very beginning of the 
 cycle)

 Are those also necessary?

 I'm assuming that I'll need these:
 property name=hibernate.connection.characterEncodingUTF-8/property
 property name=hibernate.connection.useUnicodetrue/property


 On Aug 31, 2009, at 5:48 AM, Tomasz Dziurko wrote:

 Add this to init() method in your Application class:

 getMarkupSettings().setDefaultMarkupEncoding(UTF-8);
 getRequestCycleSettings().setResponseRequestEncoding(UTF-8);

 This should be enough.

 --
 Regards,
 Tomasz Dziurko



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



Localized sorting column in a DefaultDatatable

2009-07-07 Thread Olivier Bourgeois
Hi,

I'm trying to implement a simple sortable datatable with Wicket, and I'm
struggling with an issue I can't find a way to solve : how to build a
sortable column when the data to be sorted is also to be translated and
comes from the property files (not from the model directly) ?

I've done this :
- I build an AjaxDefaultDataTable with a sortable dataprovider containing a
country ZoneCode
- this ZoneCode is a key in the property files that provides the display
ZoneLabel

So I thought this kind of code would do the trick :

ListIColumnCountryDetails columns = new
ArrayListIColumnCountryDetails();
columns.add(new PropertyColumnCountryDetails(new
ModelString(Zone), zoneLabel, zoneCode) {

@Override
public void populateItem(ItemICellPopulatorCountryDetails
item, String componentId, IModelCountryDetails rowModel) {
CountryDetails detail = rowModel.getObject();
StringResourceModel srm = new
StringResourceModel(detail.getZoneCode(), item, rowModel);
item.add(new Label(componentId, srm));
detail.setZoneLabel(srm.getString());
}
});

but all I got is a NullPointerException because a ZoneLabel is empty at some
point in the sort and and a lot of warnings in the logs :

- WARN  org.apache.wicket.Localizer - Tried to retrieve a localized string
for a component that has not yet been added to the page. This can sometimes
lead to an invalid or no localized resource returned. Make sure you are not
calling Component#getString() inside your Component's constructor. Offending
component: [MarkupContainer [Component id = 1]]

Any ideas ?

thanks in advance,
Olivier.