You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Michel Erard <co...@besonet.ch> on 2007/10/18 16:52:49 UTC

http-proxy and forms/ajax

Hello, 

I've a problem, when I use a http-proxy in front of my cocoon-application, the browser cannot get the javascript files from forms and ajax block.

In my pipeline I've defined like this:

  <map:transform type="forms" />
  <map:transform src="stylesheets/forms-style.xsl">
    <map:parameter name="dojo-resources" value="{servlet:ajax:/resource/external/dojo}" />
    <map:parameter name="forms-resources" value="{servlet:forms:/resource/external/forms}" />
  </map:transform>
  <map:transform type="servletLinkRewriter"/> 

if use the application direct width jetty (localhost:8888/myApp), it is running well.

When I use a proxy, for testing issues, defined in apache httpd, becaus so I can test different cases:

<Location /myApp/mandantA>
   RequestHeader add MANDANT mandantA
   ProxyPass        http://localhost:8888/myApp
   ProxyPassReverse http://localhost:8888/myApp
   ProxyPassReverseCookiePath / /
   Allow from all
</Location>

<Location /myApp/mandantB>
   RequestHeader add MANDANT mandantB
   ProxyPass        http://localhost:8888/myApp
   ProxyPassReverse http://localhost:8888/myApp
   ProxyPassReverseCookiePath / /
   Allow from all
</Location>

I've problems with forms and ajax, becaus the links in the html code aren't correct. They are defined as:

cocoon.formsResourcesUri = "/myApp/cocoon-forms-impl/resource/external/forms";

And the resources aren't found with the proxy. I thing they should be:

cocoon-forms-impl/resource/external/forms or http://localhost/myApp/mandantA/cocoon-forms-impl/resource/external/forms

Do I have to configure this or did I make a fault?

Thanks, 

Mike

 


____________________________________________
QuickLine WebMail - http://www.QuickLine.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: http-proxy and forms/ajax

Posted by Hugh Sparks <hu...@csparks.com>.
> I've a problem, when I use a http-proxy in front of my cocoon-application,
> the browser cannot get the javascript files from forms and ajax block.

I have a very similar setup working with both jetty (locally) and with
apache proxy and Tomcat on the internet. I had no problems associated
with resource locations and I did not explicity change the configuration.

If you like, I can send you the whole webapp. It is very small.
I created it as an etude to investigate similar issues.

Here are the highlights:

My webapp is called "contacts." Tomcat is listening on 8081.
I don't know if this matters, but I deployed the webapp using the
war file. I let tomcat unpack and deploy automatically.

Apache:

        ProxyPass             /contacts http://localhost:8081/contacts
        ProxyPassReverse /contacts http://localhost:8081/contacts

Tomcat:

        <Connector
                className="org.apache.catalina.connector.http.HttpConnector"
                port="8081"
                proxyName="www.csparks.com"
                proxyPort="80"/>

Sitemap:

        Pretty much right out of the book:

        <map:match pattern="*-display-pipeline">
                <map:generate type="jx" src="{1}_template.xml" 
label="content1"/>
                <map:transform type="browser-update"/>
                <map:transform type="i18n"/>
                <map:transform src="form_styling.xsl">
                        <map:parameter name="dojo-resources" 
value="{servlet:ajax:/resource/external/dojo}"/>
                        <map:parameter name="forms-resources" 
value="{servlet:forms:/resource/external/forms}"/>
                        <map:parameter name="dojo-locale" 
value="{flow-attr:locale}"/>
                </map:transform>

                <map:transform type="i18n"/>
                <map:transform type="servletLinkRewriter"/>
                <map:select type="ajax-request">
                     ...
        </map:match>

form_styling.xsl:

        I made a local copy, but this comes from the examples:

        <xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

                <xsl:include 
href="servlet:forms:/resource/internal/xsl/forms-page-styling.xsl"/>
                <xsl:include 
href="servlet:forms:/resource/internal/xsl/forms-advanced-field-styling.xsl"/>

                <xsl:param name="dojo-resources"/>
                <xsl:param name="forms-resources"/>

                <xsl:template match="head">
                        <head>
                                <xsl:apply-templates select="." 
mode="forms-page"/>
                                <xsl:apply-templates select="." 
mode="forms-field"/>
                                <xsl:apply-templates/>
                        </head>
                </xsl:template>

                <xsl:template match="body">
                        <body>
                                <xsl:apply-templates select="." 
mode="forms-page"/>
                                <xsl:apply-templates select="." 
mode="forms-field"/>
                                <xsl:apply-templates/>
                        </body>
                </xsl:template>

        </xsl:stylesheet>

In the flowscript files:

        cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js") 
;
            ...

****************************************************

-Hugh Sparks



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org