On Mon, 2006-02-13 at 13:17 -0500, Doug Chestnut wrote:

[...]

>  
> Requests for resources already use fallback:// (or should).
> Examples:
> fallback//lenya/resources/schemas/lenya.rng
> ->
> /context-prefix/pubid/lenya/schemas/lenya.rng
> 
> *since fallback should be enabled for all resource requests, it isn't 
> needed in the url
> *since we only want to allow access to resources, it can be dropped as well
> *core resources like /context-prefix/lenya/css/menu.css should be ->
> /context-prefix/pubid/lenya/css/menu.css so publications can define 
> their own look and feel
> *don't think this works now, but should?
> 
> fallback://lenya/modules/xhtml/resources/schemas/xhtml/xhtml-basic.rng
> ->
> /context-prefix/pubid/modules/xhtml/schemas/xhtml-basic.rng
> *access to module resources is the function of module-resources.xmap
> *fallback is (or should be) supported in sitemap
> 
> fallback://resources/shared/javascript/foo.js
> ->
> /context-prefix/pubid/area/javascript/foo.js
> *access to pub shared resources is the function of resources-shared.xmap
> *fallback is (or should be) supported in sitemap
> 
> I just don't think that we need to specify "fallback" for requests for 
> resources.  I can't think of an instance when fallback wouldn't be desired.
> 
> WDYT?

Yes, I agree now.
I didn't quite realize that we only have to serve resources, therefore
we don't have to translate arbitrary fallback uris.
I makes sense now, thanks for the clarification.

Josias


