portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Sean Taylor" <da...@bluesunrise.com>
Subject RE: Multiple Instances of same portlet ? (bug ?)
Date Fri, 08 Feb 2002 17:02:17 GMT
Hi Aurélien,

Ive included the Jetspeed Dev list on this one, hope you don't mind.
That way we can get help from the others too :)

I haven't tried this yet, but Ive been meaning to and Im pretty sure it will
work.
To get around turning the cache off (this is not good for performance),
Override the getHandle() method (derived from AbstractPortlet) and make sure
that you always return a unique value for the portlet-ref :

    public static Object getHandle(Object config)

	return the portlet-ref name; // unique

Ive been working on the Portlet Tutorial, and Im stuck at this section of a
portlet lifecycle.
The lifecycle of a portlet is not so easy to document, since Im not sure if
I want to document behavior that I don't completely agree with...
The lifecycle depends on the cache settings, and also on a rather
interesting :) algorithm used in AbstractPortlet.getHandle.
The way that Jetspeed determines whether to create a new instance of a
portlet or not, is
- check the cache settings - if caching is turned off, new portlets are
created per request (not good for performance or keeping 'state')
- if the cache is on - look up the portlet in the cache and see if it
already exists. If it doesn't, create a new portlet and add it to the cache

The cache is indexed off the getHandle() method on AbstractPortlet.
The 'key' is returned as:

	URL-param + (param.Name-1 ... param.Name-n) + (param.Value-1 ...
param.Value-n)

So the uniqueness of the handle is based on the init params from the
registry (and the psml params).
That is a questionable approach, which may work well with RSS-type portlets,
but only when the parameters are directly related to the content..
Anyway, you can always override the getHandle().

There are other problems with having the same portlet on the same page that
has to do with parameters.
Think about the HelloVelocity portlet. It uses the VelocityContext and query
parameters.
During post, how does the portlet know if the post was to this portlet or
another?
It doesn't.

I was discussing this with Paul, and we were thinking that you could, with
the $jlink tool, encode a unique portlet id into the url.
Then when the parameter is accessed, assuming it gets it via
JetspeedRunData, we could intercept the getParmeter request, and only give
it to the targeted portlet of the post. This solution is not perfect, since
via the servlet api you can directy get the parameters.

Some examples of parameter collisions are:

