You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Alexander Klimetschek (JIRA)" <ji...@apache.org> on 2007/04/16 08:21:15 UTC

[jira] Created: (COCOON-2044) Servlet services calls to servlet: sometimes fail (on initial call)

Servlet services calls to servlet: sometimes fail (on initial call)
-------------------------------------------------------------------

                 Key: COCOON-2044
                 URL: https://issues.apache.org/jira/browse/COCOON-2044
             Project: Cocoon
          Issue Type: Bug
          Components: - Servlet service framework
    Affects Versions: 2.2-dev (Current SVN)
            Reporter: Alexander Klimetschek


The call to servlet:/something fails on the first attempt, the effect is an empty output stream. After a reload it mostly works, but I cannot yet give exact behaviour as I am still debugging the problem.

It seems to be related to the caching (because it works on the second attemp), but it also happens in a NonCachingProcessingPipeline.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Klimetschek updated COCOON-2044:
------------------------------------------

    Description: 
All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.

There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:

a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.

b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345

Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

  was:
All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.

There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:

a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.

b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345

Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.


<old_issue_description>
The call to servlet:/something fails on the first attempt, the effect is an empty output stream. After a reload it mostly works, but I cannot yet give exact behaviour as I am still debugging the problem.

It seems to be related to the caching (because it works on the second attemp), but it also happens in a NonCachingProcessingPipeline.
</old_issue_description>

        Summary: servlet: protocol URIs have to be globally unique for use as cache-keys  (was: servlet: protocol URIs are have to be globally unique for use as cache-keys)

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489907 ] 

Alexander Klimetschek commented on COCOON-2044:
-----------------------------------------------

Well, this is what I get with an URL like servlet:foobar:/xslt/html2html.xsl:

