cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jason_co...@hti.htch.com
Subject Passing request parameters in CachingURICoplet (non-internal uri)
Date Sun, 27 Feb 2005 03:58:52 GMT
I'm trying to get a Cocoon 2.0 site to work inside a coplet.  We have a 
bunch of such sites, and are looking into using the new portal block as a 
replacement for the intranet we built with Cocoon 2.0 awhile back (kind of 
an intermediate step to an enterprise portal, if anyone ever decides to 
buy one).

I have the site working within its own web application (/reports), with 
cocoon 2.1.7 running as another web application on the same server.  I've 
configured a CachingURICoplet to pull content from the old site, and it 
generally works pretty well.

My problem is that there are forms within that site that use the 
FormValidatorAction and logicsheet for validation, and the 
FormValidatorAction needs access to the request parameters in order to do 
the validating. That information doesn't seem to be able to be passed as 
part of the CachingURICoplet processing; only the copletId is.  So while 
the form is initially displayed properly, it can never get validated and 
the processing is never done.

I tried using the portal-object-model action from within the site pipeline 
to load portlet info in hopes that I could get access to the form data, 
but it never worked.  Thinking about it, I figure that it probably can't 
work since it's not even in the same webapp, so it wouldn't know what to 
do with the copletId anyway.  It is should be completely ignorant of the 
portal structure.  But the portal knows something about the site (at least 
it's aware of the uri to be wrapped in the coplet, so I'm hoping there's a 
way to pass relevant (or all) query params to that uri.  Maybe something 
along the lines of the "use-request-parameters" parameter.

Is there some way to get access to request parameters from within a URI 
that the CachingURICoplet is processing for content?  I know nothing about 
the other ways to do forms in Cocoon (CForms, etc.)  Would one of those 
approaches allow the sort of behavior I'm looking for?  Also, I took a 
look at the Application coplet, but couldn't get it working quickly. Would 
that give me this ability?

Taking a step back, If I move the site into the portal webapp and modify 
the copletdata/portal.xml so that the temporary-uri uses a cocoon:// 
source then the form validation is processed correctly, which is what I 
would expect.  But we were hoping to keep the content for various coplets 
in their own web applications, to simplify maintenance.  This is 
exploratory right now, so I'm open to feedback on whether keeping separate 
web applications is a) possible and b) worth whatever additional effort is 
required to get things working.

Comments welcome.

Jaes

Here's the portlet setup from copletdata/portal.xml:

    <coplet-data id="ERPReports" name="standard">
      <title>ERP Reports</title>
      <coplet-base-data>CachingURICoplet</coplet-base-data>
      <attribute>
         <name>buffer</name>
         <value xsi:type="java:java.lang.Boolean" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">true</value>
      </attribute>
      <attribute>
         <name>handleParameters</name>
         <value xsi:type="java:java.lang.Boolean" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">true</value>
      </attribute>
      <attribute>
         <name>uri</name>
         <value xsi:type="java:java.lang.String" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/coplets/html/application</value>
      </attribute>
      <attribute>
         <name>temporary:application-uri</name>
         <value xsi:type="java:java.lang.String" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">http://localhost/reports/portlet/nav</value>
      </attribute>
   </coplet-data>

---------
I'm just using the vanilla pipline for the uri 
cocoon:/coplets/html/application.  (I actually tried adding a 
<map:parameter name="use-request-parameters" value="true"/> to the 
generator on a lark, but it didn't work...):

      <map:match pattern="application">
        <map:generate 
src="{coplet:temporaryAttributes/application-uri}?copletid={coplet:#}"/>
        <map:transform type="htmlroot">
          <map:parameter name="add-mode" value="false"/>
        </map:transform>
        <map:transform type="portal-html-eventlink">
          <map:parameter name="attribute-name" value="application-uri"/>
        </map:transform>
        <map:serialize type="xml"/>
      </map:match>

---------
Here's the pipeline that does the form validation and display:

      <map:match pattern="Planner/MOTraveler/searchPanel">
        <map:act type="form-validator">
          <map:parameter name="descriptor"
            value="equip/travelers/forms/travelersDef.xml" />
          <map:parameter name="validate-set" value="searchPanel" />

          <map:act type="searchPanelValidator">
            // process the data from a valid form submission
          </map:act>
        </map:act>
        <map:generate type="serverpages"
          src="equip/travelers/xsp/SearchPanelFormMO.xsp" />
        <map:transform
          src="equip/travelers/stylesheets/SearchPanelFormMO.xsl"/>
        <map:serialize type="xml" />
      </map:match> 
Mime
View raw message