- when two portlets have the same parameters in post or query parameters
	(don't think that this is addressed by the portlet api)
- when two portlets put the same attributes in the context (or session
variables)
	(i believe this is addressed by the portlet api somehow - disallowing some
servlet api calls)
- The PersistenceService stores parameters indexed on portlet name (this
could be changed to a unique portlet id)
- when a portlet contains a form that expects a next type of state action,
what do you pass it?

David


> -----Original Message-----
> From: Aurel [mailto:apernoud@sopragroup.com]
> Sent: Friday, February 08, 2002 7:37 AM
> To: David Sean Taylor
> Subject: Re: Multiple Instances of same portlet ? (bug ?)
>
>
> No you didn't, but there's no need to apologize I know you must
> have lot of
> mails to read and answer.
>
> I've found out that by making multiple-ref to an abstract portlet it works
> fine, but I had to disable the cache in the init() method too
> (setcacheable(false)) to prevent other "bugs" on displaying the
> same portlet
> on multiple pane.
>
> I wanted to know if it was ok to add the same portlet on multiple
> pane this
> way or if it was better to make one ref each time you use a
> portlet (even on
> different panes) ?
>
> Thanks,
> Aurélien.
>
>
>
>
>
>
> ----- Original Message -----
> From: "David Sean Taylor" <david@bluesunrise.com>
> To: "Aurel" <apernoud@sopragroup.com>
> Sent: Thursday, February 07, 2002 7:39 PM
> Subject: RE: Multiple Instances of same portlet ? (bug ?)
>
>
> > Did I respond to this message yet?
> > Ive been out of town and busy as hell.
> > My apologies if I haven't, please let me know
> >
> > David
> >
> > > -----Original Message-----
> > > From: Aurel [mailto:apernoud@sopragroup.com]
> > > Sent: Monday, February 04, 2002 6:05 AM
> > > To: David Sean Taylor
> > > Subject: Re: Multiple Instances of same portlet ? (bug ?)
> > >
> > >
> > > I know you can't have the same portlet twice on a portal (even on
> > > different
> > > pages it causes bugs as far as I tested it), but wat do you mean by
> "enter
> > > multiple portlet-refs in the registry" ???
> > >
> > > I thought that was what I did (see my .xreg down there), but
> I might be
> > > wrong... again :)
> > >
> > > Can you be more specific or point an url please ?
> > >
> > > Thanks,
> > > Aurélien.
> > >
> > > PS : I don't answer to jetspeed-user because your answer must be
> > > sufficient,
> > > but I don't get it... sorry.
> > >
> > >
> > > ----- Original Message -----
> > > From: "David Sean Taylor" <david@bluesunrise.com>
> > > To: "Jetspeed Users List" <jetspeed-user@jakarta.apache.org>
> > > Sent: Saturday, February 02, 2002 6:01 AM
> > > Subject: Re: Multiple Instances of same portlet ? (bug ?)
> > >
> > >
> > > > Its a known design 'feature'  that you cant have the same
> portlet more
> > > than
> > > > once per page.
> > > > I believe the current advice is to enter multiple
> portlet-refs in the
> > > > registry.
> > > >
> > > > We are considering alternative approaches, such as a unique id
> > > to identify
> > > > each portlet, but no one has stepped up to implement it yet
> > > >
> > > > ----- Original Message -----
> > > > From: "Aurelien Pernoud" <apernoud@sopragroup.com>
> > > > To: "Jetspeed Users List" <jetspeed-user@jakarta.apache.org>
> > > > Sent: Friday, February 01, 2002 5:31 AM
> > > > Subject: Multiple Instances of same portlet ? (bug ?)
> > > >
> > > >
> > > > > Hi all,
> > > > > I'm new to Jetspeed and Portlets, and been testing it for a while.
> > > > > I have issues with multiple instances of the same portlet.
> > > > > I made my own "testing" portlet (from AbstractProtlet), wich
> displays
> > > > > informations such as :
> > > > > Title, Name, Class, Title of the PortletSet, Name of all
> the portles
> > > > inside
> > > > > the portletset...
> > > > >
> > > > > It works fine, but when I try to use this portlet more than
> > > one time, It
> > > > > doesn't work the way I'd like.
> > > > >
> > > > > Here is myportlet.xreg :
> > > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > > <registry>
> > > > >     <portlet-entry name="Bug" hidden="false" type="instance"
> > > > > application="false">
> > > > >         <meta-info>
> > > > >             <title>Title Bug</title>
> > > > >             <description>Demo du Bug</description>
> > > > >         </meta-info>
> > > > >         <classname>portal.portlets.MyPortlet</classname>
> > > > >         <media-type ref="html"/>
> > > > >     </portlet-entry>
> > > > >     <portlet-entry name="Essai" hidden="false" type="instance"
> > > > > application="false">
> > > > >         <meta-info>
> > > > >             <title>Title Essai</title>
> > > > >             <description>Portlet de base</description>
> > > > >         </meta-info>
> > > > >         <classname>portal.portlets.MyPortlet</classname>
> > > > >         <media-type ref="html"/>
> > > > >     </portlet-entry>
> > > > > </registry>
> > > > >
> > > > > The way I understood it, the two portlets should not interact ?
> > > > > (type=instance is the way to do it ??)
> > > > >
> > > > > But when I use both of them, inside the same pane or in
> > > different panes,
> > > > > they both will display that their name is "Bug" BUT they show
> > > their own
> > > > > title (i.e "Title Bug" or "Title Essai")... Then I have
> issues with
> > > > controls
> > > > > (minimize make both portlets get minimized or only one but
> > > not the good
> > > > > one..., sometimes even one of the portlet may simply not be
> > > displayed...).
> > > > >
> > > > > I don't get what I'm missing, and I didn't find any
> related bugs...
> > > > > (but I'm new to using bugzilla and the mail-archive so maybe there
> is
> > > > > information I didn't find)
> > > > >
> > > > > If anyone can help.
> > > > >
> > > > > Thanks,
> > > > > Aurélien.
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > <mailto:jetspeed-user-unsubscribe@jakarta.apache.org>
> > > > > For additional commands, e-mail:
> > > > <mailto:jetspeed-user-help@jakarta.apache.org>
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > <mailto:jetspeed-user-unsubscribe@jakarta.apache.org>
> > > > For additional commands, e-mail:
> > > <mailto:jetspeed-user-help@jakarta.apache.org>
> > > >
> > > >
> > >
> > >
> > >
> >
> >
> >
>
>
>



--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message