WebSphere Portal Server - Servlet serving Attachments

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Portal Server > September 2005 > Servlet serving Attachments





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Servlet serving Attachments

2005-09-21, 5:55 pm

Hi,
I have a portlet which generates content and has a href link in in portletView.jsp to call the servlet to open the attachment in new window ( e.g : http://localhost:9080/FileServletPr...DTest\&authFlag
=Y" target="_blank) This is an href link, everything works fine, the only issue I am having is I cann't get an attribute from Httpsession in the servlet it shows null.

This is what I m doing (using JSR168):
In PortletView.jsp
========================================
========
I create an attribute to put in the Session==> session.setAttribute("getAuth","DVSessionTest");

========================================
========
In Servlet, I want to read that session attribute but I get null. Code in the servlet:
-----------------------------------------------------------
HttpSession httpS = req.getSession();
String name = (String)httpS.getAttribute("getAuth");
----------------------------------------------------------
Any Help would be appreciated on how to get session attribute which is created in the Jsp which is part of the portlet and to retrieve in the servlet which runs as an independant App. I use Websphere Portal V5.1

2005-09-21, 5:55 pm

Can I have a look at your code?

2005-09-21, 5:55 pm

If you need a servlet code send me an email.

-DV
dvpunia@decisionlabs.com

2005-09-21, 5:55 pm

I remember having a similar problem with passing session parameters between servlet and JSR 168 portlet. I think PortletSession supports two scopes for storing session objects Application and portlet.. Use Application scope to refer the variable in servle
t. I will try to search the url which explains this a little better. Hope this helps.

2005-09-22, 9:02 pm

I dont know whether you solved the issue or not. Here is the JSR 168 FAQ link which explains it. http://wiki.java.net/bin/view/Portl...ortlet
_c

2005-09-22, 9:02 pm

Hi kss17,
No I haven't solved the problem yet. I appreciate your response and the article link. I have read the article before and I have tried that approach which works fine for Portlet to Portlet communications. But what I am try to achieve is, invoke a servlet
which runs in a different app but on the same server from the portlet which will open the attachment(e.g pdf, txt ...) in a new window, the servlet and portlet all works but what I need to do on the servlet side is to get some token which will be stored i
n the portlet session through portlet jsp. This session thing doesn't seem to work between portlet and servlet.
-DV
dvpunia@decisionlabs.com

2005-09-22, 9:02 pm

Hmm. Okay. I guess you would have tried to obtain the HttpServletRequest from PortletApiUtils and use HttpSession. Or try to cast the PortletSession to HttpSession in the portlet... And I also didnt look at your earlier post carefully... It says that you
r servlet and portlet are in different web app.. I think this may be the problem.. try to put the servlet in the same webapp and if see if it works.. If this also dosent work then I guess you would need to migrate the servlet to a jsr 168 portlet..

2005-09-23, 2:51 am

I have installed Portal Express and a Crystal Reports Server and I think they solved this issue using a kind of token. Portlet does a login to the webapp (Reports Server), obtains a token and then opens a report (similar to download a file).
Hope this helps. You can find the portlet sample at IBM's portlet catalog (searching for Crystal Reports or Business Objects).
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com