6 Replies Latest reply on Jan 23, 2006 1:35 PM by julien1

    response.getNameSpace inconsistent

    mvoopentext

      Hello there

      My portlet shows a table which allows column sorting. The generated links used .getNameSpace to generate a unique sort url. Although this works with most portlet containers, jboss (tried 2.2 and 2.2RC1) returns a different value for subsequent calls on the same portlet!?

      Sorting is not possible because my table tag looks with the wrong id for the sort command within the request.

      I am using a self written table tag, that retrieves the PortletRequest and generates sort parameters the following way:
      getNameSpace() + tag-id + .

        • 1. Re: response.getNameSpace inconsistent
          mvoopentext

          Um... my <sortParameter> got killed :-)
          forgot to escape the braces

          • 2. Re: response.getNameSpace inconsistent
            mvoopentext

            I am using an unmodified version of the bundled package jboss&portal 2.2RC1.

            OS is windows xp

            Java is 1.5

            • 3. Re: response.getNameSpace inconsistent

              would you have a testcase to show it please ?

              • 4. Re: response.getNameSpace inconsistent
                mvoopentext

                Deploy this portlet and reload the page a few times. The expected behavior is that there is always only on entry, but jboss adds one with every request.

                package com.opentext.websdk.portlet;

                import java.io.IOException;
                import java.io.Writer;
                import java.util.HashSet;
                import java.util.Iterator;
                import java.util.Set;

                import javax.portlet.ActionRequest;
                import javax.portlet.ActionResponse;
                import javax.portlet.Portlet;
                import javax.portlet.PortletConfig;
                import javax.portlet.PortletException;
                import javax.portlet.RenderRequest;
                import javax.portlet.RenderResponse;

                public class MvoPortlet implements Portlet {

                Set nameSpaces = null;

                public void init(PortletConfig arg0) throws PortletException {
                nameSpaces = new HashSet();
                }

                public void processAction(ActionRequest arg0, ActionResponse arg1)
                throws PortletException, IOException {
                // ignore
                }

                public void render(RenderRequest arg0, RenderResponse response)
                throws PortletException, IOException {
                response.setContentType("text/html");
                String id = response.getNamespace();
                nameSpaces.add(id);
                Writer writer = response.getWriter();
                writer.write("ids");
                for (Iterator iter = nameSpaces.iterator(); iter.hasNext();) {
                String element = (String) iter.next();
                writer.write("");
                writer.write(element);
                writer.write("");
                }
                writer.write("");
                writer.flush();
                }

                public void destroy() {
                nameSpaces.clear();
                nameSpaces = null;
                }

                }

                • 5. Re: response.getNameSpace inconsistent

                  you are right, I fixed it for portletbridge but only in the JSP tag.

                  gonna fix it now in 2.4 and 2.2.

                  • 6. Re: response.getNameSpace inconsistent

                    I have commited the fix, FYI the feature is in jira http://jira.jboss.com/jira/browse/JBPORTAL-523