473,408 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

File Persistence In the Session Object

I am developing a Struts1.1 based application, that returns an Excel
File generated by Jakarta's POI classes. One of the requirements is
that the file be stored in the SESSION ONLY, not on the file system.

Is this even possible? Doesn't a file need to be physically present
before a reference to it can be stored in the session?

prompt insight would be most appreciated, as I'm working against a
deadline.

Thanks!

PK
Jul 17 '05 #1
5 3894
The browser just reacts to an input stream. Some browsers tend to open
MS Excel when they receive a special input stream. I don't know POI but
I'm sure you can write the created Excel file from memory to any kind of
output stream, e.g. one created by HttpResponse.getOutputStream.
So you'd not store the file in the HttpSession but stream it directly to
the browser of the client. The client could save the received excel file
to disk.

Patrick
Kid A wrote:
I am developing a Struts1.1 based application, that returns an Excel
File generated by Jakarta's POI classes. One of the requirements is
that the file be stored in the SESSION ONLY, not on the file system.

Is this even possible? Doesn't a file need to be physically present
before a reference to it can be stored in the session?

prompt insight would be most appreciated, as I'm working against a
deadline.

Thanks!

PK


Jul 17 '05 #2
That is true, and that was the way I designed the application at
first.
But there needs to be a way for the user, as reports are being
created, to be stored by the session, and then have the option of
downloading them from an index of created files, but this list would
only persist as long as the session is active.

For example, the system generated 3 files. The user clicks on a link
to take them to a list of the files that were created in that session,
and they should be able to download whichever of the three they want,
when they want, but as soon as the session is expired/logout, the
files are lost.

I believe it's IMPOSSIBLE to store an OutputStream in the session,
true?

-PK

Patrick Carl <ca**********@nefkom.net> wrote in message news:<bm**********@news1.nefonline.de>...
The browser just reacts to an input stream. Some browsers tend to open
MS Excel when they receive a special input stream. I don't know POI but
I'm sure you can write the created Excel file from memory to any kind of
output stream, e.g. one created by HttpResponse.getOutputStream.
So you'd not store the file in the HttpSession but stream it directly to
the browser of the client. The client could save the received excel file
to disk.

Patrick
Kid A wrote:
I am developing a Struts1.1 based application, that returns an Excel
File generated by Jakarta's POI classes. One of the requirements is
that the file be stored in the SESSION ONLY, not on the file system.

Is this even possible? Doesn't a file need to be physically present
before a reference to it can be stored in the session?

prompt insight would be most appreciated, as I'm working against a
deadline.

Thanks!

PK

Jul 17 '05 #3
You can't store an OutputStream in the session, but you should be able
to store the byte array associated with that OutputStream. I'm
assuming POI pumps out a byte array at some point... instead of
putting that into the OutputStream, save it to the session.

-Nathan

pa******@hotmail.com (Kid A) wrote in message news:<53*************************@posting.google.c om>...
That is true, and that was the way I designed the application at
first.
But there needs to be a way for the user, as reports are being
created, to be stored by the session, and then have the option of
downloading them from an index of created files, but this list would
only persist as long as the session is active.

For example, the system generated 3 files. The user clicks on a link
to take them to a list of the files that were created in that session,
and they should be able to download whichever of the three they want,
when they want, but as soon as the session is expired/logout, the
files are lost.

I believe it's IMPOSSIBLE to store an OutputStream in the session,
true?

-PK

Patrick Carl <ca**********@nefkom.net> wrote in message news:<bm**********@news1.nefonline.de>...
The browser just reacts to an input stream. Some browsers tend to open
MS Excel when they receive a special input stream. I don't know POI but
I'm sure you can write the created Excel file from memory to any kind of
output stream, e.g. one created by HttpResponse.getOutputStream.
So you'd not store the file in the HttpSession but stream it directly to
the browser of the client. The client could save the received excel file
to disk.

Patrick
Kid A wrote:
I am developing a Struts1.1 based application, that returns an Excel
File generated by Jakarta's POI classes. One of the requirements is
that the file be stored in the SESSION ONLY, not on the file system.

Is this even possible? Doesn't a file need to be physically present
before a reference to it can be stored in the session?

prompt insight would be most appreciated, as I'm working against a
deadline.

Thanks!

PK

Jul 17 '05 #4
So why do you generate the files before offering the links? You could
offer the user the three different possibilities and after he selects
one you create the demanded Excel file. You'd just offer the links, not
the files. Furthermore you wouldn't have to create three files when two
are thrown away.

Patrick

Kid A wrote:
That is true, and that was the way I designed the application at
first.
But there needs to be a way for the user, as reports are being
created, to be stored by the session, and then have the option of
downloading them from an index of created files, but this list would
only persist as long as the session is active.

