You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by Serge <se...@gmail.com> on 2008/01/08 14:48:44 UTC

how to change portletID

Hello,

i have to build a portal based on pluto. But I have a problem with the
portletID.
The portletID usually contains context path, portlet name and meta info.
(Created in java class PortletWindowConfig in package
org.apache.pluto.driver.services.portal in pluto-portal-driver). I only
need the portlet name in my portlets. So I changed the java code from
"return contextPath + "." + portletName + "!" + metaInfo;" to "return
portletName;". Then installed pluto on apache tomcat with command "mvn
pluto:install -DinstallDir="path to tomcat"". But I still have the old
portletID in my html source code. Have somebody any solution for my
problem?

Thanks,
Serge

Re: how to change portletID

Posted by be...@netsos.com.
> I would change the createPortletID to have in generated code a usefull ID
> for the div in the HTML code. So I can use CSS to arrange the portlets on
> site. Now I have some like this "/context.portletName!764587357|0". That I
> cannot use for CSS.
> If I only have the name for portlet, t.e. "myPortlet", I change the
> pluto-default-theme to
>
> <c:set var="portlet" value="myPortlet" scope="request"/>
> <jsp:include page="portlet-skin.jsp"/>
>
> to arrange them.
>
> I need a site with arranged portlets. If you have another solution to make
> that, please teach me :-)

Serge,

I would either create a custom tag (preferably) or even use inline java in
your JSP to parse the portlet name with a regular expression.  Here is a
Groovy script to give you a hint (I left the class names in so that it
will be easier to convert to Java):

import java.util.regex.*

id = '/context.portletName!764587357|0'
Pattern p = Pattern.compile("[^\\.]+\\.([^!]+)!.*")
Matcher m = p.matcher(id)
m.find()
print m.group(1)

Be sure to store the java.util.regex.Pattern in a static constant or
something so that you are compiling it on every invocation, as this is
somewhat expensive.  I'm not an expert on regular expression matching, so
you might be able to create a more efficient expression or even realize
better performance from good old brute force parsing.  No matter what your
implementation though, I think that you will have better results if you
keep this logic contained in the theme of your portal.

-- Ben


Re: how to change portletID

Posted by Serge <se...@gmail.com>.
On Tue, 08 Jan 2008 14:55:15 +0100, Christian Raschka  
<ch...@googlemail.com> wrote:

Thanks for your answer,

I would change the createPortletID to have in generated code a usefull ID  
for the div in the HTML code. So I can use CSS to arrange the portlets on  
site. Now I have some like this "/context.portletName!764587357|0". That I  
cannot use for CSS.
If I only have the name for portlet, t.e. "myPortlet", I change the  
pluto-default-theme to

<c:set var="portlet" value="myPortlet" scope="request"/>
<jsp:include page="portlet-skin.jsp"/>

to arrange them.

I need a site with arranged portlets. If you have another solution to make  
that, please teach me :-)

P.S. I really could not find any info how to make that.

Thanks,
Serge



> Hi Serge,
>
> it's not a good idea to change the getPortletId method. I would  
> recommend to
> use getPortletName instead.
> Nevertheless you have to "mvn install" before a "mvn pluto:install" for
> every build.
>
> Christian
>
> 2008/1/8, Serge <se...@gmail.com>:
>>
>> Hello,
>>
>> i have to build a portal based on pluto. But I have a problem with the
>> portletID.
>> The portletID usually contains context path, portlet name and meta info.
>> (Created in java class PortletWindowConfig in package
>> org.apache.pluto.driver.services.portal in pluto-portal-driver). I only
>> need the portlet name in my portlets. So I changed the java code from
>> "return contextPath + "." + portletName + "!" + metaInfo;" to "return
>> portletName;". Then installed pluto on apache tomcat with command "mvn
>> pluto:install -DinstallDir="path to tomcat"". But I still have the old
>> portletID in my html source code. Have somebody any solution for my
>> problem?
>>
>> Thanks,
>> Serge
>>



-- 
Mit freundlichen Grüßen
Serge Rittscher

Re: how to change portletID

Posted by Christian Raschka <ch...@googlemail.com>.
Hi Serge,

it's not a good idea to change the getPortletId method. I would recommend to
use getPortletName instead.
Nevertheless you have to "mvn install" before a "mvn pluto:install" for
every build.

Christian

2008/1/8, Serge <se...@gmail.com>:
>
> Hello,
>
> i have to build a portal based on pluto. But I have a problem with the
> portletID.
> The portletID usually contains context path, portlet name and meta info.
> (Created in java class PortletWindowConfig in package
> org.apache.pluto.driver.services.portal in pluto-portal-driver). I only
> need the portlet name in my portlets. So I changed the java code from
> "return contextPath + "." + portletName + "!" + metaInfo;" to "return
> portletName;". Then installed pluto on apache tomcat with command "mvn
> pluto:install -DinstallDir="path to tomcat"". But I still have the old
> portletID in my html source code. Have somebody any solution for my
> problem?
>
> Thanks,
> Serge
>