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 Eric Dalquist <ed...@unicon.net> on 2004/06/29 19:19:38 UTC

Downloading files from a portlet

We're trying to find a way for a JSR-168 portlet to implement file 
downloading. Allowing the user to click on a URL generated by the 
portlet and have the portlet able to send arbitrary data (binary or 
otherwise) to the client. We are hoping to a portal agnostic solution so 
the portlets are still portable. We have looked into using an external 
servlet and notifying it of the file via a shared session but since the 
portlet runs within the portal's context and the servlet runs within the 
context the portlet and servlet are deployed to they do not share a 
session. Using get or post parameters or the ServletContext are not 
options since this would not be secure and allow people to bookmark file 
downloads and return without having to log in and allow fishing for 
other user's files.

Has anyone come up with a way for a portlet to send files to a client 
without relying on some portal specific method?

-Eric Dalquist

Re: Downloading files from a portlet

Posted by Eric Dalquist <ed...@unicon.net>.
Yes, and thats the issue. We feel we could implement a uPortal specific 
solution but this seems to be a decent size issue and it would be nice 
if a portal agnostic solution could be created so portlets which allow 
users to download files are portable between portals.

-Eric

Jason Novotny wrote:

>
>    Or rather it's standards compliant but not vendor neutral...big 
> difference ;-)
>
>    Jason
>
> Jason Novotny wrote:
>
>>
>> In the GridSphere portal, a developer wrote a secure directory 
>> servlet that is part of the portlet container and uses the WEB-INF 
>> directory to maintain a virtual user filesystem. We're developing a 
>> collection of utility JSR portlets, but of course the file manager 
>> portlet in this collection is not "compliant" since it requires a 
>> "vendor" service...
>>
>>    Jason
>>
>> Eric Dalquist wrote:
>>
>>> No you can't, I've already tried this. The problem is even though 
>>> the servlet and portlet are deployed to the same context (both in 
>>> the same WAR), the portlet is loaded and run by the portal which is 
>>> most likely going to be in a different context than the portlet and 
>>> the servlet were deployed to, because of this the session is not 
>>> shared. Here is a simple diagram of what happens:
>>>
>>> Deployment
>>>    ContextA
>>>       Portlet1
>>>       Servlet1
>>>    ContextB
>>>       Portal (pretty much a big servlet)
>>>
>>> Execution
>>>    ContextA
>>>       Servlet1
>>>    ContextB
>>>       Portlet1 (it is loaded and executed by the portal so it ends 
>>> up in this context)
>>>       Portal
>>>
>>> -Eric
>>>
>>>
>>> Alejandro Abdelnur wrote:
>>>
>>>> If they are in the same portlet-app you can use the session to 
>>>> share data between the two. Same as 2 servlets in a web app.
>>>>
>>>> A
>>>>
>>>> On Jun 29, 2004, at 2:19 PM, Eric Dalquist wrote:
>>>>
>>>>> How can the portlet communicate the data to the servlet securely? 
>>>>> A portlet and a servlet in the same context do not share a session 
>>>>> since the portlet is actually being executed in the portal's 
>>>>> context. Sending the information the servlet would need to 
>>>>> determine the file to send via get or post is insecure and would 
>>>>> be an easy target for people wanting to look through files 
>>>>> intended for other users. Also there would be no way to ensure the 
>>>>> user getting the file from the servlet is currently authenticated 
>>>>> with the portal.
>>>>>
>>>>> -Eric
>>>>>
>>>>> Alejandro Abdelnur wrote:
>>>>>
>>>>>> Eric,
>>>>>>
>>>>>> Then a portlet is not for the task but a servlet in the same 
>>>>>> portlet app and the portlet would just provide the link to the 
>>>>>> servlet to get the file downloaded.
>>>>>>
>>>>>> HTH
>>>>>>
>>>>>> Alejandro
>>>>>>
>>>>>> On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:
>>>>>>
>>>>>>> Thank you but I'm looking for sending the data the other way. We 
>>>>>>> want the user to be able to download a binary file from an email 
>>>>>>> portlet for an attachment or a file management/document sharing 
>>>>>>> portlet. Uploading is the easy part but we can't seem to find a 
>>>>>>> way to write arbitrary binary data to the user from a JSR-168 
>>>>>>> portlet.
>>>>>>>
>>>>>>> -Eric Dalquist
>>>>>>>
>>>>>>> David Sean Taylor wrote:
>>>>>>>
>>>>>>>>
>>>>>>>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>>>>>>>
>>>>>>>>> We're trying to find a way for a JSR-168 portlet to implement 
>>>>>>>>> file downloading. Allowing the user to click on a URL 
>>>>>>>>> generated by the portlet and have the portlet able to send 
>>>>>>>>> arbitrary data (binary or otherwise) to the client. We are 
>>>>>>>>> hoping to a portal agnostic solution so the portlets are still 
>>>>>>>>> portable. We have looked into using an external servlet and 
>>>>>>>>> notifying it of the file via a shared session but since the 
>>>>>>>>> portlet runs within the portal's context and the servlet runs 
>>>>>>>>> within the context the portlet and servlet are deployed to 
>>>>>>>>> they do not share a session. Using get or post parameters or 
>>>>>>>>> the ServletContext are not options since this would not be 
>>>>>>>>> secure and allow people to bookmark file downloads and return 
>>>>>>>>> without having to log in and allow fishing for other user's 
>>>>>>>>> files.
>>>>>>>>>
>>>>>>>>> Has anyone come up with a way for a portlet to send files to a 
>>>>>>>>> client without relying on some portal specific method?
>>>>>>>>>
>>>>>>>>> -Eric Dalquist
>>>>>>>>>
>>>>>>>>>
>>>>>>>> There is an upload portlet here:
>>>>>>>>
>>>>>>>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>
>>>
>>>
>>
>>
>

Re: Downloading files from a portlet

Posted by Jason Novotny <no...@aei.mpg.de>.
    Or rather it's standards compliant but not vendor neutral...big 
difference ;-)

    Jason

Jason Novotny wrote:

>
> In the GridSphere portal, a developer wrote a secure directory servlet 
> that is part of the portlet container and uses the WEB-INF directory 
> to maintain a virtual user filesystem. We're developing a collection 
> of utility JSR portlets, but of course the file manager portlet in 
> this collection is not "compliant" since it requires a "vendor" 
> service...
>
>    Jason
>
> Eric Dalquist wrote:
>
>> No you can't, I've already tried this. The problem is even though the 
>> servlet and portlet are deployed to the same context (both in the 
>> same WAR), the portlet is loaded and run by the portal which is most 
>> likely going to be in a different context than the portlet and the 
>> servlet were deployed to, because of this the session is not shared. 
>> Here is a simple diagram of what happens:
>>
>> Deployment
>>    ContextA
>>       Portlet1
>>       Servlet1
>>    ContextB
>>       Portal (pretty much a big servlet)
>>
>> Execution
>>    ContextA
>>       Servlet1
>>    ContextB
>>       Portlet1 (it is loaded and executed by the portal so it ends up 
>> in this context)
>>       Portal
>>
>> -Eric
>>
>>
>> Alejandro Abdelnur wrote:
>>
>>> If they are in the same portlet-app you can use the session to share 
>>> data between the two. Same as 2 servlets in a web app.
>>>
>>> A
>>>
>>> On Jun 29, 2004, at 2:19 PM, Eric Dalquist wrote:
>>>
>>>> How can the portlet communicate the data to the servlet securely? A 
>>>> portlet and a servlet in the same context do not share a session 
>>>> since the portlet is actually being executed in the portal's 
>>>> context. Sending the information the servlet would need to 
>>>> determine the file to send via get or post is insecure and would be 
>>>> an easy target for people wanting to look through files intended 
>>>> for other users. Also there would be no way to ensure the user 
>>>> getting the file from the servlet is currently authenticated with 
>>>> the portal.
>>>>
>>>> -Eric
>>>>
>>>> Alejandro Abdelnur wrote:
>>>>
>>>>> Eric,
>>>>>
>>>>> Then a portlet is not for the task but a servlet in the same 
>>>>> portlet app and the portlet would just provide the link to the 
>>>>> servlet to get the file downloaded.
>>>>>
>>>>> HTH
>>>>>
>>>>> Alejandro
>>>>>
>>>>> On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:
>>>>>
>>>>>> Thank you but I'm looking for sending the data the other way. We 
>>>>>> want the user to be able to download a binary file from an email 
>>>>>> portlet for an attachment or a file management/document sharing 
>>>>>> portlet. Uploading is the easy part but we can't seem to find a 
>>>>>> way to write arbitrary binary data to the user from a JSR-168 
>>>>>> portlet.
>>>>>>
>>>>>> -Eric Dalquist
>>>>>>
>>>>>> David Sean Taylor wrote:
>>>>>>
>>>>>>>
>>>>>>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>>>>>>
>>>>>>>> We're trying to find a way for a JSR-168 portlet to implement 
>>>>>>>> file downloading. Allowing the user to click on a URL generated 
>>>>>>>> by the portlet and have the portlet able to send arbitrary data 
>>>>>>>> (binary or otherwise) to the client. We are hoping to a portal 
>>>>>>>> agnostic solution so the portlets are still portable. We have 
>>>>>>>> looked into using an external servlet and notifying it of the 
>>>>>>>> file via a shared session but since the portlet runs within the 
>>>>>>>> portal's context and the servlet runs within the context the 
>>>>>>>> portlet and servlet are deployed to they do not share a 
>>>>>>>> session. Using get or post parameters or the ServletContext are 
>>>>>>>> not options since this would not be secure and allow people to 
>>>>>>>> bookmark file downloads and return without having to log in and 
>>>>>>>> allow fishing for other user's files.
>>>>>>>>
>>>>>>>> Has anyone come up with a way for a portlet to send files to a 
>>>>>>>> client without relying on some portal specific method?
>>>>>>>>
>>>>>>>> -Eric Dalquist
>>>>>>>>
>>>>>>>>
>>>>>>> There is an upload portlet here:
>>>>>>>
>>>>>>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>>>>>>
>>>>>>>
>>>>>
>>>
>>
>>
>
>


