You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Sjur Moshagen <sj...@mac.com> on 2006/09/21 08:45:36 UTC
BUG: LM and i18n
Hello,
with my language override menu in working shape, I found one less
wanted behaviour in Forrest. When changing that to a better one, I
encountered a bug.
1) the less-than-optimal behaviour
When switching language using the override menu, the language
selection is not "remembered". Thus, the next document you look at
will be presented in the first language, and you will have to switch
again if you want the other language (the one you selected when
reading the first document). This is normally unwanted behaviour:
when a user switch language, it is usually an action of preference,
which should be remembered (stored in the session, a cookie, the
request - whatever).
The cause:
The main sitemap (in FORREST_HOME/main/webapp) contains the following
settings for LocaleAction:
<map:action name="locale" src="org.apache.cocoon.acting.LocaleAction">
<!-- See http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/
acting/LocaleAction.html for a description of these parameters -->
<!-- FIXME (FOR-887): make these configurable, using same
parameters for LocaleMatcher and LocaleAction -->
<default-locale language="en" country="US"/>
<use-locale>true</use-locale>
<store-in-request>false</store-in-request>
<create-session>false</create-session> <---
<store-in-session>false</store-in-session> <---
<store-in-cookie>false</store-in-cookie> <---
<locale-attribute>locale</locale-attribute>
</map:action>
These should, in my opinion, be set to 'true' by default.
2) the BUG
When setting the above parameters to true and restarting forrest, the
next time I do the following:
- open http://localhost:8888/index.html (in nb/Norwegian) - ok
- switch to English (?locale=en) - ok
- open another document http://localhost:8888/lang-policy.html - ERROR
I get the bug. The ERROR reported is:
Internal Server Error
Message: null
Description: No details available.
Sender: org.apache.cocoon.servlet.CocoonServlet
Source: Cocoon Servlet
Request URI
lang-policy.html
cause
Could not resolve locationmap location.
request-uri
/lang-policy.html
Apache Cocoon 2.2.0-dev
It seems that the LM does not work well together with session-induced
locale selection. The stack-trace is added below.
Sjur
ERROR (2006-09-21) 09:37.44:913 [access] (/lang-policy.html)
PoolThread-4/CocoonServlet: Internal Cocoon Problem
org.apache.cocoon.ProcessingException: Failed to process pipeline
at <map:serialize type="xhtml"> - file:/usr/local/forrest/build/
plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap:
161:39
at <map:transform> - file:/usr/local/forrest/build/plugins/
org.apache.forrest.plugin.internal.dispatcher/internal.xmap:160:13
at <map:transform> - file:/usr/local/forrest/build/plugins/
org.apache.forrest.plugin.internal.dispatcher/internal.xmap:157:13
at <map:transform type="dispatcher"> - file:/usr/local/forrest/build/
plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap:
147:42
at <map:generate type="jx"> - file:/usr/local/forrest/build/plugins/
org.apache.forrest.plugin.internal.dispatcher/internal.xmap:142:70
at <map:mount> - file:/Users/sjur/Documents/i18n/sd/build/tmp/
internal.xmap:33:158
at <map:mount> - file:/usr/local/forrest/main/webapp/sitemap.xmap:
410:120
at org.apache.cocoon.ProcessingException.throwLocated
(ProcessingException.java:144)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.handleE
xception(AbstractProcessingPipeline.java:894)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPi
peline(AbstractProcessingPipeline.java:370)
at
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipe
line.setupPipeline(AbstractCachingProcessingPipeline.java:614)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.prepare
Pipeline(AbstractProcessingPipeline.java:459)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process
(AbstractProcessingPipeline.java:409)
at
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(
SerializeNode.java:137)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:55)
at
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i
nvoke(PreparableMatchNode.java:116)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:77)
at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke
(PipelineNode.java:155)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:77)
at
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(
PipelinesNode.java:95)
at
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process
(ConcreteTreeProcessor.java:292)
at
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process
(ConcreteTreeProcessor.java:223)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process
(TreeProcessor.java:289)
at
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke
(MountNode.java:114)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:77)
at
org.apache.cocoon.components.treeprocessor.sitemap.SelectNode.invoke
(SelectNode.java:81)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:77)
at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke
(PipelineNode.java:155)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:77)
at
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(
PipelinesNode.java:95)
at
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process
(ConcreteTreeProcessor.java:292)
at
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process
(ConcreteTreeProcessor.java:223)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process
(TreeProcessor.java:289)
at
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke
(MountNode.java:114)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:77)
at
org.apache.cocoon.components.treeprocessor.sitemap.SelectNode.invoke
(SelectNode.java:81)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:77)
at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke
(PipelineNode.java:155)
at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:77)
at
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(
PipelinesNode.java:95)
at
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process
(ConcreteTreeProcessor.java:292)
at
org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process
(ConcreteTreeProcessor.java:223)
at org.apache.cocoon.components.treeprocessor.TreeProcessor.process
(TreeProcessor.java:289)
at org.apache.cocoon.Cocoon.process(Cocoon.java:557)
at org.apache.cocoon.servlet.CocoonServlet.service
(CocoonServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
354)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch
(WebApplicationHandler.java:294)
at org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1808)
at org.mortbay.jetty.servlet.WebApplicationContext.handle
(WebApplicationContext.java:525)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1758)
at org.mortbay.http.HttpServer.service(HttpServer.java:879)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
at org.mortbay.http.SocketListener.handleConnection
(SocketListener.java:197)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:501)
Caused by: org.apache.cocoon.ProcessingException: Error during
resolving of 'lm://resolve.structurer.lang-policy'.
at <map:serialize> - file:/usr/local/forrest/build/plugins/
org.apache.forrest.plugin.internal.dispatcher/internal.xmap:97:26
at <map:generate> - file:/usr/local/forrest/build/plugins/
org.apache.forrest.plugin.internal.dispatcher/internal.xmap:96:59
at
org.apache.cocoon.template.script.DefaultScriptManager.resolveTemplate
(DefaultScriptManager.java:127)
at
org.apache.cocoon.template.script.DefaultScriptManager.resolveTemplate
(DefaultScriptManager.java:75)
at org.apache.cocoon.template.JXTemplateGenerator.setup
(JXTemplateGenerator.java:101)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPi
peline(AbstractProcessingPipeline.java:341)
... 49 more
Caused by: org.apache.cocoon.ProcessingException: Error during
resolving of 'lm://resolve.structurer.lang-policy'.
at <map:serialize> - file:/usr/local/forrest/build/plugins/
org.apache.forrest.plugin.internal.dispatcher/internal.xmap:97:26
at <map:generate> - file:/usr/local/forrest/build/plugins/
org.apache.forrest.plugin.internal.dispatcher/internal.xmap:96:59
at org.apache.cocoon.components.source.SourceUtil.handle
(SourceUtil.java:397)
at org.apache.cocoon.generation.FileGenerator.setup
(FileGenerator.java:83)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPi
peline(AbstractProcessingPipeline.java:341)
at
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipe
line.setupPipeline(AbstractCachingProcessingPipeline.java:614)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.prepare
Pipeline(AbstractProcessingPipeline.java:459)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.prepare
Internal(AbstractProcessingPipeline.java:473)
at org.apache.cocoon.components.source.impl.SitemapSource.init
(SitemapSource.java:276)
at org.apache.cocoon.components.source.impl.SitemapSource.<init>
(SitemapSource.java:146)
at
org.apache.cocoon.components.source.impl.SitemapSourceFactory.getSource(
SitemapSourceFactory.java:65)
at
org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI
(CocoonSourceResolver.java:159)
at
org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI
(CocoonSourceResolver.java:189)
at
org.apache.cocoon.template.script.DefaultScriptManager.resolveTemplate
(DefaultScriptManager.java:84)
... 52 more
Caused by: org.apache.excalibur.source.SourceException: Could not
resolve locationmap location.
at
org.apache.forrest.locationmap.source.impl.LocationmapSourceFactory.getS
ource(LocationmapSourceFactory.java:75)
at
org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI
(CocoonSourceResolver.java:159)
at
org.apache.cocoon.environment.internal.EnvironmentHelper.resolveURI
(EnvironmentHelper.java:134)
at
org.apache.cocoon.environment.internal.EnvironmentHelper.resolveURI
(EnvironmentHelper.java:144)
at org.apache.cocoon.generation.FileGenerator.setup
(FileGenerator.java:81)
... 62 more
Re: BUG: LM and i18n
Posted by Cyriaque Dupoirieux <Cy...@pcotech.fr>.
le 21/09/2006 22:50 Sjur Moshagen a écrit :
> Den 21. sep. 2006 kl. 23.15 skrev Sjur Moshagen:
>
>>> If not then set a breakpoint on LocationmapSourceFactory.java:75 and
>>> take a look at the file location.
>>
>> How do I set a breakpoint? Anyway, I will try to produce more
>> debugging info.
>
> After I did this, the error disappeared. Forrest is now behaving
> exactly the way I want - clicking on a language makes that language
> the default language for subsequent requests.
>
> I have no idea what fixed the bug - I have later commented out my
> extra debug line, and there's no change.
>
> Perhaps rebuilding Forrest did something. Anyway - no bug anymore!
Cache problem perhaps ?
>
> Sjur
>
>
Re: BUG: LM and i18n
Posted by Sjur Moshagen <sj...@mac.com>.
Den 21. sep. 2006 kl. 23.15 skrev Sjur Moshagen:
>> If not then set a breakpoint on LocationmapSourceFactory.java:75
>> and take a look at the file location.
>
> How do I set a breakpoint? Anyway, I will try to produce more
> debugging info.
After I did this, the error disappeared. Forrest is now behaving
exactly the way I want - clicking on a language makes that language
the default language for subsequent requests.
I have no idea what fixed the bug - I have later commented out my
extra debug line, and there's no change.
Perhaps rebuilding Forrest did something. Anyway - no bug anymore!
Sjur
Re: BUG: LM and i18n
Posted by Sjur Moshagen <sj...@mac.com>.
Den 21. sep. 2006 kl. 18.47 skrev Ross Gardler:
> Sjur Moshagen wrote:
>> 2) the BUG
>> When setting the above parameters to true and restarting forrest,
>> the next time I do the following:
>> - open http://localhost:8888/index.html (in nb/Norwegian) - ok
>> - switch to English (?locale=en) - ok
>> - open another document http://localhost:8888/lang-policy.html -
>> ERROR
>> I get the bug. The ERROR reported is:
>
> ...
>
>
>> Caused by: org.apache.excalibur.source.SourceException: Could not
>> resolve locationmap location.
>> at
>> org.apache.forrest.locationmap.source.impl.LocationmapSourceFactory.g
>> etSource(LocationmapSourceFactory.java:75) at
>> org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI
>> (CocoonSourceResolver.java:159)
>
> The question is what is the file it is looking for, abd why is
> looking for a file that is not present. You should be able to find
> this information in the locationmap logs (you may be able to
> increase the logging level to debug).
The only info in the locationmap.log file is:
WARN [core.modules.mapper.lm] (/lang-policy.html): Source
'org.apache.excalibur.source.impl.FileSource@520a06' not found
WARN [core.modules.mapper.lm] (/index.html): Source
'org.apache.excalibur.source.impl.FileSource@cd3bec' not found
> If not then set a breakpoint on LocationmapSourceFactory.java:75
> and take a look at the file location.
How do I set a breakpoint? Anyway, I will try to produce more
debugging info.
> Knowing what the file is should give us a clue as to why it is
> looking in the wrong place.
I'll try.
Sjur
Re: BUG: LM and i18n
Posted by Ross Gardler <rg...@apache.org>.
Sjur Moshagen wrote:
> 2) the BUG
>
> When setting the above parameters to true and restarting forrest, the
> next time I do the following:
>
> - open http://localhost:8888/index.html (in nb/Norwegian) - ok
> - switch to English (?locale=en) - ok
> - open another document http://localhost:8888/lang-policy.html - ERROR
>
> I get the bug. The ERROR reported is:
>
...
> Caused by: org.apache.excalibur.source.SourceException: Could not
> resolve locationmap location.
> at
> org.apache.forrest.locationmap.source.impl.LocationmapSourceFactory.getSource(LocationmapSourceFactory.java:75)
>
> at
> org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI(CocoonSourceResolver.java:159)
>
The question is what is the file it is looking for, abd why is looking
for a file that is not present. You should be able to find this
information in the locationmap logs (you may be able to increase the
logging level to debug). If not then set a breakpoint on
LocationmapSourceFactory.java:75 and take a look at the file location.
Knowing what the file is should give us a clue as to why it is looking
in the wrong place.
Ross