You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Woonsan Ko (JIRA)" <ji...@apache.org> on 2007/02/01 08:51:05 UTC

[jira] Created: (COCOON-1998) CocoonPortlet needs to allow overriding servlet-path parameter with preferences.

CocoonPortlet needs to allow overriding servlet-path parameter with preferences.
--------------------------------------------------------------------------------

                 Key: COCOON-1998
                 URL: https://issues.apache.org/jira/browse/COCOON-1998
             Project: Cocoon
          Issue Type: Improvement
          Components: Blocks: Portal
    Affects Versions: 2.1.11-dev (Current SVN)
            Reporter: Woonsan Ko
             Fix For: 2.1.11-dev (Current SVN)
         Attachments: servlet-path-pref-diff.txt

The CocoonPortlet in BRANCH_2_1_X does not allow overriding the *servlet-path* init parameter by preferences.
If the CocoonPortlet reads preferences to override the 'servlet-path', portal users can use manycoplet fragments without tedious portlet tag additions.
FYI, some portals such as Jetspeed 2 allows inline preference settings, not allowed for end-users.

Without this feature, portal users have to add portlet tags in the portlet.xml whenever they need to use another coplet in the portal site.

To test properly for the patch, you should add init-parameter in the cocoon/WEB-INF/portlet.xml like the
following:

  <portlet>
    <portlet-name>CocoonPortlet</portlet-name>
    ...
    <init-param>
      <name>allow-preferences</name>
      <value>true</value>
    </init-param>
    ...
  </portlet>

ManagedCocoonPortlet will read preferences just when the above parameter is set to true. (I borrowed this from GenericServletPortlet in Apache portal bridges.)

I've tested this modification under Jetspeed-2 (/WEB-INF/pages/default-page.psml).
The portlet fragment can be added with preferences like the following:

        <fragment id="dp-19" type="portlet" name="cocoon::CocoonPortlet">
            <property name="row" value="6"/>
            <property name="column" value="0"/>
            <preference name="servlet-path" readOnly="true">
                <value>samples/blocks/portal/portlets/helloworld</value>
            </preference>
        </fragment>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COCOON-1998) CocoonPortlet needs to allow overriding servlet-path parameter with preferences.

Posted by "Woonsan Ko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Woonsan Ko updated COCOON-1998:
-------------------------------

    Attachment: servlet-path-pref-diff2.txt

Guided by Carsten, I modified my patch to use local 'servlet-path' variable, and change the name of the init-parameter to 'servlet-path-overriding'.
Also, I modified the portlet.xml to set this parameter to 'true' by default.

FYI, I tested like the following steps using Apache Jetspeed 2:

0. Deploy cocoon.war into Apache Jetspeed2. Usually just put cocoon.war in /jetseed/WEB-INF/deploy/.

1. Copy 'cocoon/samples/blocks/portal/portlets/hello.html' to 'cocoon/samples/blocks/portal/portlets/hello2.html', and edit 'hello2.html' to display different content.

2. Add a map in the 'cocoon/samples/blocks/portal/portlets/sitemap.xmap' like the following:
      <map:match pattern="hello2/**">
        <map:read mime-type="text/html" src="hello2.html"/>
      </map:match>

3. Add the following fragments into 'jetspeed/WEB-INF/pages/default-page.psml like the following:

    <!-- The first cocoon portlet using default 'servlet-path'. -->
    <fragment id="dp-19" type="portlet" name="cocoon::CocoonPortlet">
      <property name="row" value="7"/>
      <property name="column" value="0"/>
    </fragment>

    <!-- The second cocoon portlet overriding 'servlet-path' by preference. -->
    <fragment id="dp-20" type="portlet" name="cocoon::CocoonPortlet">
      <property name="row" value="8"/>
      <property name="column" value="0"/>
      <preference name="servlet-path" readOnly="true">
        <value>samples/blocks/portal/portlets/hello2</value>
      </preference>
    </fragment>


Thanks.