For example, the system generated 3 files. The user clicks on a link
to take them to a list of the files that were created in that session,
and they should be able to download whichever of the three they want,
when they want, but as soon as the session is expired/logout, the
files are lost.

I believe it's IMPOSSIBLE to store an OutputStream in the session,
true?

-PK

Patrick Carl <ca**********@nefkom.net> wrote in message news:<bm**********@news1.nefonline.de>...
The browser just reacts to an input stream. Some browsers tend to open
MS Excel when they receive a special input stream. I don't know POI but
I'm sure you can write the created Excel file from memory to any kind of
output stream, e.g. one created by HttpResponse.getOutputStream.
So you'd not store the file in the HttpSession but stream it directly to
the browser of the client. The client could save the received excel file
to disk.

Patrick
Kid A wrote:
I am developing a Struts1.1 based application, that returns an Excel
File generated by Jakarta's POI classes. One of the requirements is
that the file be stored in the SESSION ONLY, not on the file system.

Is this even possible? Doesn't a file need to be physically present
before a reference to it can be stored in the session?

prompt insight would be most appreciated, as I'm working against a
deadline.

Thanks!

PK


Jul 17 '05 #5
These are great suggestions, I'll definitly look into them and see
what works best for our needs. I'll let you know what I decide to do.
Thanks!
Patrick Carl <ca**********@nefkom.net> wrote in message news:<bm**********@news1.nefonline.de>...
So why do you generate the files before offering the links? You could
offer the user the three different possibilities and after he selects
one you create the demanded Excel file. You'd just offer the links, not
the files. Furthermore you wouldn't have to create three files when two
are thrown away.

Patrick

Kid A wrote:
That is true, and that was the way I designed the application at
first.
But there needs to be a way for the user, as reports are being
created, to be stored by the session, and then have the option of
downloading them from an index of created files, but this list would
only persist as long as the session is active.

For example, the system generated 3 files. The user clicks on a link
to take them to a list of the files that were created in that session,
and they should be able to download whichever of the three they want,
when they want, but as soon as the session is expired/logout, the
files are lost.

I believe it's IMPOSSIBLE to store an OutputStream in the session,
true?

-PK

Patrick Carl <ca**********@nefkom.net> wrote in message news:<bm**********@news1.nefonline.de>...
The browser just reacts to an input stream. Some browsers tend to open
MS Excel when they receive a special input stream. I don't know POI but
I'm sure you can write the created Excel file from memory to any kind of
output stream, e.g. one created by HttpResponse.getOutputStream.
So you'd not store the file in the HttpSession but stream it directly to
the browser of the client. The client could save the received excel file
to disk.

Patrick
Kid A wrote:

I am developing a Struts1.1 based application, that returns an Excel
File generated by Jakarta's POI classes. One of the requirements is
that the file be stored in the SESSION ONLY, not on the file system.

Is this even possible? Doesn't a file need to be physically present
before a reference to it can be stored in the session?

prompt insight would be most appreciated, as I'm working against a
deadline.

Thanks!

PK

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Simon Harvey | last post by:
Hi everyone, Can anyone tell me if I declare a global variable in my pages code behind, is it persisted if the page does a post back, or do I need to add the object to the session object in...
4
by: Marcel Balcarek | last post by:
Hello, I have a page (page1.aspx) that builds some complex .NET objects. I successfully pass these objects to another different window (page2.aspx). How can I persist these objects on a POST...
4
by: Trevor Andrew | last post by:
Hi There, Hopefully this isn't too difficult a question to express here. I have a 3 tier application. 1. Presentation Tier: ASP.NET web application. 2. Middle Tier: ASP.NET Web Services that...
3
by: Jo Inferis | last post by:
So, I'm using a 3rd party com object via interop (already I can hear screams of anguish). This object was originally written to be used as the backend for multiple screens of a VB application. Now...
7
by: Steve Mauldin | last post by:
I have a public variable that is declared in a public module. This Variable is stored into a Session variable and used to pass data from page to page. I am seeing on my local development box that...
2
by: dkode | last post by:
Hello, I am laying out the architecture for a very large website that will scale to a very large degree. I have a couple of questions before I attempt to go and implement a Broker/Persistence...
3
by: Robert | last post by:
I am trying to persist an instance specific object without using a session object. Is this possible? For example: Class object: Car Properties: Make, Model Car.Make = Ford Car.Model = F150
4
by: =?Utf-8?B?YWtzaGF5am9odXI=?= | last post by:
I am facing an issue with the session persistence. I am automating a website using Watin and initializing a new instance using VB.net code. The Windows authentication box is used to logon. The...
4
by: coldpizza | last post by:
Hi, I want to run a database query and then display the first 10 records on a web page. Then I want to be able to click the 'Next' link on the page to show the next 10 records, and so on. My...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.