1 Reply Latest reply on May 11, 2008 8:44 AM by Pavel Myshkin

    Adding custom Window Property

    Daniel Haslinger Newbie

      Hello!

      I've written a custom portlet that displays the content of an html file from the filesystem.
      The location of this file is set by a custom property called "content", which value contains the path to the html file.

      Currently I'm setting this property manually directly in the portal.

      In the doView() method of the portlet, i receive the properties with:

      PortalNode node = Navigation.getCurrentNode();
      Map props = node.getProperties();


      This works fine, but the problem is that I do not want to add the content property manually each time, I want to add it directly in the code, like:


      PortalNode node = Navigation.getCurrentNode();
      Map props = node.getProperties();
      
      if(!props.containsKey("content")){
       props.put("content", "/html/file.html");
      }


      But this throws a java.lang.UnsupportedOperationException.

      Can any one please help me with this?

      Thanks a lot in advance,
      Daniel

      Server: 4.2.2
      Portal: 2.6.3

        • 1. Re: Adding custom Window Property
          Pavel Myshkin Newbie

          Tho code to retrieve the window properties does not need an active UserTransaction but the code to write them does.

          Your options:

          1. You can configure in jboss-portlet that your portlet need a transaction and then JBP will always wrap your portlet code in a transaction.

          2. Lookup and begin a UserTransaction on your own exactly when you need it

          the second is preferable.