Re: Downloading files from a portlet

Posted by Jason Novotny <no...@aei.mpg.de>.
In the GridSphere portal, a developer wrote a secure directory servlet 
that is part of the portlet container and uses the WEB-INF directory to 
maintain a virtual user filesystem. We're developing a collection of 
utility JSR portlets, but of course the file manager portlet in this 
collection is not "compliant" since it requires a "vendor" service...

    Jason

Eric Dalquist wrote:

> No you can't, I've already tried this. The problem is even though the 
> servlet and portlet are deployed to the same context (both in the same 
> WAR), the portlet is loaded and run by the portal which is most likely 
> going to be in a different context than the portlet and the servlet 
> were deployed to, because of this the session is not shared. Here is a 
> simple diagram of what happens:
>
> Deployment
>    ContextA
>       Portlet1
>       Servlet1
>    ContextB
>       Portal (pretty much a big servlet)
>
> Execution
>    ContextA
>       Servlet1
>    ContextB
>       Portlet1 (it is loaded and executed by the portal so it ends up 
> in this context)
>       Portal
>
> -Eric
>
>
> Alejandro Abdelnur wrote:
>
>> If they are in the same portlet-app you can use the session to share 
>> data between the two. Same as 2 servlets in a web app.
>>
>> A
>>
>> On Jun 29, 2004, at 2:19 PM, Eric Dalquist wrote:
>>
>>> How can the portlet communicate the data to the servlet securely? A 
>>> portlet and a servlet in the same context do not share a session 
>>> since the portlet is actually being executed in the portal's 
>>> context. Sending the information the servlet would need to determine 
>>> the file to send via get or post is insecure and would be an easy 
>>> target for people wanting to look through files intended for other 
>>> users. Also there would be no way to ensure the user getting the 
>>> file from the servlet is currently authenticated with the portal.
>>>
>>> -Eric
>>>
>>> Alejandro Abdelnur wrote:
>>>
>>>> Eric,
>>>>
>>>> Then a portlet is not for the task but a servlet in the same 
>>>> portlet app and the portlet would just provide the link to the 
>>>> servlet to get the file downloaded.
>>>>
>>>> HTH
>>>>
>>>> Alejandro
>>>>
>>>> On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:
>>>>
>>>>> Thank you but I'm looking for sending the data the other way. We 
>>>>> want the user to be able to download a binary file from an email 
>>>>> portlet for an attachment or a file management/document sharing 
>>>>> portlet. Uploading is the easy part but we can't seem to find a 
>>>>> way to write arbitrary binary data to the user from a JSR-168 
>>>>> portlet.
>>>>>
>>>>> -Eric Dalquist
>>>>>
>>>>> David Sean Taylor wrote:
>>>>>
>>>>>>
>>>>>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>>>>>
>>>>>>> We're trying to find a way for a JSR-168 portlet to implement 
>>>>>>> file downloading. Allowing the user to click on a URL generated 
>>>>>>> by the portlet and have the portlet able to send arbitrary data 
>>>>>>> (binary or otherwise) to the client. We are hoping to a portal 
>>>>>>> agnostic solution so the portlets are still portable. We have 
>>>>>>> looked into using an external servlet and notifying it of the 
>>>>>>> file via a shared session but since the portlet runs within the 
>>>>>>> portal's context and the servlet runs within the context the 
>>>>>>> portlet and servlet are deployed to they do not share a session. 
>>>>>>> Using get or post parameters or the ServletContext are not 
>>>>>>> options since this would not be secure and allow people to 
>>>>>>> bookmark file downloads and return without having to log in and 
>>>>>>> allow fishing for other user's files.
>>>>>>>
>>>>>>> Has anyone come up with a way for a portlet to send files to a 
>>>>>>> client without relying on some portal specific method?
>>>>>>>
>>>>>>> -Eric Dalquist
>>>>>>>
>>>>>>>
>>>>>> There is an upload portlet here:
>>>>>>
>>>>>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>>>>>
>>>>>>
>>>>
>>
>
>


Re: Downloading files from a portlet

Posted by Eric Dalquist <ed...@unicon.net>.
A point of confusion we may be encountering is exactly how the servlet 
is accessed. I'm not talking about a servlet that is dispatched to by 
the portlet. I'm talking about a servlet that is being accessed directly 
by the user.

