On Mon, 2005-11-14 at 08:59 -0500, [EMAIL PROTECTED] wrote:
> On 11/14/05, Josias Thoeny <[EMAIL PROTECTED]> wrote:
> > Hi Solprovider,
> >
> > Normally {page-envelope:context-prefix} or {request:contextPath} should
> > give the correct prefix, or not?
> > I think the problem is that the prefix is stored in the links in the
> > content, so you cannot copy the content between systems with different
> > url prefixes.
> > Or maybe I'm not understanding your problem.
> 
> My "Variables" page was created by testing Lenya 1.2.2 on Jetty on
> MSWindows and Linux.  I do not remember if any testing used Tomcat. 
> The URL is:
> http://solprovider.com/lenya/variables
> You can test using the two files linked under "Standard Variables".  It lists:
> {page-envelope:context-prefix} = "\" + pubid + "\" + area [ + "\pathToDoc" ]
> {request:contextPath} - BROKEN. Always empty string.

If you run Lenya with Jetty, the context-prefix should empty, because
Lenya runs in the root context. 
I made a test on Tomcat with your variables usecase (btw it's cool!) and
both {page-envelope:context-prefix} and {request:contextPath} show
"/lenya", which is the expected value in this case.

> 
> Damjan's post suggests changing JavaScript to not use
> request.getContextPath() because the function often returns null.  It
> seems request:contextPath is just broken.

Hmm, I'm using request:contextPath all the time and it works for me. (I
don't use war files, though)

> 
> ---
> Apache rewrites URLs, but I never got mod_proxy_html working, so Lenya
> must produce the proper URLs on the page.  (Why isn't that standard
> functionality in Apache httpd?  I wrote my own webserver in the 90s
> that had that functionality in the first version.)
> 
> The problem is there is no place to store a prefix that is not used by
> Lenya.  The only place anything close exists is publication.xconf's
> <proxy area="live">, but that is not usable in XMAPs or XSLs.

You might want to try the ProxyUrlModule, to access the url from
publication.xconf in the xmap. I never used it, but I think it's doing
what you need.

> 
> Is there a place where a developer can define global constants to be
> accessed in many XMAPs?  

I think you are looking for the GlobalInputModule 
http://cocoon.apache.org/2.1/userdocs/concepts/modules-ref.html#GlobalInputModule

- Josias

> (It is easy to pass constants from an XMAP to
> the XSLs.)  If not, how can we create one?  I would like to use
> {global:my-url-prefix}, {global:my-img-prefix}, and
> {global:my-css-prefix}.  I do not mind updating all the XMAPs and XSLs
> if maintenance could be improved by having a single place for the
> prefixes that change when the webserver and rewrite rules change.
> 
> I just realized I could create the constants ("xsl:variable") in an
> XSL that is imported into all the other XSLs.  That would work for all
> custom XSLs, but would not be good for standard XSLs that want to be
> passed the "contextprefix" from an XMAP.
> 
> solprovider
> 
> ---------------------------------------------------------------------
> 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