472,353 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 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 3829
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...
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...
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...
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...
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...
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...
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:...
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...
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.