I have put a simple example portlet and servlet application up at 
http://www.unicon.net/download/PortletSessionTest.war (it will only 
remain there for a few weeks). It just needs to be deployed into the 
container (in Pluto's case the command is at the bottom of this page 
http://portals.apache.org/pluto/install.html ).

The example portlet simply displays the session ID from the 
PortletSession and underlying HttpSession from the portlet's point of 
view. It also creates a link to a servlet deployed in the same web 
application. The URL for the servlet is created by calling 
getPortletContextName on the PortletContext and appending the known name 
of the servlet. The session id from the portlet is passed via a URL 
parameter and the servlet displays the session ID it gets from calling 
HttpSession.getId() and also the session ID from the portlet for 
comparison.

On our tomcat 5.0.18 and uPortal installation and on our test Pluto 
installation the session ID displayed for the servlet is different than 
the session ID of the portlet.

-Eric Dalquist

Alejandro Abdelnur wrote:

> Eric,
>
> The spec defines the portlet-container, portlet API, contract between 
> the two and the deployment unit (from yesterday's J1 session :). It 
> does not define anything about the portal.
>
> I know of implementations where the portal is another web-app with 
> cross-context turned on to allow the portal to execute a servlet in 
> other webapps which in turn goes for the portlet. I also know of 
> implementations that inject all portal logic into the portlet-app at 
> deployment and the portal page can only contain portlets within that 
> portletapp.
>
> A
>
> On Jun 30, 2004, at 8:56 AM, Eric Dalquist wrote:
>
>> That makes sense but what is happening in our case is even though pA 
>> and sA are both deployed to PA via the same WAR during execution pA 
>> is loaded and executed by the portal which is in it's own context. 
>> Because of that pA is actually running in the same context as the 
>> portal. When the servlet is it is running in the PA context as it 
>> should be. That would be the problem, the portlet is running in the 
>> portal's context because it is loaded and executed by the portal but 
>> the the servlet is running in the context is was deployed to as it 
>> should be.
>>
>> Now it looks like the spec says that the portlet should actually be 
>> running in it's own context so it's session can be shared with other 
>> portlets/servlets/JSPs running in the same context. This would imply 
>> that the portlet's session and the portal's session should be two 
>> different sessions unless there is a way to seamlessly share a 
>> session between two contexts.
>>
>> -Eric
>>
>> Alejandro Abdelnur wrote:
>>
>>> Eric,
>>>
>>> I may be missing something in all this discussion. Unless your 
>>> portlet-app and portal-all are in the same web-app they don't share 
>>> the context/session. But from what it was described before (at least 
>>> my understanding) the idea was to have a portlet and a servlet, both 
>>> in the same portlet-app to share data through the session, this is 
>>> possible. If they are not in the same portlet-app, then the 
>>> portlet-spec does not provide facilities for that, you could do it, 
>>> but on the side, no through the portlet container. My point in my 
>>> previous answer was: If you deploy a portlet-app PA containing 
>>> portlet pA and servlet sA, at runtime pA and sA should be in the 
>>> same application context thus they would be able to share data 
>>> through the session.
>>>
>>> A
>>>
>>> On Jun 30, 2004, at 8:37 AM, Eric Dalquist wrote:
>>>
>>>> Thank you for the information we will look into why our session is 
>>>> not getting shared between the portlet's context and the portal's 
>>>> context.
>>>>
>>>> -Eric Dalquist
>>>>
>>>> Alejandro Abdelnur wrote:
>>>>
>>>>> All web components in a portlet application (servlets, JSPs and 
>>>>> portlets) must be run within the same application context.
>>>>>
>>>>> PLT.10: "The PortletContext interface defines a portlet’s view of 
>>>>> the portlet application within which the portlet is running. Using 
>>>>> the PortletContext object, a portlet can log events, obtain 
>>>>> portlet application resources, and set and store attributes that 
>>>>> other portlets and servlets in the portlet application can access."
>>>>>
>>>>> PLT.15.4: "A Portlet Application is also a Web Application. The 
>>>>> Portlet Application may contain servlets and JSPs in addition to 
>>>>> portlets. Portlets, servlets and JSPs may share information 5 
>>>>> through their session."
>>>>>
>>>>> If you are deploying a set of portlets, servlets and JSPs as a 
>>>>> portlet application the runtime/execution environment should not 
>>>>> break them up. If that is happening that is wrong.
>>>>>
>>>>> Alejandro
>>>>>
>>>>> On Jun 29, 2004, at 2:55 PM, Eric Dalquist wrote:
>>>>>
>>>>>> No you can't, I've already tried this. The problem is even though 
>>>>>> the servlet and portlet are deployed to the same context (both in 
>>>>>> the same WAR), the portlet is loaded and run by the portal which 
>>>>>> is most likely going to be in a different context than the 
>>>>>> portlet and the servlet were deployed to, because of this the 
>>>>>> session is not shared. Here is a simple diagram of what happens:
>>>>>>
>>>>>> Deployment
>>>>>>    ContextA
>>>>>>       Portlet1
>>>>>>       Servlet1
>>>>>>    ContextB
>>>>>>       Portal (pretty much a big servlet)
>>>>>>
>>>>>> Execution
>>>>>>    ContextA
>>>>>>       Servlet1
>>>>>>    ContextB
>>>>>>       Portlet1 (it is loaded and executed by the portal so it 
>>>>>> ends up in this context)
>>>>>>       Portal
>>>>>>
>>>>>> -Eric
>>>>>>
>>>>>>
>>>>>> Alejandro Abdelnur wrote:
>>>>>>
>>>>>>> If they are in the same portlet-app you can use the session to 
>>>>>>> share data between the two. Same as 2 servlets in a web app.
>>>>>>>
>>>>>>> A
>>>>>>>
>>>>>>> On Jun 29, 2004, at 2:19 PM, Eric Dalquist wrote:
>>>>>>>
>>>>>>>> How can the portlet communicate the data to the servlet 
>>>>>>>> securely? A portlet and a servlet in the same context do not 
>>>>>>>> share a session since the portlet is actually being executed in 
>>>>>>>> the portal's context. Sending the information the servlet would 
>>>>>>>> need to determine the file to send via get or post is insecure 
>>>>>>>> and would be an easy target for people wanting to look through 
>>>>>>>> files intended for other users. Also there would be no way to 
>>>>>>>> ensure the user getting the file from the servlet is currently 
>>>>>>>> authenticated with the portal.
>>>>>>>>
>>>>>>>> -Eric
>>>>>>>>
>>>>>>>> Alejandro Abdelnur wrote:
>>>>>>>>
>>>>>>>>> Eric,
>>>>>>>>>
>>>>>>>>> Then a portlet is not for the task but a servlet in the same 
>>>>>>>>> portlet app and the portlet would just provide the link to the 
>>>>>>>>> servlet to get the file downloaded.
>>>>>>>>>
>>>>>>>>> HTH
>>>>>>>>>
>>>>>>>>> Alejandro
>>>>>>>>>
>>>>>>>>> On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:
>>>>>>>>>
>>>>>>>>>> Thank you but I'm looking for sending the data the other way. 
>>>>>>>>>> We want the user to be able to download a binary file from an 
>>>>>>>>>> email portlet for an attachment or a file management/document 
>>>>>>>>>> sharing portlet. Uploading is the easy part but we can't seem 
>>>>>>>>>> to find a way to write arbitrary binary data to the user from 
>>>>>>>>>> a JSR-168 portlet.
>>>>>>>>>>
>>>>>>>>>> -Eric Dalquist
>>>>>>>>>>
>>>>>>>>>> David Sean Taylor wrote:
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>>>>>>>>>>
>>>>>>>>>>>> We're trying to find a way for a JSR-168 portlet to 
>>>>>>>>>>>> implement file downloading. Allowing the user to click on a 
>>>>>>>>>>>> URL generated by the portlet and have the portlet able to 
>>>>>>>>>>>> send arbitrary data (binary or otherwise) to the client. We 
>>>>>>>>>>>> are hoping to a portal agnostic solution so the portlets 
>>>>>>>>>>>> are still portable. We have looked into using an external 
>>>>>>>>>>>> servlet and notifying it of the file via a shared session 
>>>>>>>>>>>> but since the portlet runs within the portal's context and 
>>>>>>>>>>>> the servlet runs within the context the portlet and servlet 
>>>>>>>>>>>> are deployed to they do not share a session. Using get or 
>>>>>>>>>>>> post parameters or the ServletContext are not options since 
>>>>>>>>>>>> this would not be secure and allow people to bookmark file 
>>>>>>>>>>>> downloads and return without having to log in and allow 
>>>>>>>>>>>> fishing for other user's files.
>>>>>>>>>>>>
>>>>>>>>>>>> Has anyone come up with a way for a portlet to send files 
>>>>>>>>>>>> to a client without relying on some portal specific method?
>>>>>>>>>>>>
>>>>>>>>>>>> -Eric Dalquist
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>> There is an upload portlet here:
>>>>>>>>>>>
>>>>>>>>>>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>

====
This message and any attachments are confidential. Unauthorized use
or disclosure of this message is strictly prohibited, and this message
must be destroyed immediately if received by an unauthorized recipient.
====




Re: Downloading files from a portlet

Posted by Alejandro Abdelnur <Al...@Sun.COM>.
Eric,

The spec defines the portlet-container, portlet API, contract between 
the two and the deployment unit (from yesterday's J1 session :). It 
does not define anything about the portal.

I know of implementations where the portal is another web-app with 
cross-context turned on to allow the portal to execute a servlet in 
other webapps which in turn goes for the portlet. I also know of 
implementations that inject all portal logic into the portlet-app at 
deployment and the portal page can only contain portlets within that 
portletapp.

A

On Jun 30, 2004, at 8:56 AM, Eric Dalquist wrote:

> That makes sense but what is happening in our case is even though pA 
> and sA are both deployed to PA via the same WAR during execution pA is 
> loaded and executed by the portal which is in it's own context. 
> Because of that pA is actually running in the same context as the 
> portal. When the servlet is it is running in the PA context as it 
> should be. That would be the problem, the portlet is running in the 
> portal's context because it is loaded and executed by the portal but 
> the the servlet is running in the context is was deployed to as it 
> should be.
>
> Now it looks like the spec says that the portlet should actually be 
> running in it's own context so it's session can be shared with other 
> portlets/servlets/JSPs running in the same context. This would imply 
> that the portlet's session and the portal's session should be two 
> different sessions unless there is a way to seamlessly share a session 
> between two contexts.
>
> -Eric
>
> Alejandro Abdelnur wrote:
>
>> Eric,
>>
>> I may be missing something in all this discussion. Unless your 
>> portlet-app and portal-all are in the same web-app they don't share 
>> the context/session. But from what it was described before (at least 
>> my understanding) the idea was to have a portlet and a servlet, both 
>> in the same portlet-app to share data through the session, this is 
>> possible. If they are not in the same portlet-app, then the 
>> portlet-spec does not provide facilities for that, you could do it, 
>> but on the side, no through the portlet container. My point in my 
>> previous answer was: If you deploy a portlet-app PA containing 
>> portlet pA and servlet sA, at runtime pA and sA should be in the same 
>> application context thus they would be able to share data through the 
>> session.
>>
>> A
>>
>> On Jun 30, 2004, at 8:37 AM, Eric Dalquist wrote:
>>
>>> Thank you for the information we will look into why our session is 
>>> not getting shared between the portlet's context and the portal's 
>>> context.
>>>
>>> -Eric Dalquist
>>>
>>> Alejandro Abdelnur wrote:
>>>
>>>> All web components in a portlet application (servlets, JSPs and 
>>>> portlets) must be run within the same application context.
>>>>
>>>> PLT.10: "The PortletContext interface defines a portlet’s view of 
>>>> the portlet application within which the portlet is running. Using 
>>>> the PortletContext object, a portlet can log events, obtain portlet 
>>>> application resources, and set and store attributes that other 
>>>> portlets and servlets in the portlet application can access."
>>>>
>>>> PLT.15.4: "A Portlet Application is also a Web Application. The 
>>>> Portlet Application may contain servlets and JSPs in addition to 
>>>> portlets. Portlets, servlets and JSPs may share information 5 
>>>> through their session."
>>>>
>>>> If you are deploying a set of portlets, servlets and JSPs as a 
>>>> portlet application the runtime/execution environment should not 
>>>> break them up. If that is happening that is wrong.
>>>>
>>>> Alejandro
>>>>
>>>> On Jun 29, 2004, at 2:55 PM, Eric Dalquist wrote:
>>>>
>>>>> No you can't, I've already tried this. The problem is even though 
>>>>> the servlet and portlet are deployed to the same context (both in 
>>>>> the same WAR), the portlet is loaded and run by the portal which 
>>>>> is most likely going to be in a different context than the portlet 
>>>>> and the servlet were deployed to, because of this the session is 
>>>>> not shared. Here is a simple diagram of what happens:
>>>>>
>>>>> Deployment
>>>>>    ContextA
>>>>>       Portlet1
>>>>>       Servlet1
>>>>>    ContextB
>>>>>       Portal (pretty much a big servlet)
>>>>>
>>>>> Execution
>>>>>    ContextA
>>>>>       Servlet1
>>>>>    ContextB
>>>>>       Portlet1 (it is loaded and executed by the portal so it ends 
>>>>> up in this context)
>>>>>       Portal
>>>>>
>>>>> -Eric
>>>>>
>>>>>
>>>>> Alejandro Abdelnur wrote:
>>>>>
>>>>>> If they are in the same portlet-app you can use the session to 
>>>>>> share data between the two. Same as 2 servlets in a web app.
>>>>>>
>>>>>> A
>>>>>>
>>>>>> On Jun 29, 2004, at 2:19 PM, Eric Dalquist wrote:
>>>>>>
>>>>>>> How can the portlet communicate the data to the servlet 
>>>>>>> securely? A portlet and a servlet in the same context do not 
>>>>>>> share a session since the portlet is actually being executed in 
>>>>>>> the portal's context. Sending the information the servlet would 
>>>>>>> need to determine the file to send via get or post is insecure 
>>>>>>> and would be an easy target for people wanting to look through 
>>>>>>> files intended for other users. Also there would be no way to 
>>>>>>> ensure the user getting the file from the servlet is currently 
>>>>>>> authenticated with the portal.
>>>>>>>
>>>>>>> -Eric
>>>>>>>
>>>>>>> Alejandro Abdelnur wrote:
>>>>>>>
>>>>>>>> Eric,
>>>>>>>>
>>>>>>>> Then a portlet is not for the task but a servlet in the same 
>>>>>>>> portlet app and the portlet would just provide the link to the 
>>>>>>>> servlet to get the file downloaded.
>>>>>>>>
>>>>>>>> HTH
>>>>>>>>
>>>>>>>> Alejandro
>>>>>>>>
>>>>>>>> On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:
>>>>>>>>
>>>>>>>>> Thank you but I'm looking for sending the data the other way. 
>>>>>>>>> We want the user to be able to download a binary file from an 
>>>>>>>>> email portlet for an attachment or a file management/document 
>>>>>>>>> sharing portlet. Uploading is the easy part but we can't seem 
>>>>>>>>> to find a way to write arbitrary binary data to the user from 
>>>>>>>>> a JSR-168 portlet.
>>>>>>>>>
>>>>>>>>> -Eric Dalquist
>>>>>>>>>
>>>>>>>>> David Sean Taylor wrote:
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>>>>>>>>>
>>>>>>>>>>> We're trying to find a way for a JSR-168 portlet to 
>>>>>>>>>>> implement file downloading. Allowing the user to click on a 
>>>>>>>>>>> URL generated by the portlet and have the portlet able to 
>>>>>>>>>>> send arbitrary data (binary or otherwise) to the client. We 
>>>>>>>>>>> are hoping to a portal agnostic solution so the portlets are 
>>>>>>>>>>> still portable. We have looked into using an external 
>>>>>>>>>>> servlet and notifying it of the file via a shared session 
>>>>>>>>>>> but since the portlet runs within the portal's context and 
>>>>>>>>>>> the servlet runs within the context the portlet and servlet 
>>>>>>>>>>> are deployed to they do not share a session. Using get or 
>>>>>>>>>>> post parameters or the ServletContext are not options since 
>>>>>>>>>>> this would not be secure and allow people to bookmark file 
>>>>>>>>>>> downloads and return without having to log in and allow 
>>>>>>>>>>> fishing for other user's files.
>>>>>>>>>>>
>>>>>>>>>>> Has anyone come up with a way for a portlet to send files to 
>>>>>>>>>>> a client without relying on some portal specific method?
>>>>>>>>>>>
>>>>>>>>>>> -Eric Dalquist
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> There is an upload portlet here:
>>>>>>>>>>
>>>>>>>>>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>
>>>>
>>>>
>>
>>


Re: Downloading files from a portlet

Posted by Eric Dalquist <ed...@unicon.net>.
That makes sense but what is happening in our case is even though pA and 
sA are both deployed to PA via the same WAR during execution pA is 
loaded and executed by the portal which is in it's own context. Because 
of that pA is actually running in the same context as the portal. When 
the servlet is it is running in the PA context as it should be. That 
would be the problem, the portlet is running in the portal's context 
because it is loaded and executed by the portal but the the servlet is 
running in the context is was deployed to as it should be.

Now it looks like the spec says that the portlet should actually be 
running in it's own context so it's session can be shared with other 
portlets/servlets/JSPs running in the same context. This would imply 
that the portlet's session and the portal's session should be two 
different sessions unless there is a way to seamlessly share a session 
between two contexts.

-Eric

Alejandro Abdelnur wrote:

> Eric,
>
> I may be missing something in all this discussion. Unless your 
> portlet-app and portal-all are in the same web-app they don't share 
> the context/session. But from what it was described before (at least 
> my understanding) the idea was to have a portlet and a servlet, both 
> in the same portlet-app to share data through the session, this is 
> possible. If they are not in the same portlet-app, then the 
> portlet-spec does not provide facilities for that, you could do it, 
> but on the side, no through the portlet container. My point in my 
> previous answer was: If you deploy a portlet-app PA containing portlet 
> pA and servlet sA, at runtime pA and sA should be in the same 
> application context thus they would be able to share data through the 
> session.
>
> A
>
> On Jun 30, 2004, at 8:37 AM, Eric Dalquist wrote:
>
>> Thank you for the information we will look into why our session is 
>> not getting shared between the portlet's context and the portal's 
>> context.
>>
>> -Eric Dalquist
>>
>> Alejandro Abdelnur wrote:
>>
>>> All web components in a portlet application (servlets, JSPs and 
>>> portlets) must be run within the same application context.
>>>
>>> PLT.10: "The PortletContext interface defines a portlet’s view of 
>>> the portlet application within which the portlet is running. Using 
>>> the PortletContext object, a portlet can log events, obtain portlet 
>>> application resources, and set and store attributes that other 
>>> portlets and servlets in the portlet application can access."
>>>
>>> PLT.15.4: "A Portlet Application is also a Web Application. The 
>>> Portlet Application may contain servlets and JSPs in addition to 
>>> portlets. Portlets, servlets and JSPs may share information 5 
>>> through their session."
>>>
>>> If you are deploying a set of portlets, servlets and JSPs as a 
>>> portlet application the runtime/execution environment should not 
>>> break them up. If that is happening that is wrong.
>>>
>>> Alejandro
>>>
>>> On Jun 29, 2004, at 2:55 PM, Eric Dalquist wrote:
>>>
>>>> No you can't, I've already tried this. The problem is even though 
>>>> the servlet and portlet are deployed to the same context (both in 
>>>> the same WAR), the portlet is loaded and run by the portal which is 
>>>> most likely going to be in a different context than the portlet and 
>>>> the servlet were deployed to, because of this the session is not 
>>>> shared. Here is a simple diagram of what happens:
>>>>
>>>> Deployment
>>>>    ContextA
>>>>       Portlet1
>>>>       Servlet1
>>>>    ContextB
>>>>       Portal (pretty much a big servlet)
>>>>
>>>> Execution
>>>>    ContextA
>>>>       Servlet1
>>>>    ContextB
>>>>       Portlet1 (it is loaded and executed by the portal so it ends 
>>>> up in this context)
>>>>       Portal
>>>>
>>>> -Eric
>>>>
>>>>
>>>> Alejandro Abdelnur wrote:
>>>>
>>>>> If they are in the same portlet-app you can use the session to 
>>>>> share data between the two. Same as 2 servlets in a web app.
>>>>>
>>>>> A
>>>>>
>>>>> On Jun 29, 2004, at 2:19 PM, Eric Dalquist wrote:
>>>>>
>>>>>> How can the portlet communicate the data to the servlet securely? 
>>>>>> A portlet and a servlet in the same context do not share a 
>>>>>> session since the portlet is actually being executed in the 
>>>>>> portal's context. Sending the information the servlet would need 
>>>>>> to determine the file to send via get or post is insecure and 
>>>>>> would be an easy target for people wanting to look through files 
>>>>>> intended for other users. Also there would be no way to ensure 
>>>>>> the user getting the file from the servlet is currently 
>>>>>> authenticated with the portal.
>>>>>>
>>>>>> -Eric
>>>>>>
>>>>>> Alejandro Abdelnur wrote:
>>>>>>
>>>>>>> Eric,
>>>>>>>
>>>>>>> Then a portlet is not for the task but a servlet in the same 
>>>>>>> portlet app and the portlet would just provide the link to the 
>>>>>>> servlet to get the file downloaded.
>>>>>>>
>>>>>>> HTH
>>>>>>>
>>>>>>> Alejandro
>>>>>>>
>>>>>>> On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:
>>>>>>>
>>>>>>>> Thank you but I'm looking for sending the data the other way. 
>>>>>>>> We want the user to be able to download a binary file from an 
>>>>>>>> email portlet for an attachment or a file management/document 
>>>>>>>> sharing portlet. Uploading is the easy part but we can't seem 
>>>>>>>> to find a way to write arbitrary binary data to the user from a 
>>>>>>>> JSR-168 portlet.
>>>>>>>>
>>>>>>>> -Eric Dalquist
>>>>>>>>
>>>>>>>> David Sean Taylor wrote:
>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>>>>>>>>
>>>>>>>>>> We're trying to find a way for a JSR-168 portlet to implement 
>>>>>>>>>> file downloading. Allowing the user to click on a URL 
>>>>>>>>>> generated by the portlet and have the portlet able to send 
>>>>>>>>>> arbitrary data (binary or otherwise) to the client. We are 
>>>>>>>>>> hoping to a portal agnostic solution so the portlets are 
>>>>>>>>>> still portable. We have looked into using an external servlet 
>>>>>>>>>> and notifying it of the file via a shared session but since 
>>>>>>>>>> the portlet runs within the portal's context and the servlet 
>>>>>>>>>> runs within the context the portlet and servlet are deployed 
>>>>>>>>>> to they do not share a session. Using get or post parameters 
>>>>>>>>>> or the ServletContext are not options since this would not be 
>>>>>>>>>> secure and allow people to bookmark file downloads and return 
>>>>>>>>>> without having to log in and allow fishing for other user's 
>>>>>>>>>> files.
>>>>>>>>>>
>>>>>>>>>> Has anyone come up with a way for a portlet to send files to 
>>>>>>>>>> a client without relying on some portal specific method?
>>>>>>>>>>
>>>>>>>>>> -Eric Dalquist
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> There is an upload portlet here:
>>>>>>>>>
>>>>>>>>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>
>>>
>>>
>
>

Re: Downloading files from a portlet

Posted by Alejandro Abdelnur <Al...@Sun.COM>.
Eric,

I may be missing something in all this discussion. Unless your 
portlet-app and portal-all are in the same web-app they don't share the 
context/session. But from what it was described before (at least my 
understanding) the idea was to have a portlet and a servlet, both in 
the same portlet-app to share data through the session, this is 
possible. If they are not in the same portlet-app, then the 
portlet-spec does not provide facilities for that, you could do it, but 
on the side, no through the portlet container. My point in my previous 
answer was: If you deploy a portlet-app PA containing portlet pA and 
servlet sA, at runtime pA and sA should be in the same application 
context thus they would be able to share data through the session.

A

On Jun 30, 2004, at 8:37 AM, Eric Dalquist wrote:

> Thank you for the information we will look into why our session is not 
> getting shared between the portlet's context and the portal's context.
>
> -Eric Dalquist
>
> Alejandro Abdelnur wrote:
>
>> All web components in a portlet application (servlets, JSPs and 
>> portlets) must be run within the same application context.
>>
>> PLT.10: "The PortletContext interface defines a portlet’s view of the 
>> portlet application within which the portlet is running. Using the 
>> PortletContext object, a portlet can log events, obtain portlet 
>> application resources, and set and store attributes that other 
>> portlets and servlets in the portlet application can access."
>>
>> PLT.15.4: "A Portlet Application is also a Web Application. The 
>> Portlet Application may contain servlets and JSPs in addition to 
>> portlets. Portlets, servlets and JSPs may share information 5 through 
>> their session."
>>
>> If you are deploying a set of portlets, servlets and JSPs as a 
>> portlet application the runtime/execution environment should not 
>> break them up. If that is happening that is wrong.
>>
>> Alejandro
>>
>> On Jun 29, 2004, at 2:55 PM, Eric Dalquist wrote:
>>
>>> No you can't, I've already tried this. The problem is even though 
>>> the servlet and portlet are deployed to the same context (both in 
>>> the same WAR), the portlet is loaded and run by the portal which is 
>>> most likely going to be in a different context than the portlet and 
>>> the servlet were deployed to, because of this the session is not 
>>> shared. Here is a simple diagram of what happens:
>>>
>>> Deployment
>>>    ContextA
>>>       Portlet1
>>>       Servlet1
>>>    ContextB
>>>       Portal (pretty much a big servlet)
>>>
>>> Execution
>>>    ContextA
>>>       Servlet1
>>>    ContextB
>>>       Portlet1 (it is loaded and executed by the portal so it ends 
>>> up in this context)
>>>       Portal
>>>
>>> -Eric
>>>
>>>
>>> Alejandro Abdelnur wrote:
>>>
>>>> If they are in the same portlet-app you can use the session to 
>>>> share data between the two. Same as 2 servlets in a web app.
>>>>
>>>> A
>>>>
>>>> On Jun 29, 2004, at 2:19 PM, Eric Dalquist wrote:
>>>>
>>>>> How can the portlet communicate the data to the servlet securely? 
>>>>> A portlet and a servlet in the same context do not share a session 
>>>>> since the portlet is actually being executed in the portal's 
>>>>> context. Sending the information the servlet would need to 
>>>>> determine the file to send via get or post is insecure and would 
>>>>> be an easy target for people wanting to look through files 
>>>>> intended for other users. Also there would be no way to ensure the 
>>>>> user getting the file from the servlet is currently authenticated 
>>>>> with the portal.
>>>>>
>>>>> -Eric
>>>>>
>>>>> Alejandro Abdelnur wrote:
>>>>>
>>>>>> Eric,
>>>>>>
>>>>>> Then a portlet is not for the task but a servlet in the same 
>>>>>> portlet app and the portlet would just provide the link to the 
>>>>>> servlet to get the file downloaded.
>>>>>>
>>>>>> HTH
>>>>>>
>>>>>> Alejandro
>>>>>>
>>>>>> On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:
>>>>>>
>>>>>>> Thank you but I'm looking for sending the data the other way. We 
>>>>>>> want the user to be able to download a binary file from an email 
>>>>>>> portlet for an attachment or a file management/document sharing 
>>>>>>> portlet. Uploading is the easy part but we can't seem to find a 
>>>>>>> way to write arbitrary binary data to the user from a JSR-168 
>>>>>>> portlet.
>>>>>>>
>>>>>>> -Eric Dalquist
>>>>>>>
>>>>>>> David Sean Taylor wrote:
>>>>>>>
>>>>>>>>
>>>>>>>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>>>>>>>
>>>>>>>>> We're trying to find a way for a JSR-168 portlet to implement 
>>>>>>>>> file downloading. Allowing the user to click on a URL 
>>>>>>>>> generated by the portlet and have the portlet able to send 
>>>>>>>>> arbitrary data (binary or otherwise) to the client. We are 
>>>>>>>>> hoping to a portal agnostic solution so the portlets are still 
>>>>>>>>> portable. We have looked into using an external servlet and 
>>>>>>>>> notifying it of the file via a shared session but since the 
>>>>>>>>> portlet runs within the portal's context and the servlet runs 
>>>>>>>>> within the context the portlet and servlet are deployed to 
>>>>>>>>> they do not share a session. Using get or post parameters or 
>>>>>>>>> the ServletContext are not options since this would not be 
>>>>>>>>> secure and allow people to bookmark file downloads and return 
>>>>>>>>> without having to log in and allow fishing for other user's 
>>>>>>>>> files.
>>>>>>>>>
>>>>>>>>> Has anyone come up with a way for a portlet to send files to a 
>>>>>>>>> client without relying on some portal specific method?
>>>>>>>>>
>>>>>>>>> -Eric Dalquist
>>>>>>>>>
>>>>>>>>>
>>>>>>>> There is an upload portlet here:
>>>>>>>>
>>>>>>>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>
>>
>>


Re: Downloading files from a portlet

Posted by Eric Dalquist <ed...@unicon.net>.
Thank you for the information we will look into why our session is not 
getting shared between the portlet's context and the portal's context.

-Eric Dalquist

Alejandro Abdelnur wrote:

> All web components in a portlet application (servlets, JSPs and 
> portlets) must be run within the same application context.
>
> PLT.10: "The PortletContext interface defines a portlet’s view of the 
> portlet application within which the portlet is running. Using the 
> PortletContext object, a portlet can log events, obtain portlet 
> application resources, and set and store attributes that other 
> portlets and servlets in the portlet application can access."
>
> PLT.15.4: "A Portlet Application is also a Web Application. The 
> Portlet Application may contain servlets and JSPs in addition to 
> portlets. Portlets, servlets and JSPs may share information 5 through 
> their session."
>
> If you are deploying a set of portlets, servlets and JSPs as a portlet 
> application the runtime/execution environment should not break them 
> up. If that is happening that is wrong.
>
> Alejandro
>
> On Jun 29, 2004, at 2:55 PM, Eric Dalquist wrote:
>
>> No you can't, I've already tried this. The problem is even though the 
>> servlet and portlet are deployed to the same context (both in the 
>> same WAR), the portlet is loaded and run by the portal which is most 
>> likely going to be in a different context than the portlet and the 
>> servlet were deployed to, because of this the session is not shared. 
>> Here is a simple diagram of what happens:
>>
>> Deployment
>>    ContextA
>>       Portlet1
>>       Servlet1
>>    ContextB
>>       Portal (pretty much a big servlet)
>>
>> Execution
>>    ContextA
>>       Servlet1
>>    ContextB
>>       Portlet1 (it is loaded and executed by the portal so it ends up 
>> in this context)
>>       Portal
>>
>> -Eric
>>
>>
>> Alejandro Abdelnur wrote:
>>
>>> If they are in the same portlet-app you can use the session to share 
>>> data between the two. Same as 2 servlets in a web app.
>>>
>>> A
>>>
>>> On Jun 29, 2004, at 2:19 PM, Eric Dalquist wrote:
>>>
>>>> How can the portlet communicate the data to the servlet securely? A 
>>>> portlet and a servlet in the same context do not share a session 
>>>> since the portlet is actually being executed in the portal's 
>>>> context. Sending the information the servlet would need to 
>>>> determine the file to send via get or post is insecure and would be 
>>>> an easy target for people wanting to look through files intended 
>>>> for other users. Also there would be no way to ensure the user 
>>>> getting the file from the servlet is currently authenticated with 
>>>> the portal.
>>>>
>>>> -Eric
>>>>
>>>> Alejandro Abdelnur wrote:
>>>>
>>>>> Eric,
>>>>>
>>>>> Then a portlet is not for the task but a servlet in the same 
>>>>> portlet app and the portlet would just provide the link to the 
>>>>> servlet to get the file downloaded.
>>>>>
>>>>> HTH
>>>>>
>>>>> Alejandro
>>>>>
>>>>> On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:
>>>>>
>>>>>> Thank you but I'm looking for sending the data the other way. We 
>>>>>> want the user to be able to download a binary file from an email 
>>>>>> portlet for an attachment or a file management/document sharing 
>>>>>> portlet. Uploading is the easy part but we can't seem to find a 
>>>>>> way to write arbitrary binary data to the user from a JSR-168 
>>>>>> portlet.
>>>>>>
>>>>>> -Eric Dalquist
>>>>>>
>>>>>> David Sean Taylor wrote:
>>>>>>
>>>>>>>
>>>>>>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>>>>>>
>>>>>>>> We're trying to find a way for a JSR-168 portlet to implement 
>>>>>>>> file downloading. Allowing the user to click on a URL generated 
>>>>>>>> by the portlet and have the portlet able to send arbitrary data 
>>>>>>>> (binary or otherwise) to the client. We are hoping to a portal 
>>>>>>>> agnostic solution so the portlets are still portable. We have 
>>>>>>>> looked into using an external servlet and notifying it of the 
>>>>>>>> file via a shared session but since the portlet runs within the 
>>>>>>>> portal's context and the servlet runs within the context the 
>>>>>>>> portlet and servlet are deployed to they do not share a 
>>>>>>>> session. Using get or post parameters or the ServletContext are 
>>>>>>>> not options since this would not be secure and allow people to 
>>>>>>>> bookmark file downloads and return without having to log in and 
>>>>>>>> allow fishing for other user's files.
>>>>>>>>
>>>>>>>> Has anyone come up with a way for a portlet to send files to a 
>>>>>>>> client without relying on some portal specific method?
>>>>>>>>
>>>>>>>> -Eric Dalquist
>>>>>>>>
>>>>>>>>
>>>>>>> There is an upload portlet here:
>>>>>>>
>>>>>>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>>>>>>
>>>>>>>
>>>>>
>>>
>
>

Re: Downloading files from a portlet

Posted by Alejandro Abdelnur <Al...@Sun.COM>.
All web components in a portlet application (servlets, JSPs and 
portlets) must be run within the same application context.

PLT.10: "The PortletContext interface defines a portlet’s view of the 
portlet application within which the portlet is running. Using the 
PortletContext object, a portlet can log events, obtain portlet 
application resources, and set and store attributes that other portlets 
and servlets in the portlet application can access."

PLT.15.4: "A Portlet Application is also a Web Application. The Portlet 
Application may contain servlets and JSPs in addition to portlets. 
Portlets, servlets and JSPs may share information 5 through their 
session."

If you are deploying a set of portlets, servlets and JSPs as a portlet 
application the runtime/execution environment should not break them up. 
If that is happening that is wrong.

Alejandro

On Jun 29, 2004, at 2:55 PM, Eric Dalquist wrote:

> No you can't, I've already tried this. The problem is even though the 
> servlet and portlet are deployed to the same context (both in the same 
> WAR), the portlet is loaded and run by the portal which is most likely 
> going to be in a different context than the portlet and the servlet 
> were deployed to, because of this the session is not shared. Here is a 
> simple diagram of what happens:
>
> Deployment
>    ContextA
>       Portlet1
>       Servlet1
>    ContextB
>       Portal (pretty much a big servlet)
>
> Execution
>    ContextA
>       Servlet1
>    ContextB
>       Portlet1 (it is loaded and executed by the portal so it ends up 
> in this context)
>       Portal
>
> -Eric
>
>
> Alejandro Abdelnur wrote:
>
>> If they are in the same portlet-app you can use the session to share 
>> data between the two. Same as 2 servlets in a web app.
>>
>> A
>>
>> On Jun 29, 2004, at 2:19 PM, Eric Dalquist wrote:
>>
>>> How can the portlet communicate the data to the servlet securely? A 
>>> portlet and a servlet in the same context do not share a session 
>>> since the portlet is actually being executed in the portal's 
>>> context. Sending the information the servlet would need to determine 
>>> the file to send via get or post is insecure and would be an easy 
>>> target for people wanting to look through files intended for other 
>>> users. Also there would be no way to ensure the user getting the 
>>> file from the servlet is currently authenticated with the portal.
>>>
>>> -Eric
>>>
>>> Alejandro Abdelnur wrote:
>>>
>>>> Eric,
>>>>
>>>> Then a portlet is not for the task but a servlet in the same 
>>>> portlet app and the portlet would just provide the link to the 
>>>> servlet to get the file downloaded.
>>>>
>>>> HTH
>>>>
>>>> Alejandro
>>>>
>>>> On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:
>>>>
>>>>> Thank you but I'm looking for sending the data the other way. We 
>>>>> want the user to be able to download a binary file from an email 
>>>>> portlet for an attachment or a file management/document sharing 
>>>>> portlet. Uploading is the easy part but we can't seem to find a 
>>>>> way to write arbitrary binary data to the user from a JSR-168 
>>>>> portlet.
>>>>>
>>>>> -Eric Dalquist
>>>>>
>>>>> David Sean Taylor wrote:
>>>>>
>>>>>>
>>>>>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>>>>>
>>>>>>> We're trying to find a way for a JSR-168 portlet to implement 
>>>>>>> file downloading. Allowing the user to click on a URL generated 
>>>>>>> by the portlet and have the portlet able to send arbitrary data 
>>>>>>> (binary or otherwise) to the client. We are hoping to a portal 
>>>>>>> agnostic solution so the portlets are still portable. We have 
>>>>>>> looked into using an external servlet and notifying it of the 
>>>>>>> file via a shared session but since the portlet runs within the 
>>>>>>> portal's context and the servlet runs within the context the 
>>>>>>> portlet and servlet are deployed to they do not share a session. 
>>>>>>> Using get or post parameters or the ServletContext are not 
>>>>>>> options since this would not be secure and allow people to 
>>>>>>> bookmark file downloads and return without having to log in and 
>>>>>>> allow fishing for other user's files.
>>>>>>>
>>>>>>> Has anyone come up with a way for a portlet to send files to a 
>>>>>>> client without relying on some portal specific method?
>>>>>>>
>>>>>>> -Eric Dalquist
>>>>>>>
>>>>>>>
>>>>>> There is an upload portlet here:
>>>>>>
>>>>>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>>>>>
>>>>>>
>>>>
>>


Re: Downloading files from a portlet

Posted by Eric Dalquist <ed...@unicon.net>.
No you can't, I've already tried this. The problem is even though the 
servlet and portlet are deployed to the same context (both in the same 
WAR), the portlet is loaded and run by the portal which is most likely 
going to be in a different context than the portlet and the servlet were 
deployed to, because of this the session is not shared. Here is a simple 
diagram of what happens:

Deployment
    ContextA
       Portlet1
       Servlet1
    ContextB
       Portal (pretty much a big servlet)

Execution
    ContextA
       Servlet1
    ContextB
       Portlet1 (it is loaded and executed by the portal so it ends up 
in this context)
       Portal

-Eric


Alejandro Abdelnur wrote:

> If they are in the same portlet-app you can use the session to share 
> data between the two. Same as 2 servlets in a web app.
>
> A
>
> On Jun 29, 2004, at 2:19 PM, Eric Dalquist wrote:
>
>> How can the portlet communicate the data to the servlet securely? A 
>> portlet and a servlet in the same context do not share a session 
>> since the portlet is actually being executed in the portal's context. 
>> Sending the information the servlet would need to determine the file 
>> to send via get or post is insecure and would be an easy target for 
>> people wanting to look through files intended for other users. Also 
>> there would be no way to ensure the user getting the file from the 
>> servlet is currently authenticated with the portal.
>>
>> -Eric
>>
>> Alejandro Abdelnur wrote:
>>
>>> Eric,
>>>
>>> Then a portlet is not for the task but a servlet in the same portlet 
>>> app and the portlet would just provide the link to the servlet to 
>>> get the file downloaded.
>>>
>>> HTH
>>>
>>> Alejandro
>>>
>>> On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:
>>>
>>>> Thank you but I'm looking for sending the data the other way. We 
>>>> want the user to be able to download a binary file from an email 
>>>> portlet for an attachment or a file management/document sharing 
>>>> portlet. Uploading is the easy part but we can't seem to find a way 
>>>> to write arbitrary binary data to the user from a JSR-168 portlet.
>>>>
>>>> -Eric Dalquist
>>>>
>>>> David Sean Taylor wrote:
>>>>
>>>>>
>>>>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>>>>
>>>>>> We're trying to find a way for a JSR-168 portlet to implement 
>>>>>> file downloading. Allowing the user to click on a URL generated 
>>>>>> by the portlet and have the portlet able to send arbitrary data 
>>>>>> (binary or otherwise) to the client. We are hoping to a portal 
>>>>>> agnostic solution so the portlets are still portable. We have 
>>>>>> looked into using an external servlet and notifying it of the 
>>>>>> file via a shared session but since the portlet runs within the 
>>>>>> portal's context and the servlet runs within the context the 
>>>>>> portlet and servlet are deployed to they do not share a session. 
>>>>>> Using get or post parameters or the ServletContext are not 
>>>>>> options since this would not be secure and allow people to 
>>>>>> bookmark file downloads and return without having to log in and 
>>>>>> allow fishing for other user's files.
>>>>>>
>>>>>> Has anyone come up with a way for a portlet to send files to a 
>>>>>> client without relying on some portal specific method?
>>>>>>
>>>>>> -Eric Dalquist
>>>>>>
>>>>>>
>>>>> There is an upload portlet here:
>>>>>
>>>>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>>>>
>>>>>
>>>
>

Re: Downloading files from a portlet

Posted by Alejandro Abdelnur <Al...@Sun.COM>.
If they are in the same portlet-app you can use the session to share 
data between the two. Same as 2 servlets in a web app.

A

On Jun 29, 2004, at 2:19 PM, Eric Dalquist wrote:

> How can the portlet communicate the data to the servlet securely? A 
> portlet and a servlet in the same context do not share a session since 
> the portlet is actually being executed in the portal's context. 
> Sending the information the servlet would need to determine the file 
> to send via get or post is insecure and would be an easy target for 
> people wanting to look through files intended for other users. Also 
> there would be no way to ensure the user getting the file from the 
> servlet is currently authenticated with the portal.
>
> -Eric
>
> Alejandro Abdelnur wrote:
>
>> Eric,
>>
>> Then a portlet is not for the task but a servlet in the same portlet 
>> app and the portlet would just provide the link to the servlet to get 
>> the file downloaded.
>>
>> HTH
>>
>> Alejandro
>>
>> On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:
>>
>>> Thank you but I'm looking for sending the data the other way. We 
>>> want the user to be able to download a binary file from an email 
>>> portlet for an attachment or a file management/document sharing 
>>> portlet. Uploading is the easy part but we can't seem to find a way 
>>> to write arbitrary binary data to the user from a JSR-168 portlet.
>>>
>>> -Eric Dalquist
>>>
>>> David Sean Taylor wrote:
>>>
>>>>
>>>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>>>
>>>>> We're trying to find a way for a JSR-168 portlet to implement file 
>>>>> downloading. Allowing the user to click on a URL generated by the 
>>>>> portlet and have the portlet able to send arbitrary data (binary 
>>>>> or otherwise) to the client. We are hoping to a portal agnostic 
>>>>> solution so the portlets are still portable. We have looked into 
>>>>> using an external servlet and notifying it of the file via a 
>>>>> shared session but since the portlet runs within the portal's 
>>>>> context and the servlet runs within the context the portlet and 
>>>>> servlet are deployed to they do not share a session. Using get or 
>>>>> post parameters or the ServletContext are not options since this 
>>>>> would not be secure and allow people to bookmark file downloads 
>>>>> and return without having to log in and allow fishing for other 
>>>>> user's files.
>>>>>
>>>>> Has anyone come up with a way for a portlet to send files to a 
>>>>> client without relying on some portal specific method?
>>>>>
>>>>> -Eric Dalquist
>>>>>
>>>>>
>>>> There is an upload portlet here:
>>>>
>>>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>>>
>>>>
>>


Re: Downloading files from a portlet

Posted by Eric Dalquist <ed...@unicon.net>.
How can the portlet communicate the data to the servlet securely? A 
portlet and a servlet in the same context do not share a session since 
the portlet is actually being executed in the portal's context. Sending 
the information the servlet would need to determine the file to send via 
get or post is insecure and would be an easy target for people wanting 
to look through files intended for other users. Also there would be no 
way to ensure the user getting the file from the servlet is currently 
authenticated with the portal.

-Eric

Alejandro Abdelnur wrote:

> Eric,
>
> Then a portlet is not for the task but a servlet in the same portlet 
> app and the portlet would just provide the link to the servlet to get 
> the file downloaded.
>
> HTH
>
> Alejandro
>
> On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:
>
>> Thank you but I'm looking for sending the data the other way. We want 
>> the user to be able to download a binary file from an email portlet 
>> for an attachment or a file management/document sharing portlet. 
>> Uploading is the easy part but we can't seem to find a way to write 
>> arbitrary binary data to the user from a JSR-168 portlet.
>>
>> -Eric Dalquist
>>
>> David Sean Taylor wrote:
>>
>>>
>>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>>
>>>> We're trying to find a way for a JSR-168 portlet to implement file 
>>>> downloading. Allowing the user to click on a URL generated by the 
>>>> portlet and have the portlet able to send arbitrary data (binary or 
>>>> otherwise) to the client. We are hoping to a portal agnostic 
>>>> solution so the portlets are still portable. We have looked into 
>>>> using an external servlet and notifying it of the file via a shared 
>>>> session but since the portlet runs within the portal's context and 
>>>> the servlet runs within the context the portlet and servlet are 
>>>> deployed to they do not share a session. Using get or post 
>>>> parameters or the ServletContext are not options since this would 
>>>> not be secure and allow people to bookmark file downloads and 
>>>> return without having to log in and allow fishing for other user's 
>>>> files.
>>>>
>>>> Has anyone come up with a way for a portlet to send files to a 
>>>> client without relying on some portal specific method?
>>>>
>>>> -Eric Dalquist
>>>>
>>>>
>>> There is an upload portlet here:
>>>
>>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>>
>>>
>

Re: Downloading files from a portlet

Posted by Alejandro Abdelnur <Al...@Sun.COM>.
Eric,

Then a portlet is not for the task but a servlet in the same portlet 
app and the portlet would just provide the link to the servlet to get 
the file downloaded.

HTH

Alejandro

On Jun 29, 2004, at 11:43 AM, Eric Dalquist wrote:

> Thank you but I'm looking for sending the data the other way. We want 
> the user to be able to download a binary file from an email portlet 
> for an attachment or a file management/document sharing portlet. 
> Uploading is the easy part but we can't seem to find a way to write 
> arbitrary binary data to the user from a JSR-168 portlet.
>
> -Eric Dalquist
>
> David Sean Taylor wrote:
>
>>
>> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>>
>>> We're trying to find a way for a JSR-168 portlet to implement file 
>>> downloading. Allowing the user to click on a URL generated by the 
>>> portlet and have the portlet able to send arbitrary data (binary or 
>>> otherwise) to the client. We are hoping to a portal agnostic 
>>> solution so the portlets are still portable. We have looked into 
>>> using an external servlet and notifying it of the file via a shared 
>>> session but since the portlet runs within the portal's context and 
>>> the servlet runs within the context the portlet and servlet are 
>>> deployed to they do not share a session. Using get or post 
>>> parameters or the ServletContext are not options since this would 
>>> not be secure and allow people to bookmark file downloads and return 
>>> without having to log in and allow fishing for other user's files.
>>>
>>> Has anyone come up with a way for a portlet to send files to a 
>>> client without relying on some portal specific method?
>>>
>>> -Eric Dalquist
>>>
>>>
>> There is an upload portlet here:
>>
>> http://sourceforge.net/project/showfiles.php?group_id=91153
>>
>>


Re: Downloading files from a portlet

Posted by Eric Dalquist <ed...@unicon.net>.
Thank you but I'm looking for sending the data the other way. We want 
the user to be able to download a binary file from an email portlet for 
an attachment or a file management/document sharing portlet. Uploading 
is the easy part but we can't seem to find a way to write arbitrary 
binary data to the user from a JSR-168 portlet.

-Eric Dalquist

David Sean Taylor wrote:

>
> On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:
>
>> We're trying to find a way for a JSR-168 portlet to implement file 
>> downloading. Allowing the user to click on a URL generated by the 
>> portlet and have the portlet able to send arbitrary data (binary or 
>> otherwise) to the client. We are hoping to a portal agnostic solution 
>> so the portlets are still portable. We have looked into using an 
>> external servlet and notifying it of the file via a shared session 
>> but since the portlet runs within the portal's context and the 
>> servlet runs within the context the portlet and servlet are deployed 
>> to they do not share a session. Using get or post parameters or the 
>> ServletContext are not options since this would not be secure and 
>> allow people to bookmark file downloads and return without having to 
>> log in and allow fishing for other user's files.
>>
>> Has anyone come up with a way for a portlet to send files to a client 
>> without relying on some portal specific method?
>>
>> -Eric Dalquist
>>
>>
> There is an upload portlet here:
>
> http://sourceforge.net/project/showfiles.php?group_id=91153
>
>

Re: Downloading files from a portlet

Posted by David Sean Taylor <da...@bluesunrise.com>.
On Jun 29, 2004, at 10:19 AM, Eric Dalquist wrote:

> We're trying to find a way for a JSR-168 portlet to implement file 
> downloading. Allowing the user to click on a URL generated by the 
> portlet and have the portlet able to send arbitrary data (binary or 
> otherwise) to the client. We are hoping to a portal agnostic solution 
> so the portlets are still portable. We have looked into using an 
> external servlet and notifying it of the file via a shared session but 
> since the portlet runs within the portal's context and the servlet 
> runs within the context the portlet and servlet are deployed to they 
> do not share a session. Using get or post parameters or the 
> ServletContext are not options since this would not be secure and 
> allow people to bookmark file downloads and return without having to 
> log in and allow fishing for other user's files.
>
> Has anyone come up with a way for a portlet to send files to a client 
> without relying on some portal specific method?
>
> -Eric Dalquist
>
>
There is an upload portlet here:

http://sourceforge.net/project/showfiles.php?group_id=91153