And Olivier, you'll have to be a bit careful. You will not necessarily
have access to the same view-state OR component tree. Furthermore, by
default in JSF, session-scoped beans are stored on the portlet-scoped
session context rather then the global-scoped session context which is
what you get when referencing the servlet. And that is assuming that
your session is the same on the Portlet's webapp as it is on the
servlet's webapp.
So here is how I would architect a solution like this... If you want to
serve a PDF, I would make a servlet that serves the PDF and will allow
all relivant attributes to be passed in via parameters. I would NOT
rely on the session or component tree or viewstate being in tact. When
generating the links, make sure to do an encodeResourceURL on the url to
your PDF resource servlet. This will allow the application to hit the
servlet "through" the portal....
In the future specs like JSR-286 (with it's in-protocol resource
request) and JSR-301 (with the ability to handle resource and AJAX
requests through the portal bridge) may better define the behavior your
looking for, but we are by no means at that point quite yet. I hope
this helps..
Scott
Olivier Ziller wrote:
Simon,
didn't find this one and i will try this
thanks
Simon Kitching a écrit :
Olivier Ziller wrote:
hello,
i need my jsf based portlet to generate dynamic pdf content and it
seems that i need a servlet to do this.
i was wondering if it possible to have my servlet share the same
facescontext than my portlet?
in order to do this i have imagined to create a jsf servlet that
would handle all *.download requests (and my portlet to handle all
*.faces requests)
is it possible to have both a jsf portlet and a jsf servlet running
in the same time in a web application? and sharing the same
facescontext?
What do you mean by "the same facescontext"?
A FacesContext instance is only request-scoped; it is created when a
request arrives and destroyed when the request ends. It is therefore
not possible to share this.
Perhaps what you mean is for the *.download servlet to be able to
access session-scoped managed beans? If so, this can be done. This
wiki page has info on this:
http://wiki.apache.org/myfaces/InvokingJsfPagesWithStandardUrls
Or maybe you mean something else?
Regards,
Simon