> CocoonPortlet needs to allow overriding servlet-path parameter with preferences.
> --------------------------------------------------------------------------------
>
>                 Key: COCOON-1998
>                 URL: https://issues.apache.org/jira/browse/COCOON-1998
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: Blocks: Portal
>    Affects Versions: 2.1.11-dev (Current SVN)
>            Reporter: Woonsan Ko
>         Assigned To: Carsten Ziegeler
>             Fix For: 2.1.11-dev (Current SVN)
>
>         Attachments: servlet-path-pref-diff.txt, servlet-path-pref-diff2.txt
>
>
> The CocoonPortlet in BRANCH_2_1_X does not allow overriding the *servlet-path* init parameter by preferences.
> If the CocoonPortlet reads preferences to override the 'servlet-path', portal users can use manycoplet fragments without tedious portlet tag additions.
> FYI, some portals such as Jetspeed 2 allows inline preference settings, not allowed for end-users.
> Without this feature, portal users have to add portlet tags in the portlet.xml whenever they need to use another coplet in the portal site.
> To test properly for the patch, you should add init-parameter in the cocoon/WEB-INF/portlet.xml like the
> following:
>   <portlet>
>     <portlet-name>CocoonPortlet</portlet-name>
>     ...
>     <init-param>
>       <name>allow-preferences</name>
>       <value>true</value>
>     </init-param>
>     ...
>   </portlet>
> ManagedCocoonPortlet will read preferences just when the above parameter is set to true. (I borrowed this from GenericServletPortlet in Apache portal bridges.)
> I've tested this modification under Jetspeed-2 (/WEB-INF/pages/default-page.psml).
> The portlet fragment can be added with preferences like the following:
>         <fragment id="dp-19" type="portlet" name="cocoon::CocoonPortlet">
>             <property name="row" value="6"/>
>             <property name="column" value="0"/>
>             <preference name="servlet-path" readOnly="true">
>                 <value>samples/blocks/portal/portlets/helloworld</value>
>             </preference>
>         </fragment>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COCOON-1998) CocoonPortlet needs to allow overriding servlet-path parameter with preferences.

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COCOON-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12469787 ] 

Carsten Ziegeler commented on COCOON-1998:
------------------------------------------

Sorry, but I think the patch is still not 100% correct. In this snippet:
>>>
+        if (servletPath.startsWith("/")) {
+            servletPath = servletPath.substring(1);
+        }
+        if (servletPath.endsWith("/")) {
+            servletPath = servletPath.substring(0, servletPath.length() - 1);
+        }
+
         String pathInfo = getPathInfo(request);
 
         String uri = servletPath;
<<<
servletPath is still changed, I think it should be that you first assing servletPath to "uri" and then only work with "uri" from there, like
if (uri.startsWith("/")) {
  uri = uri.substring(1);
}
and so on.

I think servletPath should never be changed inside these methods.


> CocoonPortlet needs to allow overriding servlet-path parameter with preferences.
> --------------------------------------------------------------------------------
>
>                 Key: COCOON-1998
>                 URL: https://issues.apache.org/jira/browse/COCOON-1998
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: Blocks: Portal
>    Affects Versions: 2.1.11-dev (Current SVN)
>            Reporter: Woonsan Ko
>         Assigned To: Carsten Ziegeler
>             Fix For: 2.1.11-dev (Current SVN)
>
>         Attachments: servlet-path-pref-diff.txt, servlet-path-pref-diff2.txt
>
>
> The CocoonPortlet in BRANCH_2_1_X does not allow overriding the *servlet-path* init parameter by preferences.
> If the CocoonPortlet reads preferences to override the 'servlet-path', portal users can use manycoplet fragments without tedious portlet tag additions.
> FYI, some portals such as Jetspeed 2 allows inline preference settings, not allowed for end-users.
> Without this feature, portal users have to add portlet tags in the portlet.xml whenever they need to use another coplet in the portal site.
> To test properly for the patch, you should add init-parameter in the cocoon/WEB-INF/portlet.xml like the
> following:
>   <portlet>
>     <portlet-name>CocoonPortlet</portlet-name>
>     ...
>     <init-param>
>       <name>allow-preferences</name>
>       <value>true</value>
>     </init-param>
>     ...
>   </portlet>
> ManagedCocoonPortlet will read preferences just when the above parameter is set to true. (I borrowed this from GenericServletPortlet in Apache portal bridges.)
> I've tested this modification under Jetspeed-2 (/WEB-INF/pages/default-page.psml).
> The portlet fragment can be added with preferences like the following:
>         <fragment id="dp-19" type="portlet" name="cocoon::CocoonPortlet">
>             <property name="row" value="6"/>
>             <property name="column" value="0"/>
>             <preference name="servlet-path" readOnly="true">
>                 <value>samples/blocks/portal/portlets/helloworld</value>
>             </preference>
>         </fragment>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COCOON-1998) CocoonPortlet needs to allow overriding servlet-path parameter with preferences.

Posted by "Woonsan Ko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Woonsan Ko updated COCOON-1998:
-------------------------------

    Attachment: servlet-path-pref-diff3.txt

