You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ne...@apache.org on 2007/11/13 20:36:51 UTC
svn commit: r594615 - in /lenya/trunk/src:
java/org/apache/lenya/cms/cocoon/components/modules/input/
modules-core/linking/config/sitemap/ modules/bxe/
webapp/lenya/xslt/resources/
Author: nettings
Date: Tue Nov 13 11:36:51 2007
New Revision: 594615
URL: http://svn.apache.org/viewvc?rev=594615&view=rev
Log:
make bxe work in proxied environments.
the primary problem was that bxe needs an rng file on the client, and we
did not correctly resolve <rng:include href=".."> urls.
there are two ugly hacks in the existing code that should
eventually be removed altogether. the current patch just adds
workarounds, since we're in code freeze.
the hacks are:
* webapp/lenya/xslt/resources/translate-rng-includes.xsl implements a
fallback uri resolver for client requests and gets it wrong. the error
has been fixed and a proxy transformation added, but we should not duplicate knowledge about fallback
resolving in an xslt!
* java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
adds a context prefix to the schema uri and also tries to resolve
fallback itself, again not really watertight. the context prefix has
been removed, and we now apply a proxy transformer afterwards.
to make this work, the proxy transformer configuration was extended to catch
rng:include elements.
TODO: bxe.close still redirects to a wrong URL (context prefix instead
of proxy)
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
lenya/trunk/src/modules-core/linking/config/sitemap/transformers.xmap
lenya/trunk/src/modules/bxe/sitemap.xmap
lenya/trunk/src/webapp/lenya/xslt/resources/translate-rng-includes.xsl
Modified: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/components/modules/input/ResourceTypeModule.java?rev=594615&r1=594614&r2=594615&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 Tue Nov 13 11:36:51 2007
@@ -59,7 +59,7 @@
* {@link org.apache.lenya.cms.publication.ResourceType#getExpires()}</li>
* <li><strong><code>schemaUri</code></strong> - see
* {@link org.apache.lenya.xml.Schema#getURI()}</li>
- * <li><strong><code>httpSchemaUri</code></strong> - the URI to request the schema over HTTP</li>
+ * <li><strong><code>httpSchemaUri</code></strong> - the URI to request the schema over HTTP, without Proxy and context (use {proxy:} around it).</li>
* <li><strong><code>supportsFormat:{format}</code></strong> - true if the resource type
* supports this format, false otherwise</li>
* </ul>
@@ -115,8 +115,7 @@
value = resourceType.getSchema().getURI();
} else if (attribute.equals(HTTP_SCHEMA_URI)) {
String uri = resourceType.getSchema().getURI();
- String prefix = request.getContextPath();
- value = transformFallbackUriToHttp(pub.getId(), prefix, uri);
+ value = transformFallbackUriToHttp(pub.getId(), uri);
} else if (attribute.equals(EXPIRES)) {
Date expires = resourceType.getExpires();
SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy kk:mm:ss zzz");
@@ -152,13 +151,13 @@
* @return A string.
* @throws ConfigurationException
*/
- protected String transformFallbackUriToHttp(String pubid, String prefix, String uri)
+ protected String transformFallbackUriToHttp(String pubid, String uri)
throws ConfigurationException {
if (uri.startsWith("fallback://lenya/modules/")) {
String path = StringUtils.substringAfter(uri, "fallback://lenya/modules/");
String module = StringUtils.substringBefore(path, "/");
path = StringUtils.substringAfter(path, module + "/resources");
- return prefix + "/" + pubid + "/modules/" + module + path;
+ return "/" + pubid + "/modules/" + module + path;
} else {
throw new ConfigurationException("Don't know how to create HTTP URL from : " + uri);
}
Modified: lenya/trunk/src/modules-core/linking/config/sitemap/transformers.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/linking/config/sitemap/transformers.xmap?rev=594615&r1=594614&r2=594615&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/linking/config/sitemap/transformers.xmap (original)
+++ lenya/trunk/src/modules-core/linking/config/sitemap/transformers.xmap Tue Nov 13 11:36:51 2007
@@ -47,7 +47,9 @@
<transform namespace="http://www.w3.org/1999/xhtml" element="img" attribute="src"/>
<transform namespace="http://www.w3.org/1999/xhtml" element="link" attribute="href"/>
<transform namespace="http://www.w3.org/1999/xhtml" element="form" attribute="action"/>
- <transform namespace="http://www.w3.org/1999/xhtml" element="script" attribute="src"/>
+ <transform namespace="http://www.w3.org/1999/xhtml" element="script" attribute="src"/>
+<!-- temporary fix for bxe. should be reconsidered -->
+ <transform namespace="http://relaxng.org/ns/structure/1.0" element="include" attribute="href"/>
</map:transformer>
<map:transformer name="incoming-proxy" logger="lenya.sitemap.transformer.incoming-proxy"
Modified: lenya/trunk/src/modules/bxe/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/bxe/sitemap.xmap?rev=594615&r1=594614&r2=594615&view=diff
==============================================================================
--- lenya/trunk/src/modules/bxe/sitemap.xmap (original)
+++ lenya/trunk/src/modules/bxe/sitemap.xmap Tue Nov 13 11:36:51 2007
@@ -74,7 +74,12 @@
<map:call resource="style-cms-page"/>
<map:serialize />
</map:act>
- <map:redirect-to uri="{request:requestURI}"/>
+ <!-- proxy must be applied here! normally the request should already contain
+ a correct proxy url, but this particular request is generated by the bxe usecase
+ and it is apparently unaware of proxy settings. should eventually be fixed at the root cause.
+ FIXME: review this!
+ -->
+ <map:redirect-to uri="{proxy:{request:requestURI}}"/>
</map:match>
<map:match pattern="*/*/**.html">
@@ -105,7 +110,7 @@
<map:parameter name="BX_xslfile" value="{2}.xsl"/>
-->
<map:parameter name="BX_xhtmlfile" value="{proxy:/{../1}/{../2}/{../3}.bxe.html}?rendertype=edit"/>
- <map:parameter name="BX_validationfile" value="{resource-type:httpSchemaUri}"/>
+ <map:parameter name="BX_validationfile" value="{proxy:{resource-type:httpSchemaUri}}"/>
<map:parameter name="css" value="{proxy:/lenya/css/default.css}"/>
<!-- The document is checked in when we exit from bx (in case of save&exit and in case of exit), so we use the usecase
for the checkin while we redirect to the document
Modified: lenya/trunk/src/webapp/lenya/xslt/resources/translate-rng-includes.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/lenya/xslt/resources/translate-rng-includes.xsl?rev=594615&r1=594614&r2=594615&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/xslt/resources/translate-rng-includes.xsl (original)
+++ lenya/trunk/src/webapp/lenya/xslt/resources/translate-rng-includes.xsl Tue Nov 13 11:36:51 2007
@@ -16,17 +16,22 @@
limitations under the License.
-->
+
+<!-- FIXME: this file should be killed the sooner the better.
+ There is really no excuse to re-invent a fallback source resolver with substring guessing.
+-->
+
+
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:param name="publicationid" />
- <xsl:param name="contextprefix"/>
<xsl:template match="@href[starts-with(.,'fallback://lenya/resources/')]" priority="10">
<xsl:attribute name="href">
<xsl:variable name="resource" select="substring-after(., 'fallback://lenya/resources/')"/>
- <xsl:value-of select="concat($contextprefix, '/lenya/', $resource )"/>
+ <xsl:value-of select="concat('/lenya/', $resource )"/>
</xsl:attribute>
</xsl:template>
@@ -35,7 +40,7 @@
<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($contextprefix, '/' , $publicationid, '/modules/' , $restype, '/', $resource)"/>
+ <xsl:value-of select="concat('/' , $publicationid, '/modules/' , $restype, '/', $resource)"/>
</xsl:attribute>
</xsl:template>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org
Re: Proxy transformer and namespaces
Posted by Jörn Nettingsmeier <ne...@apache.org>.
Andreas Hartmann wrote:
> Hi Jörn,
>
>
> I declared a dedicated transformer for this (revision 595270).
yeah, as i said, that's much cleaner than my patch.
> IMO we shouldn't use one proxy transformer for all namespaces. I guess
> we should even rename the "proxy" transformer to "proxy-xhtml". WDYT?
i'd say no renames before 2.0. after that, +1.
*BUT*: we should be very careful about adding more proxy-dependent links
to other types of documents - each one is a bug waiting to happen and an
extra transform.
i think this stuff should be handled by special pipelines *in the
module*, not the generic module-resources ones. "resources" as we used
it implied "static resources" which implied <map:read/>. it needs to be
obvious that we are serving dynamic stuff with setup-dependant
transforms in them.
if the xhtml module thinks it has to be clever wrt rng includes, let it
handle the mess itself. making global provisions for this means
encouraging the use of includes, which is a double-edged sword,
especially since there are certainly rng engines out there that do not
resolve them. i'd say let's handle resolve the includes on the server
and pass just one monolithic rng to the client. it's bound to be faster
as well, less http overhead, and is very cacheable.
--
Jörn Nettingsmeier
"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org
Proxy transformer and namespaces (was: svn commit: r594615 - in /lenya/trunk/src:
java/org/apache/lenya/cms/cocoon/components/modules/input/ modules-core/linking/config/sitemap/
modules/bxe/ webapp/lenya/xslt/resources/)
Posted by Andreas Hartmann <an...@apache.org>.
Hi Jörn,
[...]
> Modified: lenya/trunk/src/modules-core/linking/config/sitemap/transformers.xmap
> URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/linking/config/sitemap/transformers.xmap?rev=594615&r1=594614&r2=594615&view=diff
> ==============================================================================
> --- lenya/trunk/src/modules-core/linking/config/sitemap/transformers.xmap (original)
> +++ lenya/trunk/src/modules-core/linking/config/sitemap/transformers.xmap Tue Nov 13 11:36:51 2007
> @@ -47,7 +47,9 @@
> <transform namespace="http://www.w3.org/1999/xhtml" element="img" attribute="src"/>
> <transform namespace="http://www.w3.org/1999/xhtml" element="link" attribute="href"/>
> <transform namespace="http://www.w3.org/1999/xhtml" element="form" attribute="action"/>
> - <transform namespace="http://www.w3.org/1999/xhtml" element="script" attribute="src"/>
> + <transform namespace="http://www.w3.org/1999/xhtml" element="script" attribute="src"/>
> +<!-- temporary fix for bxe. should be reconsidered -->
> + <transform namespace="http://relaxng.org/ns/structure/1.0" element="include" attribute="href"/>
> </map:transformer>
I declared a dedicated transformer for this (revision 595270).
IMO we shouldn't use one proxy transformer for all namespaces. I guess
we should even rename the "proxy" transformer to "proxy-xhtml". WDYT?
-- Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org