org.apache.cocoon.ProcessingException: Unable to get transformer handler for servlet:foobar:/xslt/html2html.xsl
	at [TransformerException] - servlet:foobar:/xslt/html2html.xsl:28:38
	at  - file:/Users/alex/Mindquarry/hack/mindquarry-meta-system/mindquarry-webapp/mindquarry-webapplication/../../mindquarry-tasks/mindquarry-tasks-block/src/main/resources/COB-INF/sitemap.xmap:117:52
	at  - file:/Users/alex/Mindquarry/hack/mindquarry-meta-system/mindquarry-webapp/mindquarry-webapplication/../../mindquarry-tasks/mindquarry-tasks-block/src/main/resources/COB-INF/sitemap.xmap:79:20
	at  - file:/Users/alex/Mindquarry/hack/mindquarry-meta-system/mindquarry-webapp/mindquarry-webapplication/../../mindquarry-tasks/mindquarry-tasks-block/src/main/resources/COB-INF/sitemap.xmap:67:64
	at  - file:/Users/alex/Mindquarry/hack/mindquarry-meta-system/mindquarry-webapp/mindquarry-webapplication/../../mindquarry-tasks/mindquarry-tasks-block/src/main/resources/COB-INF/sitemap.xmap:53:34
	at  - file:/Users/alex/Mindquarry/hack/mindquarry-meta-system/mindquarry-webapp/mindquarry-webapplication/../../mindquarry-tasks/mindquarry-tasks-block/src/main/resources/COB-INF/sitemap.xmap:99:31
	at  - file:/Users/alex/Mindquarry/hack/mindquarry-meta-system/mindquarry-webapp/mindquarry-webapplication/../../mindquarry-tasks/mindquarry-tasks-block/src/main/resources/COB-INF/sitemap.xmap:54:39
	at  - file:/Users/alex/Mindquarry/hack/mindquarry-meta-system/mindquarry-webapp/mindquarry-webapplication/../../mindquarry-tasks/mindquarry-tasks-block/src/main/resources/COB-INF/sitemap.xmap:894:39
	at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:313)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(PoolableProxyHandler.java:61)
	at $Proxy14.setup(Unknown Source)
	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPipeline(AbstractProcessingPipeline.java:374)
	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.preparePipeline(AbstractProcessingPipeline.java:484)
	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:429)
	at com.mindquarry.webapp.pipelines.RunningModeDependentPipeline.process(RunningModeDependentPipeline.java:252)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(PoolableProxyHandler.java:61)
	at $Proxy12.process(Unknown Source)
	at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:134)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
	at org.apache.cocoon.components.treeprocessor.sitemap.SwitchSelectNode.invoke(SwitchSelectNode.java:88)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
	at org.apache.cocoon.components.treeprocessor.sitemap.SelectNode.invoke(SelectNode.java:82)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
	at org.apache.cocoon.components.treeprocessor.sitemap.SwitchSelectNode.invoke(SwitchSelectNode.java:83)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
	at org.apache.cocoon.components.treeprocessor.ContainerNode.invoke(ContainerNode.java:37)
	at org.apache.cocoon.components.treeprocessor.CategoryNode.invokeByName(CategoryNode.java:65)
	at org.apache.cocoon.components.treeprocessor.sitemap.CallNode.invoke(CallNode.java:83)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
	at org.apache.cocoon.components.treeprocessor.sitemap.SwitchSelectNode.invoke(SwitchSelectNode.java:88)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
	at org.apache.cocoon.components.treeprocessor.ContainerNode.invoke(ContainerNode.java:37)
	at org.apache.cocoon.components.treeprocessor.CategoryNode.invokeByName(CategoryNode.java:65)
	at org.apache.cocoon.components.treeprocessor.sitemap.CallNode.invoke(CallNode.java:83)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
	at org.apache.cocoon.components.treeprocessor.sitemap.HandleErrorsNode.invoke(HandleErrorsNode.java:88)
	at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.prepareErrorHandler(ErrorHandlerHelper.java:191)
	at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.prepareErrorHandler(ErrorHandlerHelper.java:138)
	at org.apache.cocoon.components.treeprocessor.sitemap.ErrorHandlerHelper.invokeErrorHandler(ErrorHandlerHelper.java:106)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:165)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:77)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:93)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:240)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:171)
	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:251)
	at org.apache.cocoon.servlet.RequestProcessor.process(RequestProcessor.java:357)
	at org.apache.cocoon.servlet.RequestProcessor.service(RequestProcessor.java:163)
	at org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:62)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:540)
	at org.apache.cocoon.servletservice.ServletServiceContext$PathDispatcher.forward(ServletServiceContext.java:522)
	at org.apache.cocoon.servletservice.spring.ServletFactoryBean$ServiceInterceptor.invoke(ServletFactoryBean.java:237)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy0.service(Unknown Source)
	at org.apache.cocoon.servletservice.DispatcherServlet.service(DispatcherServlet.java:109)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:459)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1054)
	at com.mindquarry.user.webapp.AuthenticationFilter.doFilter(AuthenticationFilter.java:253)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1045)
	at com.mindquarry.webapp.servlet.HttpHeaderSpoofingFilter.doFilter(HttpHeaderSpoofingFilter.java:57)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1045)
	at com.mindquarry.webapp.servlet.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:113)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1045)
	at org.apache.cocoon.servlet.multipart.MultipartFilter.doFilter(MultipartFilter.java:140)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1045)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:358)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:231)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:629)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:453)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:123)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
	at org.mortbay.jetty.Server.handle(Server.java:303)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:452)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:721)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:509)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:349)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:320)
	at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)
Caused by: org.apache.excalibur.xml.xslt.XSLTProcessorException: Exception when creating Transformer from servlet:foobar:/xslt/html2html.xsl
	at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:300)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.cocoon.core.container.spring.avalon.PoolableProxyHandler.invoke(PoolableProxyHandler.java:61)
	at $Proxy16.getTransformerHandlerAndValidity(Unknown Source)
	at org.apache.cocoon.transformation.TraxTransformer.setup(TraxTransformer.java:305)
	... 81 more