> 
> --Doug
> 
> > 
> > Or would the following solution be better: 
> > If a requested RNG (or XSL) file contains an include using the
> > fallback:// protocol, resolve the URI and replace it by the actual URL
> > before sending the file to the client, instead of letting the client
> > request /fallback uris?
> Perhaps this is what I am saying
> > 
> > Any opinions?
> > 
> > BTW, what is the "/lenya" for in fallback://lenya/something ?
> > Is it really necessary?
> > 
> > Josias
> > 
> > 
> >>WDOT?
> >>
> >>And another thing: The context prefix should be prepended to the url, as
> >>it was done in translate-rng-includes.xsl.
> >>Otherwise it won't work in tomcat, when Lenya is deployed in /lenya.
> >>
> >>Josias
> >>
> >>
> >>>Thanks for keeping watch,
> >>>--Doug
> >>>
> >>>>Josias
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Added:
> >>>>>   lenya/trunk/src/webapp/lenya/xslt/resources/external-relax.xsl   
> >>>>> (with props)
> >>>>>Modified:
> >>>>>   
> >>>>> lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
> >>>>>   lenya/trunk/src/webapp/lenya/module-resources.xmap
> >>>>>
> >>>>>Modified: 
> >>>>>lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
> >>>>>URL: 
> >>>>>http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java?rev=376448&r1=376447&r2=376448&view=diff
> >>>>>==============================================================================
> >>>>>--- 
> >>>>>lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
> >>>>> (original)
> >>>>>+++ 
> >>>>>lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
> >>>>> Thu Feb  9 13:56:04 2006
> >>>>>@@ -27,6 +27,7 @@
> >>>>>import org.apache.cocoon.components.modules.input.AbstractInputModule;
> >>>>>import org.apache.cocoon.environment.ObjectModelHelper;
> >>>>>import org.apache.cocoon.environment.Request;
> >>>>>+import org.apache.lenya.cms.publication.Publication;
> >>>>>import org.apache.lenya.cms.publication.Document;
> >>>>>import org.apache.lenya.cms.publication.DocumentIdentityMap;
> >>>>>import org.apache.lenya.cms.publication.ResourceType;
> >>>>>@@ -57,6 +58,7 @@
> >>>>>            Session session = RepositoryUtil.getSession(request, 
> >>>>> getLogger());
> >>>>>
> >>>>>            ResourceType resourceType;
> >>>>>+            Publication pub = null;
> >>>>>            String attribute;
> >>>>>
> >>>>>            String[] steps = name.split(":");
> >>>>>@@ -68,6 +70,7 @@
> >>>>>                String webappUrl = ServletHelper.getWebappURI(request);
> >>>>>                Document document = docFactory.getFromURL(webappUrl);
> >>>>>                resourceType = document.getResourceType();
> >>>>>+                pub = document.getPublication();
> >>>>>            } else {
> >>>>>                attribute = steps[1];
> >>>>>                String resourceTypeName = steps[0];
> >>>>>@@ -89,8 +92,8 @@
> >>>>>                value = resourceType.getSchema().getURI();
> >>>>>            } else if (attribute.equals(HTTP_SCHEMA_URI)) {
> >>>>>                String uri = resourceType.getSchema().getURI();
> >>>>>-                String path = uri.substring("fallback://".length());
> >>>>>-                value = request.getContextPath() + "/fallback/" + path;
> >>>>>+                String path = uri.substring(uri.indexOf("/schemas"));
> >>>>>+                value = request.getContextPath() + "/" + pub.getId() + 
> >>>>>"/modules/" + resourceType.getName() + path;
> >>>>>            } else {
> >>>>>                throw new ConfigurationException("Attribute [" + name + 
> >>>>> "] not supported!");
> >>>>>            }
> >>>>>
> >>>>>Modified: lenya/trunk/src/webapp/lenya/module-resources.xmap
> >>>>>URL: 
> >>>>>http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/module-resources.xmap?rev=376448&r1=376447&r2=376448&view=diff
> >>>>>==============================================================================
> >>>>>--- lenya/trunk/src/webapp/lenya/module-resources.xmap (original)
> >>>>>+++ lenya/trunk/src/webapp/lenya/module-resources.xmap Thu Feb  9 
> >>>>>13:56:04 2006
> >>>>>@@ -20,6 +20,13 @@
> >>>>><map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
> >>>>>
> >>>>>  <map:pipelines>
> >>>>>+    <map:pipeline internal-only="true">
> >>>>>+      <map:match pattern="*/**.*">
> >>>>>+        <map:match type="regexp" pattern="(.*\.)(rng)$"> 
> >>>>>+          <map:read 
> >>>>>src="fallback://lenya/modules/{../1}/resources/{../2}.{../3}" 
> >>>>>mime-type="application/xml"/>
> >>>>>+        </map:match> 
> >>>>>+      </map:match>
> >>>>>+    </map:pipeline>
> >>>>>    <map:pipeline>
> >>>>>      
> >>>>>      <!-- matches modules/*/**.css -->
> >>>>>@@ -49,9 +56,13 @@
> >>>>>        <map:match type="regexp" pattern="(.*\.)(xml)$"> 
> >>>>>          <map:read 
> >>>>> src="fallback://lenya/modules/{../1}/resources/{../2}.{../3}" 
> >>>>> mime-type="text/xml"/>
> >>>>>        </map:match>        
> >>>>>-        <map:match type="regexp" pattern="(.*\.)(rng)$"> 
> >>>>>-          <map:read 
> >>>>>src="fallback://lenya/modules/{../1}/resources/{../2}.{../3}" 
> >>>>>mime-type="application/xml"/>
> >>>>>-        </map:match> 
> >>>>>+        <map:match type="regexp" pattern="(.*\.)(rng)$">
> >>>>>+          <map:generate 
> >>>>>src="fallback://lenya/modules/{../1}/resources/{../2}.{../3}"/>
> >>>>>+          <map:transform 
> >>>>>src="fallback://lenya/xslt/resources/external-relax.xsl">
> >>>>>+            <map:parameter name="publicationid" 
> >>>>>value="{page-envelope:publication-id}"/>
> >>>>>+          </map:transform>
> >>>>>+          <map:serialize type="xml"/>
> >>>>>+        </map:match>
> >>>>>        <map:match type="regexp" 
> >>>>> pattern="(.*\.)(jpg|JPG|Jpg|jpeg|Jpeg|JPEG)$"> 
> >>>>>          <map:read 
> >>>>> src="fallback://lenya/modules/{../1}/resources/{../2}.{../3}" 
> >>>>> mime-type="image/jpeg" />
> >>>>>        </map:match> 
> >>>>>
> >>>>>Added: lenya/trunk/src/webapp/lenya/xslt/resources/external-relax.xsl
> >>>>>URL: 
> >>>>>http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/xslt/resources/external-relax.xsl?rev=376448&view=auto
> >>>>>==============================================================================
> >>>>>--- lenya/trunk/src/webapp/lenya/xslt/resources/external-relax.xsl 
> >>>>>(added)
> >>>>>+++ lenya/trunk/src/webapp/lenya/xslt/resources/external-relax.xsl Thu 
> >>>>>Feb  9 13:56:04 2006
> >>>>>@@ -0,0 +1,40 @@
> >>>>>+<?xml version="1.0" encoding="UTF-8" ?>
> >>>>>+<!--
> >>>>>+  Copyright 1999-2004 The Apache Software Foundation
> >>>>>+
> >>>>>+  Licensed under the Apache License, Version 2.0 (the "License");
> >>>>>+  you may not use this file except in compliance with the License.
> >>>>>+  You may obtain a copy of the License at
> >>>>>+
> >>>>>+      http://www.apache.org/licenses/LICENSE-2.0
> >>>>>+
> >>>>>+  Unless required by applicable law or agreed to in writing, software
> >>>>>+  distributed under the License is distributed on an "AS IS" BASIS,
> >>>>>+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
> >>>>>implied.
> >>>>>+  See the License for the specific language governing permissions and
> >>>>>+  limitations under the License.
> >>>>>+-->
> >>>>>+
> >>>>>+<xsl:stylesheet version="1.0"
> >>>>>+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> >>>>>+    >
> >>>>>+
> >>>>>+  <xsl:param name="publicationid" />
> >>>>>+  
> >>>>>+
> >>>>>+  <xsl:template match="@href[starts-with(.,'fallback')]">
> >>>>>+    <xsl:variable name="nofallback" 
> >>>>>select="substring-after(.,'fallback://lenya/modules/')"/>
> >>>>>+    <xsl:variable name="restype" 
> >>>>>select="substring-before($nofallback,'/resources')"/>
> >>>>>+    <xsl:variable name="resource" 
> >>>>>select="substring-after($nofallback,'resources/')"/>
> >>>>>+    <xsl:attribute name="href">
> >>>>>+      <xsl:value-of select="concat('/' , $publicationid, '/modules/' , 
> >>>>>$restype, '/', $resource)"/>
> >>>>>+    </xsl:attribute>
> >>>>>+  </xsl:template>
> >>>>>+  
> >>>>>+  <xsl:template match="@*|node()">
> >>>>>+    <xsl:copy>
> >>>>>+      <xsl:apply-templates select="@*|node()"/>
> >>>>>+    </xsl:copy>
> >>>>>+  </xsl:template>
> >>>>>+  
> >>>>>+</xsl:stylesheet> 
> >>>>>
> >>>>>Propchange: 
> >>>>>lenya/trunk/src/webapp/lenya/xslt/resources/external-relax.xsl
> >>>>>------------------------------------------------------------------------------
> >>>>>   svn:eol-style = native
> >>>>>
> >>>>>
> >>>>>
> >>>>>---------------------------------------------------------------------
> >>>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>>For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>For additional commands, e-mail: [EMAIL PROTECTED]
> >>>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to