AW: [opencms-dev] Missing element that calls a customizedEventListener
Bernd Wolfsegger
bw at code-create.com
Tue Mar 29 10:16:06 CEST 2005
Hi Martin,
On Tuesday 29 March 2005 09:37, Martin Lehnert wrote:
> Hi,
>
> I already tried the solution with a custom LocaleHandler, but the only way
> I figured out to handle the locale was to store the information about which
> locale should be used in the session of the user and get it by accessing
> the HttpServletRequest.
> But: When I store the information about which language should be used in
> the session, how should the cache find out what he has to deliver?
What cache do you mean? The OpenCms Flexcache? You just have to add the
"locale" parameter to the cache property, or/and the "param" parameter.
Or do you mean the Browser cache?
For dynamically generated pages I always disable browser caching
programmatically, using meta tags AND the HttpServletResponse.
If you don't do that, you have a problem with dynamic content anyway.
And how do you decide what Language to use?
If you do it with a parameter in the url, the urls are not identically, and
everytime you change language, e.g. by a click on a button, the new decision
will be saved in the session. If you decide depending on the top level
domain, the urls are not identical too, and changing the top level domain
will also store the new decision into the session. But for different top
level domains there will be different sessions anyway.
> After
> all, there would be different language versions which can be reached by
> using the same URL.
> Second: Statistic programs for storing access information (to find out if a
> special localized version of the page pays out by counting the hits for
> english, german, etc ...) would be useless since they also don't get what
> the user exactly requested.
Again, there is the parameter in the url everytime you change the language, so
all subsequent request made for the same user are in the same language until
the next appereance of the parameter.
And using top level domains you can recognize it depending on the domain.
> Third: If the entire page is only usable by using caching, this would mean
> to have cookies activated all the time: an assumption that my client is not
> willing to take...
I don't understand.
I use the Flex Cache and all works fine. The German pages are cached
separately from the English ones.
>
> The bottom line: Is there any way to write a custom Lacale Handler without
> storing the information in sessions?
But you have to store the value somewhere ... or you have to carry the
language parameter in your urls. Then you have to generate your urls on your
page always with this language parameter.
Regards, Bernd
>
> Greetings,
>
> Martin Lehnert
> Hannecke IT-Solutions GmbH
> Martin-Luther-Str. 5b
> 97072 Würzburg
> Tel.: 0931-99 135 12
> Fax: 0931-99 135 29
> Email: martin.lehnert at hannecke-its.de
>
>
> -----Ursprüngliche Nachricht-----
> Von: Bernd Wolfsegger [mailto:bw at code-create.com]
> Gesendet: Samstag, 26. März 2005 12:51
> An: opencms-dev at opencms.org
> Cc: Martin Lehnert
> Betreff: Re: [opencms-dev] Missing element that calls a
> customizedEventListener
>
> Hi,
>
> you don't need any siblings for language handling.
> You just have to write a custom LocaleHandler and set it in the
> opencms-system.xml as locale handler.
> And you don't have to touch the existing code for that!
> Your class has to be in the package org.opencms.
> Than the correct language content will be used automatically according to
> your likings and settings in this handler.
> And there is really no need for different documents, for each language
> one...
> Well, and that would be strange at all, to have all the different language
> content in one file and than have to use different files to get at the
> content :))
>
> Regards, Bernd
>
> On Thursday 24 March 2005 18:30, Martin Lehnert wrote:
> > Thank you very much for the fast responses... I think the workaround
> > with the servlet will do until this behaviour is implemented in OpenCms.
> >
> > Just one note though: The main reason why I want to create this
> > Listener is because I want to simplify the OpenCms-behaviour when I
> > want to add a resource in different languages. I think the existing
> > implementation with saving different languages in one xml-file and the
> > possibility to switch between them in the WYSIWYG-editor is really
> > great, but clients find it rather cumbersome to manually add siblings
> > for every language-version and configure them by adding the right locale
>
> property.
>
> > Since I understand the necessity to have the different
> > language-versions accessible through different URLs (for statistic and
> > caching-reasons for
> > example) I would propose another option in the workplace-context-menu
> > that automatically creates siblings with an adequate pre- or postfix
> > (e.g. ISO-locale-code) for every used language-version in the
> > xml-control code of a resource. This behaviour could also set the
> > fitting locale-property in the file's properties (perhaps it's even
> > better to start this behaviour automatically as soon as you save a
> > resource, while making it possible to deactivate this for people who
> > don't like this because they want to organize the their
> > language-versions differently).
> >
> > This is exactly the behaviour I want to implement through Listeners.
> > Unfortunately I am to create modules without touching the
> > OpenCms-source and have a very restrictive deadline, so I have to go
> > the way with Listeners, otherwise I would program this behaviour
> > directly into OpenCms and send it to you as a suggestion for incluing it
>
> into OpenCms.
>
> > When I'm finished, I could send you the code of the behaviour of my
> > listener, because once this is done I think it would not be too hard
> > to implement it the way I suggested. As long as you think this idea is
> > useful, of course.
> >
> > Greetings and thank you again,
> > Martin Lehnert
> >
> > >Hello,
> > >
> > >Thomas Maerz wrote:
> > >>"Martin Lehnert" <martin.lehnert at hannecke-its.de> writes:
> > >>>I also stumbled over a class of the TemplateOne-module
> > >>>(CmsTemplateParts) which is implementing the Listener-interface and
> >
> > is
> >
> > >>>used by other classes of the module, but when does the system call
> >
> > one
> >
> > >>>of those classes so that the Listener can register itself?
> > >>
> > >>,----[ CmsTemplateParts.java ]
> > >>
> > >>| // add an event listener
> > >>| OpenCms.addCmsEventListener(this);
> > >>
> > >>`----
> > >>
> > >>Maybe register your Listener in a JSP, that is requested for sure by
> > >>a user.
> > >>
> > >>I couldn't find a way to add listeners on startup, too.
> > >
> > >For this we have created our own small servlet and in the init()
> > >method
> > >
> > >we registered our listnerer.
> > >The servlet was called on startup by Tomcat and we made sure to be
> > >called *after* the OpenCms servlet.
> > >
> > >At least it was possible with OpenCms 5.0.
> > >
> > >Regards,
> > >Thomas
> > >
> > >
> > >
> > >Best regards,
> > >Andras Balogh.
> > >
> > >
> > >
> > >Small oversight on our part, this will be added ASAP.
> > >
> > >Best Regards,
> > >Alex.
> > >
> > >Alexander Kandzior
> > >Alkacon Software - The OpenCms Experts http://www.alkacon.com
> >
> > _______________________________________________
> > This mail is send to you from the opencms-dev mailing list To change
> > your list options, or to unsubscribe from the list, please visit
> > http://mail.opencms.org/mailman/listinfo/opencms-dev
--
[ Code Create
[ Information Technology & Architecture
[ Bernd Wolfsegger
[ Sun Certified Programmer for Java(TM) 2 Platform
[ Dipl.-Ing. Architekt
[ Office in Germany
[
[ Lohmeyerstrasse 13
[ 10587 Berlin
[ Germany
[ +49 (0)30 26555788
[ Office in Kenya
[
[ P.O. Box 890
[ V/Market
[ 00621 Nairobi
[ Kenya
[ +254 (0)720 481053
[ bw at code-create.de(com)
[ http://www.code-create.de(com)/
More information about the opencms-dev
mailing list