Caused by: javax.xml.transform.TransformerException: Bei folgender Formatvorlagendatei ist eine E/A-Ausnahmebedingung aufgetreten: contextpath.xsl.
	at org.apache.xalan.processor.StylesheetHandler.error(StylesheetHandler.java:904)
	at org.apache.xalan.processor.StylesheetHandler.error(StylesheetHandler.java:947)
	at org.apache.xalan.processor.ProcessorInclude.parse(ProcessorInclude.java:294)
	at org.apache.xalan.processor.ProcessorInclude.startElement(ProcessorInclude.java:150)
	at org.apache.xalan.processor.StylesheetHandler.startElement(StylesheetHandler.java:623)
	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
	at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at org.apache.cocoon.core.xml.impl.JaxpSAXParser.parse(JaxpSAXParser.java:196)
	at org.apache.cocoon.core.xml.impl.JaxpSAXParser.parse(JaxpSAXParser.java:204)
	at org.apache.cocoon.core.xml.avalon.DefaultSAXParser.parse(DefaultSAXParser.java:54)
	at org.apache.cocoon.components.xslt.TraxProcessor.sourceToSAX(TraxProcessor.java:309)
	at org.apache.cocoon.components.xslt.TraxProcessor.getTransformerHandlerAndValidity(TraxProcessor.java:241)
	... 88 more
Caused by: java.net.MalformedURLException: unknown protocol: servlet
	at java.net.URL.(URL.java:574)
	at java.net.URL.(URL.java:464)
	at java.net.URL.(URL.java:413)
	at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
	at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at org.apache.xalan.processor.ProcessorInclude.parse(ProcessorInclude.java:284)
	... 105 more

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grzegorz Kossakowski reassigned COCOON-2044:
--------------------------------------------

    Assignee: Grzegorz Kossakowski

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Jörg Heinicke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489910 ] 

Jörg Heinicke commented on COCOON-2044:
---------------------------------------

In 2.1 you had to register the protocol/ source factory on the source resolver [1, around line 550]. That's how it worked with Cocoon protocols. I don't know about trunk though.

[1] http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/webapp/WEB-INF/cocoon.xconf?annotate=499814

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490019 ] 

Alexander Klimetschek commented on COCOON-2044:
-----------------------------------------------

The servlet source works in other places used in XSL sheets, so it is registered. I think the problem is that the ids/mount-paths I tried are not valid, only ids of configured connections work. I say think because I cannot debug the xerces code, because the damn jar does not contain line numbers.... So my theory is:

a) Xerces handles the URL
b) it sees servlet: and passes it to cocoon's sourceresolver (don't know where this is done)
c) the servlet source cannot resolve servlet:12345:/bla or servlet:/my/mountpath:/something and throws an exception or returns a null value
d) the URL handler sees this problem, but only gives a MalformedURLException (unknown protocol: servlet)

If this is the case, we need a globally unique servlet:servlet-bean-id:/foo/bar URL that can be resolved by the ServletSourceFactory. Currently it can only handle connections defined in the servlet bean xml. IMHO these are shortcuts (using servlet:myblock: is much shorter than serlvet:com.mycompany.mypackage.foobar-servlet). But they also work as a contract for the block or servlet, showing which other blocks are needed at runtime, although this is not used by any tool, its only an information for the developer looking at the xml file.

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489753 ] 

Grzegorz Kossakowski commented on COCOON-2044:
----------------------------------------------

I'm not so sure how XSLT processor handles URIs inside stylesheets. While I was testing caching of ServletSource I remember that I've encountered XSLT processor's weirdnesses but did not dig into this any further. Could you find out (I mean: check the code) what are the current limitations of XSLT URI handling? This knowledge would be very useful not only while dealing with this very issue.

I ask for it, because I really don't like adding any additional parameter. Even more I don't like identityHashCode() hack ;)
What's more, I think you address the issue wrong way because your proposed change makes URI unique but only by including information about the entity asking for the resource what breaks another contract.
This way, if servlet A and B ask servlet C for *exactly* the same resource X we would end up with two different cache entries:
X?servlet-services-id=identityHashCode(A)
X?servlet-services-id=identityHashCode(A)
instead of one:
X?servlet-services-id=identityHashCode(C)