I'm sorry and thank you, Carsten. 
I modified it not to hide instance variable. Also I reviewed and tested again. It works fine when I tested on my production server.

To excuse myself, the local variable, 'servletPath' was added in Aug. 12, 2004, so I did not modify the local variable hiding the instance variable.
Anyway, I think you are right. The local variable hiding the instance member is so confusing. Thanks.

> CocoonPortlet needs to allow overriding servlet-path parameter with preferences.
> --------------------------------------------------------------------------------
>
>                 Key: COCOON-1998
>                 URL: https://issues.apache.org/jira/browse/COCOON-1998
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: Blocks: Portal
>    Affects Versions: 2.1.11-dev (Current SVN)
>            Reporter: Woonsan Ko
>         Assigned To: Carsten Ziegeler
>             Fix For: 2.1.11-dev (Current SVN)
>
>         Attachments: servlet-path-pref-diff.txt, servlet-path-pref-diff2.txt, servlet-path-pref-diff3.txt
>
>
> The CocoonPortlet in BRANCH_2_1_X does not allow overriding the *servlet-path* init parameter by preferences.
> If the CocoonPortlet reads preferences to override the 'servlet-path', portal users can use manycoplet fragments without tedious portlet tag additions.
> FYI, some portals such as Jetspeed 2 allows inline preference settings, not allowed for end-users.
> Without this feature, portal users have to add portlet tags in the portlet.xml whenever they need to use another coplet in the portal site.
> To test properly for the patch, you should add init-parameter in the cocoon/WEB-INF/portlet.xml like the
> following:
>   <portlet>
>     <portlet-name>CocoonPortlet</portlet-name>
>     ...
>     <init-param>
>       <name>allow-preferences</name>
>       <value>true</value>
>     </init-param>
>     ...
>   </portlet>
> ManagedCocoonPortlet will read preferences just when the above parameter is set to true. (I borrowed this from GenericServletPortlet in Apache portal bridges.)
> I've tested this modification under Jetspeed-2 (/WEB-INF/pages/default-page.psml).
> The portlet fragment can be added with preferences like the following:
>         <fragment id="dp-19" type="portlet" name="cocoon::CocoonPortlet">
>             <property name="row" value="6"/>
>             <property name="column" value="0"/>
>             <preference name="servlet-path" readOnly="true">
>                 <value>samples/blocks/portal/portlets/helloworld</value>
>             </preference>
>         </fragment>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (COCOON-1998) CocoonPortlet needs to allow overriding servlet-path parameter with preferences.

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler closed COCOON-1998.
------------------------------------

    Resolution: Fixed

Thanks for the patch!!!
It's applied now.

> CocoonPortlet needs to allow overriding servlet-path parameter with preferences.
> --------------------------------------------------------------------------------
>
>                 Key: COCOON-1998
>                 URL: https://issues.apache.org/jira/browse/COCOON-1998
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: Blocks: Portal
>    Affects Versions: 2.1.11-dev (Current SVN)
>            Reporter: Woonsan Ko
>         Assigned To: Carsten Ziegeler
>             Fix For: 2.1.11-dev (Current SVN)
>
>         Attachments: servlet-path-pref-diff.txt, servlet-path-pref-diff2.txt, servlet-path-pref-diff3.txt
>
>
> The CocoonPortlet in BRANCH_2_1_X does not allow overriding the *servlet-path* init parameter by preferences.
> If the CocoonPortlet reads preferences to override the 'servlet-path', portal users can use manycoplet fragments without tedious portlet tag additions.
> FYI, some portals such as Jetspeed 2 allows inline preference settings, not allowed for end-users.
> Without this feature, portal users have to add portlet tags in the portlet.xml whenever they need to use another coplet in the portal site.
> To test properly for the patch, you should add init-parameter in the cocoon/WEB-INF/portlet.xml like the
> following:
>   <portlet>
>     <portlet-name>CocoonPortlet</portlet-name>
>     ...
>     <init-param>
>       <name>allow-preferences</name>
>       <value>true</value>
>     </init-param>
>     ...
>   </portlet>
> ManagedCocoonPortlet will read preferences just when the above parameter is set to true. (I borrowed this from GenericServletPortlet in Apache portal bridges.)
> I've tested this modification under Jetspeed-2 (/WEB-INF/pages/default-page.psml).
> The portlet fragment can be added with preferences like the following:
>         <fragment id="dp-19" type="portlet" name="cocoon::CocoonPortlet">
>             <property name="row" value="6"/>
>             <property name="column" value="0"/>
>             <preference name="servlet-path" readOnly="true">
>                 <value>samples/blocks/portal/portlets/helloworld</value>
>             </preference>
>         </fragment>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (COCOON-1998) CocoonPortlet needs to allow overriding servlet-path parameter with preferences.