In ServletSource constructor there is ServletConnection available that in turn has the access for all needed properties. Even more, there is FIXME mark already related to this:
        // FIXME: This will not be a system global id, as the blockName is block local.
        String ssp = (new URI(this.blockName, null, path, queryString, null)).toString();

What do you think, now? Are you willing to provide a patch for this?

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490105 ] 

Alexander Klimetschek commented on COCOON-2044:
-----------------------------------------------

The url returned by getURI() will be used as base path for resolving relative resources (eg. includes in xsl), so it's not a read-only name for the cache but it will impact future resolving of other sources. Thus it is important to have a getURI() string that works anywhere. Fixing it generally is better than the one location (XSLT processor) that happens to be faulty in my special setup.

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Reinhard Poetz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489796 ] 

Reinhard Poetz commented on COCOON-2044:
----------------------------------------

Actually the XSLT transformer supports all our protocols AFAIK, e.g. http://svn.apache.org/repos/asf/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/resources/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490096 ] 

Grzegorz Kossakowski commented on COCOON-2044:
----------------------------------------------

Alexander,

I'm glad to see that you still investigate this issue but I fear that you try to fix in wrong way and I guess it's my fault. In my humble opinion, we don't need to perform so significant changes in servlet-service that you propose.
Servlets can still be resovled by their shorthand names, only getURI() method need to be changed so it returns "absolute" URIs instead of "relative" (containing shorthand names). This way, everything should work correctly because only value returned by getURI() method must be unique.

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492629 ] 

Grzegorz Kossakowski commented on COCOON-2044:
----------------------------------------------

Alexander, are you going to provide a patch for this issue?

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grzegorz Kossakowski updated COCOON-2044:
-----------------------------------------

    Urgency: Blocker  (was: Normal)

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grzegorz Kossakowski reassigned COCOON-2044:
--------------------------------------------

    Assignee:     (was: Grzegorz Kossakowski)

I don't plan to work on this issue in foreseeable future so I leave it unassigned.

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2
>            Reporter: Alexander Klimetschek
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494007 ] 

Alexander Klimetschek commented on COCOON-2044:
-----------------------------------------------

Sorry, I am currently very busy with a release. I have code doing this, but I think it is not perfect and I need some time to create a separate patch (I have a few modifications across the core modules ;-). Probably the best to have test cases for you as well to test that patch. Mostly you need multiple servlets / sitemaps in the webapp, which use the same URLs internally. Then use caching pipelines and check the uniqueness of the cache with the StatusGenerator's display of the cache. A simple test would be a few pages index.html that have a solid color background image image/background.png which has a different color in each block - if the caching key is not globally unique, the same image will be used on all pages. I hope to be able to upload a patch today or tomorrow.

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490093 ] 

Alexander Klimetschek commented on COCOON-2044:
-----------------------------------------------

The problem with unique servlet uris is much more difficult, because the special super connection depends very much on the calling servlet. This would not be encoded when servlet:super:/foo would be replaced by servlet:com.mycomany.myservlet:/foo since the servlet connection then thinks of the connection as a normal one. A solution might be to scan through the connections and look if the servlet com.mycomany.myservlet is registered under the short name "super".

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COCOON-2044) servlet: protocol URIs are have to be globally unique for use as cache-keys

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Klimetschek updated COCOON-2044:
------------------------------------------

       Priority: Critical  (was: Major)
    Description: 
All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.

There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:

a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.

b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345

Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.


<old_issue_description>
The call to servlet:/something fails on the first attempt, the effect is an empty output stream. After a reload it mostly works, but I cannot yet give exact behaviour as I am still debugging the problem.

It seems to be related to the caching (because it works on the second attemp), but it also happens in a NonCachingProcessingPipeline.
</old_issue_description>

  was:
The call to servlet:/something fails on the first attempt, the effect is an empty output stream. After a reload it mostly works, but I cannot yet give exact behaviour as I am still debugging the problem.

It seems to be related to the caching (because it works on the second attemp), but it also happens in a NonCachingProcessingPipeline.

        Urgency: Normal
        Summary: servlet: protocol URIs are have to be globally unique for use as cache-keys  (was: Servlet services calls to servlet: sometimes fail (on initial call))

Found out the real problem, thus I changed the summary and the description of this issue: the *local* servlet: calls (without a servlet name in the URI, acting like cocoon:) fail in certain situations when there are two identical URIs in two blocks (eg. servlet:/xslt/html2html.xsl) but the resource will be cached globally under the same name.

> servlet: protocol URIs are have to be globally unique for use as cache-keys
> ---------------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.
> <old_issue_description>
> The call to servlet:/something fails on the first attempt, the effect is an empty output stream. After a reload it mostly works, but I cannot yet give exact behaviour as I am still debugging the problem.
> It seems to be related to the caching (because it works on the second attemp), but it also happens in a NonCachingProcessingPipeline.
> </old_issue_description>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489780 ] 

Alexander Klimetschek commented on COCOON-2044:
-----------------------------------------------

Those URIs are produced by the current implementation as ServletSource.getURI() and these work with the XSLT processor:

    servlet:super:/xslt/error/error2html.xsl   =>   super:super:/xslt/error/error2html.xsl?null

    servlet:/xslt/html2html.xsl   =>   null:/xslt/html2html.xsl?null

The "servlet" protocol is unknown by the XSLT processor (he gives such an error message) and I don't think one can change that since he is not part of cocoon. I don't know why he accepts super:super: and null:.

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489724 ] 

Grzegorz Kossakowski commented on COCOON-2044:
----------------------------------------------

The problem is caused by org.apache.cocoon.servletservice.components.ServletSource (extending org.apache.excalibur.source.impl.AbstractSource). It just breaks contracts so other elements (like caching) that rely on the contract fail. Let's look at AbstractSource#getURI():
    /**
     * Return the unique identifer for this source
     */
    public String getURI()
    {
        return m_systemId;
    }

Unique word is essential here but ServletSource have *relative* to servlet's context system Id now. The situation is exactly the same as File source would return relative paths instead of absolute ones.

So how to absolutize servlet protocol's URIs? We should just replace connection name (which may be empty) with servlet's bean id that the URI is actually resolved to. So if servlet org.apache.cocoon.foo has servlet org.apache.cocoon.bar as super these URIs should be made absolute that way:
servlet:/some/file/path -> servlet:servlet org.apache.cocoon.foo:/some/file/path
servlet:super:/other/path -> servlet:servlet org.apache.cocoon.bar:/other/path

This way ServletSource will fulfill the contract. What do you think?

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490040 ] 

Grzegorz Kossakowski commented on COCOON-2044:
----------------------------------------------

It's even more weird. I remember that I've seen code of Cocoon's source resolver that is used by XSLT processor. There was some kind of weird(?) fall-back mechanism that seemed to work that way:
1. Standard Cocoon/Excalibur source resolver is tried to resolve the source, if it is successful source is returned
2. If it fails with Cocoon/Excalibur source resolver, it passes the URI to the standard Java URI handling.
3. Of course, Java does not know "servlet:" so throws the exception you mentioned.

If I'm not wrong, the issue is on Excalibur/Cocoon side not XSLT processor and we should fix it. If you want to find the class that is used to resolve URIs in XSLs files just put servlet: URI into xsl file and put a breakpoint in ServletSourceFactory. Then you should be able to check call stack to figure out the class that tries to use servlet: source. It would be great if you could check the actual behavior of that class.

> If this is the case, we need a globally unique servlet:servlet-bean-id:/foo/bar URL that can be resolved by the ServletSourceFactory. Currently it can only handle
> connections defined in the servlet bean xml. IMHO these are shortcuts (using servlet:myblock: is much shorter than 
> serlvet:com.mycompany.mypackage.foobar-servlet). But they also work as a contract for the block or servlet, showing which other blocks are needed at runtime, 
> although this is not used by any tool, its only an information for the developer looking at the xml file.

You are right, that they are just shortcuts. However, I do not understand what you mean at the end.

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490054 ] 

Alexander Klimetschek commented on COCOON-2044:
-----------------------------------------------

I am currently trying to extend the ServletServiceContext.getNamedContext() to handle bean ids of servlets in addition to the connection names. But I will look at the other problem as well.

Regarding my last sentence: I was talking about component contracts, ie. formal definitions of what dependencies a component has. In the case of blocks with servlets its about all the other servlets that are needed, thus the list of connections. It is good from a developers point of view to open a yet unknown block, look at the META-INF/cocoon/spring/servlet*.xml files and see all the defined servlets and their dependencies on others. For a better tooling it would even better if those dependencies can be read automatically - which is the case now, since the xml files have a fixed schema. The only thing missing is such a tooling ;-) I imagine a cocoon web application manager where you have a list of block jars available on the internet and which can be automatically downloaded and included in your webapp. You only need the webservice for the download and a simple application that parses the servlet xml files, knows your web application directory and then changes the dependencies in the Maven pom files to include the new jar. Well, just an idea ... ;-)

> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-2044) servlet: protocol URIs have to be globally unique for use as cache-keys

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489733 ] 

Alexander Klimetschek commented on COCOON-2044:
-----------------------------------------------

Unfortunately, using servlet:servlet org.apache.cocoon.foo:/some/file/path does not work. The problem is that the XSLT processor uses the source.getURI() String and tries to parse it himself. Thus, only a certain subset of URIs can be used here (things known to him). I tried using servlet:12345:/some/file/path and it failed.

The thing that works are my proposed query parameters: servlet:/some/file/path?servlet-services-id=12345. I am using a number-based ID because I use System.identityHashCode() on the current servlet context since this is the only identifier that works.

        String id = String.valueOf(System.identityHashCode(CallFrameHelper.getContext()));

It is not possible to get the mount path or bean id of the servlet, because it is not yet accessible in the ServletSource constructor (where the system id is set). Important to know here is that in the case of the "outer" sitemap that handles the browser request, the ServletContext is not a ServletServiceContext (hmmm, when writing this I am not quite sure....). At least the Request/Response objects are the original ones (only wrapped by DynamicProxyRequestHandler); in a servlet internal call they are BlockCallHttpServletRequest/Response.



> servlet: protocol URIs have to be globally unique for use as cache-keys
> -----------------------------------------------------------------------
>
>                 Key: COCOON-2044
>                 URL: https://issues.apache.org/jira/browse/COCOON-2044
>             Project: Cocoon
>          Issue Type: Bug
>          Components: - Servlet service framework
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Alexander Klimetschek
>         Assigned To: Grzegorz Kossakowski
>            Priority: Critical
>
> All servlet protocol URIs like servlet:/some/thing or servlet:super:/foo/bar or servlet:myblock:/another/path have to be globally unique because they are used in the cache, of which there is only one global with globally acting keys.
> There are two caches in standard Cocoon configuration (the only ones I know of ;-), both with a different key generation. Here are ideas how to make the keys global:
> a) EHDefaultStore for caching resources of caching pipelines: they use the uriPrefix of the Enviroment in the key, so providing a uriPrefix (eg. the mount path of the servlet) works here.
> b) DefaultTransientStore which caches XSLT and JX generator sources (don't know why this is different from a)): they do not use the uriPrefix and much worse, they need correct URIs because they are read by the XSLT processor, who does not like things like servlet:uniqueID34:/xsl/stylesheet.xsl containing arbitrary schemes at the beginning. Appending an ID via a query parameter seems the only working solution (tried it already): servlet:/xsl/stylesheet.xsl?servlet-services-id=12345
> Another solution would be to have one cache per sitemap, so that the keys don't have to be unique anymore. But I don't know how to configure that and if this is feasible.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.