Posted by "Carsten Ziegeler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carsten Ziegeler reassigned COCOON-1998:
----------------------------------------

    Assignee: Carsten Ziegeler

> CocoonPortlet needs to allow overriding servlet-path parameter with preferences.
> --------------------------------------------------------------------------------
>
>                 Key: COCOON-1998
>                 URL: https://issues.apache.org/jira/browse/COCOON-1998
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: Blocks: Portal
>    Affects Versions: 2.1.11-dev (Current SVN)
>            Reporter: Woonsan Ko
>         Assigned To: Carsten Ziegeler
>             Fix For: 2.1.11-dev (Current SVN)
>
>         Attachments: servlet-path-pref-diff.txt
>
>
> The CocoonPortlet in BRANCH_2_1_X does not allow overriding the *servlet-path* init parameter by preferences.
> If the CocoonPortlet reads preferences to override the 'servlet-path', portal users can use manycoplet fragments without tedious portlet tag additions.
> FYI, some portals such as Jetspeed 2 allows inline preference settings, not allowed for end-users.
> Without this feature, portal users have to add portlet tags in the portlet.xml whenever they need to use another coplet in the portal site.
> To test properly for the patch, you should add init-parameter in the cocoon/WEB-INF/portlet.xml like the
> following:
>   <portlet>
>     <portlet-name>CocoonPortlet</portlet-name>
>     ...
>     <init-param>
>       <name>allow-preferences</name>
>       <value>true</value>
>     </init-param>
>     ...
>   </portlet>
> ManagedCocoonPortlet will read preferences just when the above parameter is set to true. (I borrowed this from GenericServletPortlet in Apache portal bridges.)
> I've tested this modification under Jetspeed-2 (/WEB-INF/pages/default-page.psml).
> The portlet fragment can be added with preferences like the following:
>         <fragment id="dp-19" type="portlet" name="cocoon::CocoonPortlet">
>             <property name="row" value="6"/>
>             <property name="column" value="0"/>
>             <preference name="servlet-path" readOnly="true">
>                 <value>samples/blocks/portal/portlets/helloworld</value>
>             </preference>
>         </fragment>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COCOON-1998) CocoonPortlet needs to allow overriding servlet-path parameter with preferences.

Posted by "Woonsan Ko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COCOON-1998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Woonsan Ko updated COCOON-1998:
-------------------------------

    Attachment: servlet-path-pref-diff.txt

> CocoonPortlet needs to allow overriding servlet-path parameter with preferences.
> --------------------------------------------------------------------------------
>
>                 Key: COCOON-1998
>                 URL: https://issues.apache.org/jira/browse/COCOON-1998
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: Blocks: Portal
>    Affects Versions: 2.1.11-dev (Current SVN)
>            Reporter: Woonsan Ko
>             Fix For: 2.1.11-dev (Current SVN)
>
>         Attachments: servlet-path-pref-diff.txt
>
>
> The CocoonPortlet in BRANCH_2_1_X does not allow overriding the *servlet-path* init parameter by preferences.
> If the CocoonPortlet reads preferences to override the 'servlet-path', portal users can use manycoplet fragments without tedious portlet tag additions.
> FYI, some portals such as Jetspeed 2 allows inline preference settings, not allowed for end-users.
> Without this feature, portal users have to add portlet tags in the portlet.xml whenever they need to use another coplet in the portal site.
> To test properly for the patch, you should add init-parameter in the cocoon/WEB-INF/portlet.xml like the
> following:
>   <portlet>
>     <portlet-name>CocoonPortlet</portlet-name>
>     ...
>     <init-param>
>       <name>allow-preferences</name>
>       <value>true</value>
>     </init-param>
>     ...
>   </portlet>
> ManagedCocoonPortlet will read preferences just when the above parameter is set to true. (I borrowed this from GenericServletPortlet in Apache portal bridges.)
> I've tested this modification under Jetspeed-2 (/WEB-INF/pages/default-page.psml).
> The portlet fragment can be added with preferences like the following:
>         <fragment id="dp-19" type="portlet" name="cocoon::CocoonPortlet">
>             <property name="row" value="6"/>
>             <property name="column" value="0"/>
>             <preference name="servlet-path" readOnly="true">
>                 <value>samples/blocks/portal/portlets/helloworld</value>
>             </preference>
>         </fragment>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.