setting download file name

2005-03-06 Thread Dr NoName
Hi all,

I am trying to make link to a dynamically generated
zip file which the user can download. It links to a
jsp page like so:

  a href=audio_download.jspDownload Audio/a

In audio_download.jsp, I have the following code to
generate the zip:

jsp:useBean scope=session id=myLatestAudioFiles
class=java.util.ArrayList/
%
response.setContentType(application/zip);
if( ! myLatestAudioFiles.isEmpty() )
{
ZipOutputStream ostr = new ZipOutputStream(
response.getOutputStream() );
for(int i = 0; i  myLatestAudioFiles.size();
i++)
{
String file_path =
(String)myLatestAudioFiles.get(i);
String file_name =
CFunctions.splitPathName(file_path)[1];
InputStream istr = new
FileInputStream(file_path);
ostr.putNextEntry( new ZipEntry(file_name)
);
CFunctions.copyStream(istr, ostr);
istr.close();
}
ostr.close();
}
%


This works but when the user clicks the link, the save
file dialog's default file name is audio_download.jsp.
I want it to be a dynamically generated zip file name
(something like 087_latest_audio.zip). How do I do
that? Or is this the wrong approach?


thanks in advance,

Eugene


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: setting download file name

2005-03-06 Thread Darren Govoni
Try this. I used it for JNLP, but it should work for zip. Just
replace .jnlp with .zip

String fileName = request.getServletPath();
fileName = fileName.substring(fileName.lastIndexOf(/) + 1);
fileName = fileName.substring(0, fileName.indexOf(.)) + .jnlp;
response.addHeader(Content-Disposition, Inline; fileName= +
fileName);


On Sun, 2005-03-06 at 13:27 -0800, Dr NoName wrote:

 Hi all,
 
 I am trying to make link to a dynamically generated
 zip file which the user can download. It links to a
 jsp page like so:
 
   a href=audio_download.jspDownload Audio/a
 
 In audio_download.jsp, I have the following code to
 generate the zip:
 
 jsp:useBean scope=session id=myLatestAudioFiles
 class=java.util.ArrayList/
 %
 response.setContentType(application/zip);
 if( ! myLatestAudioFiles.isEmpty() )
 {
 ZipOutputStream ostr = new ZipOutputStream(
 response.getOutputStream() );
 for(int i = 0; i  myLatestAudioFiles.size();
 i++)
 {
 String file_path =
 (String)myLatestAudioFiles.get(i);
 String file_name =
 CFunctions.splitPathName(file_path)[1];
 InputStream istr = new
 FileInputStream(file_path);
 ostr.putNextEntry( new ZipEntry(file_name)
 );
 CFunctions.copyStream(istr, ostr);
 istr.close();
 }
 ostr.close();
 }
 %
 
 
 This works but when the user clicks the link, the save
 file dialog's default file name is audio_download.jsp.
 I want it to be a dynamically generated zip file name
 (something like 087_latest_audio.zip). How do I do
 that? Or is this the wrong approach?
 
 
 thanks in advance,
 
 Eugene
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


Re: setting download file name

2005-03-06 Thread Dr NoName
that works. thanks.

Eugene


--- Darren Govoni [EMAIL PROTECTED] wrote:

 Try this. I used it for JNLP, but it should work for
 zip. Just
 replace .jnlp with .zip
 
 String fileName = request.getServletPath();
 fileName =
 fileName.substring(fileName.lastIndexOf(/) + 1);
 fileName = fileName.substring(0,
 fileName.indexOf(.)) + .jnlp;
 response.addHeader(Content-Disposition, Inline;
 fileName= +
 fileName);
 
 
 On Sun, 2005-03-06 at 13:27 -0800, Dr NoName wrote:
 
  Hi all,
  
  I am trying to make link to a dynamically
 generated
  zip file which the user can download. It links to
 a
  jsp page like so:
  
a href=audio_download.jspDownload Audio/a
  
  In audio_download.jsp, I have the following code
 to
  generate the zip:
  
  jsp:useBean scope=session
 id=myLatestAudioFiles
  class=java.util.ArrayList/
  %
  response.setContentType(application/zip);
  if( ! myLatestAudioFiles.isEmpty() )
  {
  ZipOutputStream ostr = new
 ZipOutputStream(
  response.getOutputStream() );
  for(int i = 0; i 
 myLatestAudioFiles.size();
  i++)
  {
  String file_path =
  (String)myLatestAudioFiles.get(i);
  String file_name =
  CFunctions.splitPathName(file_path)[1];
  InputStream istr = new
  FileInputStream(file_path);
  ostr.putNextEntry( new
 ZipEntry(file_name)
  );
  CFunctions.copyStream(istr, ostr);
  istr.close();
  }
  ostr.close();
  }
  %
  
  
  This works but when the user clicks the link, the
 save
  file dialog's default file name is
 audio_download.jsp.
  I want it to be a dynamically generated zip file
 name
  (something like 087_latest_audio.zip). How do I do
  that? Or is this the wrong approach?
  
  
  thanks in advance,
  
  Eugene
  
  
  __
  Do You Yahoo!?
  Tired of spam?  Yahoo! Mail has the best spam
 protection around 
  http://mail.yahoo.com 
  
 

-
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
 





__ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: download file issue

2003-11-25 Thread Andoni
Please give a little more detail about what actually goes wrong.

Also have you looked at the log files?  If there is something there that you
can't interpret then post a few of the relevant lines to the list (but not
the whole log file, obviously ;-) ).

Andoni.

- Original Message -
From: Ostad, James [EMAIL PROTECTED]
To: Tom (E-mail) [EMAIL PROTECTED]
Sent: Monday, November 24, 2003 4:24 PM
Subject: download file issue


I have created a web site that allows users to download files.
It is working at the server level, but not out site of the server, at
user level.
Server is win2k adv. server.
Tomcat is 4.1.29


Any suggestion would appreciated.

James


Out--- (1)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: download file issue

2003-11-25 Thread Andoni
Sorry, wasn't looking at list in date order!!

A.


- Original Message -
From: Andoni [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 10:33 AM
Subject: Re: download file issue


 Please give a little more detail about what actually goes wrong.

 Also have you looked at the log files?  If there is something there that
you
 can't interpret then post a few of the relevant lines to the list (but not
 the whole log file, obviously ;-) ).

 Andoni.

 - Original Message -
 From: Ostad, James [EMAIL PROTECTED]
 To: Tom (E-mail) [EMAIL PROTECTED]
 Sent: Monday, November 24, 2003 4:24 PM
 Subject: download file issue


 I have created a web site that allows users to download files.
 It is working at the server level, but not out site of the server, at
 user level.
 Server is win2k adv. server.
 Tomcat is 4.1.29


 Any suggestion would appreciated.

 James


 Out--- (1)



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: download file issue

2003-11-25 Thread Ostad, James
I appreciate your trying to help.
Thanks,

James

-Original Message-
From: Andoni [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 5:55 AM
To: Tomcat Users List
Subject: Re: download file issue


Sorry, wasn't looking at list in date order!!

A.


- Original Message -
From: Andoni [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 10:33 AM
Subject: Re: download file issue


 Please give a little more detail about what actually goes wrong.

 Also have you looked at the log files?  If there is something there
that
you
 can't interpret then post a few of the relevant lines to the list (but
not
 the whole log file, obviously ;-) ).

 Andoni.

 - Original Message -
 From: Ostad, James [EMAIL PROTECTED]
 To: Tom (E-mail) [EMAIL PROTECTED]
 Sent: Monday, November 24, 2003 4:24 PM
 Subject: download file issue


 I have created a web site that allows users to download files.
 It is working at the server level, but not out site of the server, at
 user level.
 Server is win2k adv. server.
 Tomcat is 4.1.29


 Any suggestion would appreciated.

 James


 Out--- (1)



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---In (14)




Out--- (3)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



download file issue

2003-11-24 Thread Ostad, James
I have created a web site that allows users to download files.
It is working at the server level, but not out site of the server, at
user level.
Server is win2k adv. server.
Tomcat is 4.1.29


Any suggestion would appreciated.

James


Out--- (1)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: download file issue

2003-11-24 Thread Christopher Schultz
James,
I have created a web site that allows users to download files.
It is working at the server level, but not out site of the server, at
user level.
Can you describe what you mean by doesn't work outside the server?

What happens when you try to download?

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: download file issue

2003-11-24 Thread Ostad, James
Chris,
While I am within the host server, everything works fine. But let say
that I try to get the site from a local workstation through internet.

I am able to login, pass the information, and even get the database file
information with an hyperlink to the file. But when I double click on it
gives me an error page, or if I right click on it to save the target as,
I just get a system beep.
When I check the server, all tasks of copying the file from the secure
location to the web apps directory, so that I could access it with a
JSP, have been performed.

I am not using IIS at this time.

Thanks

James

-Original Message-
From: Christopher Schultz [mailto:[EMAIL PROTECTED]
Sent: Monday, November 24, 2003 11:57 AM
To: Tomcat Users List
Subject: Re: download file issue


James,
 I have created a web site that allows users to download files.
 It is working at the server level, but not out site of the server, at
 user level.

Can you describe what you mean by doesn't work outside the server?

What happens when you try to download?

-chris


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---In (1)




Out--- (1)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: download file issue

2003-11-24 Thread Christopher Schultz
James,
 I am not using IIS at this time.
So, this is standalone Tomcat. Okay.

I am able to login, pass the information, and even get the database file
information with an hyperlink to the file. But when I double click on it
gives me an error page, or if I right click on it to save the target as,
I just get a system beep.
What does the error page say?

When I check the server, all tasks of copying the file from the secure
location to the web apps directory, so that I could access it with a
JSP, have been performed.
Are there any exceptions reported in the Tomcat log files? Check 
catalina.out in TOMCAT_HOME/logs, as well as yourapp.log-TODAYS_DATE 
in the same directory.

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: download file issue

2003-11-24 Thread Ostad, James
Chris,
Here is the error page:
 The page cannot be displayed 
The page you are looking for is currently unavailable. The Web site
might be experiencing technical difficulties, or you may need to adjust
your browser settings. 




Please try the following:

Click the  Refresh button, or try again later.

If you typed the page address in the Address bar, make sure that it is
spelled correctly.

To check your connection settings, click the Tools menu, and then click
Internet Options. On the Connections tab, click Settings. The settings
should match those provided by your local area network (LAN)
administrator or Internet service provider (ISP). 
If your Network Administrator has enabled it, Microsoft Windows can
examine your network and automatically discover network connection
settings.
If you would like Windows to try and discover them, 
click  Detect Network Settings 
Some sites require 128-bit connection security. Click the Help menu and
then click About Internet Explorer to determine what strength security
you have installed. 
If you are trying to reach a secure site, make sure your Security
settings can support it. Click the Tools menu, and then click Internet
Options. On the Advanced tab, scroll to the Security section and check
settings for SSL 2.0, SSL 3.0, TLS 1.0, PCT 1.0. 
Click the  Back button to try another link. 


Cannot find server or DNS Error
Internet Explorer 

I checked the app log file, and there is no error in it. I am not able
to locate catalina.out file.
Although I have localhost_admin_log file which doesnot have any error it
either.

Am I missing something? I did not see anything about catalina.out file
during installation. Of course, I am new in Tomcat.

I appreciate your help.

James


-Original Message-
From: Christopher Schultz [mailto:[EMAIL PROTECTED]
Sent: Monday, November 24, 2003 12:09 PM
To: Tomcat Users List
Subject: Re: download file issue


James,
  I am not using IIS at this time.

So, this is standalone Tomcat. Okay.

 I am able to login, pass the information, and even get the database
file
 information with an hyperlink to the file. But when I double click on
it
 gives me an error page, or if I right click on it to save the target
as,
 I just get a system beep.

What does the error page say?

 When I check the server, all tasks of copying the file from the secure
 location to the web apps directory, so that I could access it with a
 JSP, have been performed.

Are there any exceptions reported in the Tomcat log files? Check 
catalina.out in TOMCAT_HOME/logs, as well as yourapp.log-TODAYS_DATE 
in the same directory.

-chris


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---In (1)




Out--- (1)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: download file issue

2003-11-24 Thread Christopher Schultz
James,

Here is the error page:
 The page cannot be displayed 
The page you are looking for is currently unavailable. The Web site
might be experiencing technical difficulties, or you may need to adjust
your browser settings. 
Sorry for the back-and-forth: is this a Tomcat error (light blue and 
white) or is it an Internet Explorer error message?

What is the URL being displayed in the 'location' bar of the browser 
when that error is showing?

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: download file issue

2003-11-24 Thread Ostad, James
You have no idea what I have gone through to figure this out.
I will do this as long as you last.

That is not a tomcat error. It is an IE error.

\\ipaddress\temp$\ceo\test\temp$\00064735.tif

I have not activated the DNS yet, that is why the IP address is showing
up.

when I move the cursor over the hyperlink, at the bottom of the status
bar I see this address:

file://ipaddress/temp$/ceo/test/temp$/00064735.tif(local)



-Original Message-
From: Christopher Schultz [mailto:[EMAIL PROTECTED]
Sent: Monday, November 24, 2003 12:30 PM
To: Tomcat Users List
Subject: Re: download file issue


James,

 Here is the error page:
  The page cannot be displayed 
 The page you are looking for is currently unavailable. The Web site
 might be experiencing technical difficulties, or you may need to
adjust
 your browser settings. 

Sorry for the back-and-forth: is this a Tomcat error (light blue and 
white) or is it an Internet Explorer error message?

What is the URL being displayed in the 'location' bar of the browser 
when that error is showing?

-chris


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---In (1)




Out--- (1)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: download file issue

2003-11-24 Thread Christopher Schultz
James,
You have no idea what I have gone through to figure this out.
I will do this as long as you last.
That is not a tomcat error. It is an IE error.

\\ipaddress\temp$\ceo\test\temp$\00064735.tif

I have not activated the DNS yet, that is why the IP address is showing
up.
when I move the cursor over the hyperlink, at the bottom of the status
bar I see this address:
file://ipaddress/temp$/ceo/test/temp$/00064735.tif(local)
Oh, wow. You're not sending the file to the browser... you're pushing it 
to the user's machine, and then providing a local link?

Ouch. That's a tough process. Why not deliver the file via the browser?

That URL you show there starting with file:// will look for a file on 
the local machine (where the browser is running). I'm guessing that it's 
not going to work, especially because you don't have a drive letter in 
the URL.

That URL will point to something like 
c:\ipaddress\temp$\ceo\test\temp$\00064735.tif , which I'll bet doesn't 
exist on your client.

This is (I'm sure) why you're getting this error. If you want to show a 
file on the remote server, your URL better look like http://something

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: download file issue

2003-11-24 Thread Ostad, James
Chris,
I am using a JSP to do the download.
I pass the relative path to the jsp page with the file name.
Before your last email, I was creating a file instance and use that for
my hyper link.
I changed the code to it will reflect the http:// path rather than the
file:// .

Now I get the tomcat error:


HTTP Status 404 - /temp$/ceo/test/temp/crc/00057720.tif




type Status report

message /temp$/ceo/test/temp/crc/00057720.tif

description The requested resource
(/temp$/ceo/test/temp/crc/00057720.tif) is not available.



Apache Tomcat/4.1.29

***


I checked the server and the file with its path does exist.

Now, at the browser level I see only the file name, before getting this
error.

James

-Original Message-
From: Christopher Schultz [mailto:[EMAIL PROTECTED]
Sent: Monday, November 24, 2003 2:18 PM
To: Tomcat Users List
Subject: Re: download file issue


James,
 You have no idea what I have gone through to figure this out.
 I will do this as long as you last.
 
 That is not a tomcat error. It is an IE error.
 
 \\ipaddress\temp$\ceo\test\temp$\00064735.tif
 
 I have not activated the DNS yet, that is why the IP address is
showing
 up.
 
 when I move the cursor over the hyperlink, at the bottom of the status
 bar I see this address:
 
 file://ipaddress/temp$/ceo/test/temp$/00064735.tif(local)

Oh, wow. You're not sending the file to the browser... you're pushing it

to the user's machine, and then providing a local link?

Ouch. That's a tough process. Why not deliver the file via the browser?

That URL you show there starting with file:// will look for a file on 
the local machine (where the browser is running). I'm guessing that it's

not going to work, especially because you don't have a drive letter in 
the URL.

That URL will point to something like 
c:\ipaddress\temp$\ceo\test\temp$\00064735.tif , which I'll bet doesn't 
exist on your client.

This is (I'm sure) why you're getting this error. If you want to show a 
file on the remote server, your URL better look like http://something

-chris


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---In (1)




Out--- (1)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: download file issue

2003-11-24 Thread Ostad, James
Chris,
With your help, I got it to work.
Since I am downloading images, I just have to change the way I copy the
files from the source to the web app directory.

The format of the path was the problem.

In the case you are interested:

- I get the UNC file path format from SQL database
- then copy the file from source to target
- then create this path format for url download, as you directed me

Thank you so much,

James

-Original Message-
From: Christopher Schultz [mailto:[EMAIL PROTECTED]
Sent: Monday, November 24, 2003 2:18 PM
To: Tomcat Users List
Subject: Re: download file issue


James,
 You have no idea what I have gone through to figure this out.
 I will do this as long as you last.
 
 That is not a tomcat error. It is an IE error.
 
 \\ipaddress\temp$\ceo\test\temp$\00064735.tif
 
 I have not activated the DNS yet, that is why the IP address is
showing
 up.
 
 when I move the cursor over the hyperlink, at the bottom of the status
 bar I see this address:
 
 file://ipaddress/temp$/ceo/test/temp$/00064735.tif(local)

Oh, wow. You're not sending the file to the browser... you're pushing it

to the user's machine, and then providing a local link?

Ouch. That's a tough process. Why not deliver the file via the browser?

That URL you show there starting with file:// will look for a file on 
the local machine (where the browser is running). I'm guessing that it's

not going to work, especially because you don't have a drive letter in 
the URL.

That URL will point to something like 
c:\ipaddress\temp$\ceo\test\temp$\00064735.tif , which I'll bet doesn't 
exist on your client.

This is (I'm sure) why you're getting this error. If you want to show a 
file on the remote server, your URL better look like http://something

-chris


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---In (1)




Out--- (1)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: download file issue

2003-11-24 Thread Christopher Schultz
James,
With your help, I got it to work.
Thank you so much,
Glad you got it working.

-chris

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Hide download file

2002-07-18 Thread Cox, Charlie

ok, I quickly pulled this out of a filter that I use for the same purpose.
It may not compile, but should be very close. See the filter examples that
come with tomcat for the complete filter and this is a sample of how to do
what you want.

also create a mapping in web.xml for your static files/directories that this
filter should run against.

Charlie



 public void doFilter(ServletRequest req, ServletResponse resp,
FilterChain chain)
  throws IOException, ServletException
 {
//convert ServletRequest to HttpServletRequest so that we
can use the extended features
HttpServletRequest myReq = null;
if (req instanceof HttpServletRequest)
{
myReq = (HttpServletRequest)req;
}

//convert ServletResponse to HttpServletResponse so that we
can use the extended features
HttpServletResponse myResp = null;
if (resp instanceof HttpServletResponse)
{
myResp = (HttpServletResponse)resp;
}

// the rest of this filter depends on HttpServletRequest and
HttpServletResponse, so if we don't have a valid one, exit here.
if (myResp == null || myReq == null)
{
chain.doFilter(req, resp);
return;
}

HttpSession sess = myReq.getSession(false);
if (sess.getAttribute(Something) == null)
{
RequestDispatcher rd =
m_filterConfig.getServletContext().getRequestDispatcher(/jsp/MyForm.jsp);
if (rd != null)
rd.forward(req,resp);
return;
}
chain.doFilter(req,resp);
}


 -Original Message-
 From: Lars Nielsen Lind [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, July 17, 2002 5:34 PM
 To: Tomcat Users List
 Subject: Re: Hide download file
 
 
 Cox, Charlie wrote:
 
 I just answered this last week. Use a filter that checks the 
 session and
 leave your download files in a directory under webapps. 
 Filters make this
 simple. Don't do any more work than you need to :)
 
 Charlie
 
 
 I have found an article at www.javaworld.com about witing 
 servlets for 
 downloading non-html documents 
 (http://www.javaworld.com/javatips/jw-javatip94_p.html).
 
 But I want to control the access to the file download 
 component with 
 session variables. The user is given the right session 
 variables when he 
 fills out the download form.
 
 Best regards,
 
 Lars Nielsen Lind
 
 
 
 
 --
 To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]


Do you have some examples of user-defined filters for handling session 
variable defined access to download file(s)?

Best regards,

Lars Nielsen Lind



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Hide download file

2002-07-17 Thread Lars Nielsen Lind

Hi.

We are using an Upload component to upload files to the server. The 
files are placed in /fileserver/files - a directory outside of webapps.

Anyone that have example files on how to retrive the files (download) 
via JavaBean/JSP from a directory outside of webapps?

Best regards,

Lars Nielsen Lind



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Hide download file

2002-07-17 Thread Irina Lishchenko

On Wednesday 17 July 2002 16:48, you wrote:
 Hi.

 We are using an Upload component to upload files to the server. The
 files are placed in /fileserver/files - a directory outside of webapps.

 Anyone that have example files on how to retrive the files (download)
 via JavaBean/JSP from a directory outside of webapps?

 Best regards,

 Lars Nielsen Lind

What do you mean with retrive the files? As I understand everything depends 
on what are you going to do with this file ... put it to a database or simply 
remove it to another place??


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Hide download file

2002-07-17 Thread Cox, Charlie

is there a reason why you can't have the directory under webapps? In order
to do this you would need to write your own servlet that reads the file and
writes to the output stream. You should let Tomcat serve the file when
possible so that you don't have to implement all the http 1.1 features...

you can use a filter to control access to the static files.

you could also add a soft link under webapps that points to the real file.

Charlie

 -Original Message-
 From: Irina Lishchenko [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, July 17, 2002 1:44 PM
 To: Tomcat Users List
 Subject: Re: Hide download file
 
 
 On Wednesday 17 July 2002 16:48, you wrote:
  Hi.
 
  We are using an Upload component to upload files to the server. The
  files are placed in /fileserver/files - a directory outside 
 of webapps.
 
  Anyone that have example files on how to retrive the files 
 (download)
  via JavaBean/JSP from a directory outside of webapps?
 
  Best regards,
 
  Lars Nielsen Lind
 
 What do you mean with retrive the files? As I understand 
 everything depends 
 on what are you going to do with this file ... put it to a 
 database or simply 
 remove it to another place??
 
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Hide download file

2002-07-17 Thread Lars Nielsen Lind

Cox, Charlie wrote:

is there a reason why you can't have the directory under webapps? In order
to do this you would need to write your own servlet that reads the file and
writes to the output stream. You should let Tomcat serve the file when
possible so that you don't have to implement all the http 1.1 features...

you can use a filter to control access to the static files.

you could also add a soft link under webapps that points to the real file.

Charlie

-Original Message-
From: Irina Lishchenko [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 17, 2002 1:44 PM
To: Tomcat Users List
Subject: Re: Hide download file


On Wednesday 17 July 2002 16:48, you wrote:

Hi.

We are using an Upload component to upload files to the server. The
files are placed in /fileserver/files - a directory outside 

of webapps.

Anyone that have example files on how to retrive the files 

(download)

via JavaBean/JSP from a directory outside of webapps?

Best regards,

Lars Nielsen Lind

What do you mean with retrive the files? As I understand 
everything depends 
on what are you going to do with this file ... put it to a 
database or simply 
remove it to another place??


--
To unsubscribe, e-mail:   

mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


I have found an article at www.javaworld.com about witing servlets for 
downloading non-html documents 
(http://www.javaworld.com/javatips/jw-javatip94_p.html).

But I want to control the access to the file download component with 
session variables. The user is given the right session variables when he 
fills out the download form.

Best regards,

Lars Nielsen Lind




--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: Hide download file

2002-07-17 Thread Cox, Charlie

I just answered this last week. Use a filter that checks the session and
leave your download files in a directory under webapps. Filters make this
simple. Don't do any more work than you need to :)

Charlie

 
 
 I have found an article at www.javaworld.com about witing 
 servlets for 
 downloading non-html documents 
 (http://www.javaworld.com/javatips/jw-javatip94_p.html).
 
 But I want to control the access to the file download component with 
 session variables. The user is given the right session 
 variables when he 
 fills out the download form.
 
 Best regards,
 
 Lars Nielsen Lind
 
 
 
 
 --
 To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Hide download file

2002-07-17 Thread Lars Nielsen Lind

Cox, Charlie wrote:

I just answered this last week. Use a filter that checks the session and
leave your download files in a directory under webapps. Filters make this
simple. Don't do any more work than you need to :)

Charlie


I have found an article at www.javaworld.com about witing 
servlets for 
downloading non-html documents 
(http://www.javaworld.com/javatips/jw-javatip94_p.html).

But I want to control the access to the file download component with 
session variables. The user is given the right session 
variables when he 
fills out the download form.

Best regards,

Lars Nielsen Lind




--
To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail: 
mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


Do you have some examples of user-defined filters for handling session 
variable defined access to download file(s)?

Best regards,

Lars Nielsen Lind



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




download file

2002-07-16 Thread @Basebeans.com

Subject: download file
From: J. Jason Zhou [EMAIL PROTECTED]
 ===
I have both Tomcat and IIS running on two machines. But when I download a
file (abc.xls) from Tomcat, the browser loads the binary content without
prompting uisng the save/open dialog while IIS did prompt before the
download.

http://machine/myapp/abc.xls

Can anybody tell me why?

--
Best Regards,

J. Jason Zhou
Business Intelligence Platform Division (BIP), R  D,
SAS Institute, 100 SAS Campus Dr.
Cary, North Carolina 27513-8617
Voice: 919-531-0568(O)
Email: [EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: download file

2002-07-16 Thread rsequeira


Did you set the mime-type set in the web.xml?

  mime-mapping
extensionxls/extension
mime-typeapplication/vnd.ms-excel/mime-type
  /mime-mapping

RS





jakarta-tom on 07/16/2002 09:10:03 AM

Please respond to Tomcat Users List [EMAIL PROTECTED]

To:[EMAIL PROTECTED]
cc:

Subject:download file

Subject: download file
From: J. Jason Zhou [EMAIL PROTECTED]
 ===
I have both Tomcat and IIS running on two machines. But when I download a
file (abc.xls) from Tomcat, the browser loads the binary content without
prompting uisng the save/open dialog while IIS did prompt before the
download.

http://machine/myapp/abc.xls

Can anybody tell me why?

--
Best Regards,

J. Jason Zhou
Business Intelligence Platform Division (BIP), R  D,
SAS Institute, 100 SAS Campus Dr.
Cary, North Carolina 27513-8617
Voice: 919-531-0568(O)
Email: [EMAIL PROTECTED]



--
To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail: 
mailto:[EMAIL PROTECTED]










--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: download file

2002-07-16 Thread Turner, John


Tomcat needs to know about MIME types.  Put MIME-mapping statements in your
web.xml file.

mime-mapping
extensionxls/extension
mime-typeapplication/vnd.ms-excel/mime-type
/mime-mapping

John Turner
[EMAIL PROTECTED]
  

-Original Message-
From: Jakarta Tomcat Newsgroup [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 16, 2002 10:10 AM
To: [EMAIL PROTECTED]
Subject: download file


Subject: download file
From: J. Jason Zhou [EMAIL PROTECTED]
 ===
I have both Tomcat and IIS running on two machines. But when I download a
file (abc.xls) from Tomcat, the browser loads the binary content without
prompting uisng the save/open dialog while IIS did prompt before the
download.

http://machine/myapp/abc.xls

Can anybody tell me why?

--
Best Regards,

J. Jason Zhou
Business Intelligence Platform Division (BIP), R  D,
SAS Institute, 100 SAS Campus Dr.
Cary, North Carolina 27513-8617
Voice: 919-531-0568(O)
Email: [EMAIL PROTECTED]



--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: How to hide a download file

2002-07-12 Thread Michael Rimov

At 11:43 AM 7/11/2002 -0500, you wrote:
I'm going to have to inevitably add it to my site soon, I was going to
approach it the same way, but with a servlet isn't it possible to pipe a
file by setting the response mime type and streaming it out as a PDF or
EXE.  Of course IE does it's own thing no matter the mime type.


Sure, I've been using Download management for some time.  Take a look at 
the code in the Expresso framework at:

http://www.jcorporate.com/

The particular class is:
 com.jcorporate.expresso.ext.controller.Download

Sets MIME types, and IE Does give it a proper filename even though the user 
doesn't know what path it came from.

HTH!
 -Mike



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




How to hide a download file

2002-07-11 Thread Kevin Passey

Hi all,

I need to pick your brains again.

I need to publish a site that requires a user to fill in a form before
displaying a download link.

What I need to do is to hide the file to be downloaded so that it cannot be
downloaded without the form being filled in - i.e it can only be downloaded
from a particular generated JSP page.

Can I do this with Tomcat?

Thanks in advance.


Kevin 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: How to hide a download file

2002-07-11 Thread Alex Short

Certainly not the most elegant solution but you could keep the real file 
in a unreachable location, and upon submitting it copy's the file to a 
cookie_date_time_filename.ext and has them download that.  Then you run a 
cleaner script to erase these temp files after 24 hours.

Alex

  Hi all,  
 I need to pick your brains again.
 
 I need to publish a site that requires a user to fill in a form before
 displaying a download link.
 
 What I need to do is to hide the file to be downloaded so that it cannot be
 downloaded without the form being filled in - i.e it can only be downloaded
 from a particular generated JSP page.
 
 Can I do this with Tomcat?
 
 Thanks in advance.
 
 
 Kevin 
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 
 
 
 


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: How to hide a download file

2002-07-11 Thread Jacob Hookom

I'm going to have to inevitably add it to my site soon, I was going to
approach it the same way, but with a servlet isn't it possible to pipe a
file by setting the response mime type and streaming it out as a PDF or
EXE.  Of course IE does it's own thing no matter the mime type. 

-Original Message-
From: Alex Short [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, July 11, 2002 11:36 AM
To: Tomcat Users List
Subject: Re: How to hide a download file

Certainly not the most elegant solution but you could keep the real file

in a unreachable location, and upon submitting it copy's the file to a 
cookie_date_time_filename.ext and has them download that.  Then you run
a 
cleaner script to erase these temp files after 24 hours.

Alex

  Hi all,  
 I need to pick your brains again.
 
 I need to publish a site that requires a user to fill in a form before
 displaying a download link.
 
 What I need to do is to hide the file to be downloaded so that it
cannot be
 downloaded without the form being filled in - i.e it can only be
downloaded
 from a particular generated JSP page.
 
 Can I do this with Tomcat?
 
 Thanks in advance.
 
 
 Kevin 
 
 --
 To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]
 
 
 
 


--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.373 / Virus Database: 208 - Release Date: 7/1/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.373 / Virus Database: 208 - Release Date: 7/1/2002
 


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: How to hide a download file

2002-07-11 Thread Turner, John


Off the top of my head, couldn't you pipe together a FileInputStream and a
ServletOutputStream ?

Something like:

- open input stream
- open output stream to browser
- read in file, piping it to output stream
- close file stream
- close servlet stream

The user would never know where the file is on the server, it could be
anywhere.  You'd have to make sure you passed the right content header to
the browser, so the browser would know what to do with the data it was
getting back.

Just brainstorming, it may not work.

John Turner
[EMAIL PROTECTED]


-Original Message-
From: Kevin Passey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 11, 2002 12:24 PM
To: Tomcat Users List (E-mail)
Subject: How to hide a download file


Hi all,

I need to pick your brains again.

I need to publish a site that requires a user to fill in a form before
displaying a download link.

What I need to do is to hide the file to be downloaded so that it cannot be
downloaded without the form being filled in - i.e it can only be downloaded
from a particular generated JSP page.

Can I do this with Tomcat?

Thanks in advance.


Kevin 

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: How to hide a download file

2002-07-11 Thread Cox, Charlie

you can use a filter to see if the referring page is your form and then
allow the download or redirect to your form appropriately. Alternatively,
you could set a value in the session that is only set by your form
submission that your filter can look for.

I do a similar thing in a filter where I verify a form has been filled out
by checking the database for the user. I also enforce a login to do this,
but you don't need to if you just put something in the session. 

Charlie

 -Original Message-
 From: Alex Short [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 11, 2002 12:36 PM
 To: Tomcat Users List
 Subject: Re: How to hide a download file
 
 
 Certainly not the most elegant solution but you could keep 
 the real file 
 in a unreachable location, and upon submitting it copy's the 
 file to a 
 cookie_date_time_filename.ext and has them download that.  
 Then you run a 
 cleaner script to erase these temp files after 24 hours.
 
 Alex
 
   Hi all,  
  I need to pick your brains again.
  
  I need to publish a site that requires a user to fill in a 
 form before
  displaying a download link.
  
  What I need to do is to hide the file to be downloaded so 
 that it cannot be
  downloaded without the form being filled in - i.e it can 
 only be downloaded
  from a particular generated JSP page.
  
  Can I do this with Tomcat?
  
  Thanks in advance.
  
  
  Kevin 
  
  --
  To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]
 
 
 
 


--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: How to hide a download file

2002-07-11 Thread Cox, Charlie

I originally tried this, but it became a pain because I didn't support
'Range' requests which sent the whole file(in my case 50MB) for each request
when someone used a download manager. 

A filter on the actual file is much more efficient since Tomcat can serve
the file when it needs to and it gets redirected when you want it to.

Charlie

 -Original Message-
 From: Turner, John [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 11, 2002 12:46 PM
 To: 'Tomcat Users List'
 Subject: RE: How to hide a download file
 
 
 
 Off the top of my head, couldn't you pipe together a 
 FileInputStream and a
 ServletOutputStream ?
 
 Something like:
 
 - open input stream
 - open output stream to browser
 - read in file, piping it to output stream
 - close file stream
 - close servlet stream
 
 The user would never know where the file is on the server, it could be
 anywhere.  You'd have to make sure you passed the right 
 content header to
 the browser, so the browser would know what to do with the data it was
 getting back.
 
 Just brainstorming, it may not work.
 
 John Turner
 [EMAIL PROTECTED]
 
 
 -Original Message-
 From: Kevin Passey [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 11, 2002 12:24 PM
 To: Tomcat Users List (E-mail)
 Subject: How to hide a download file
 
 
 Hi all,
 
 I need to pick your brains again.
 
 I need to publish a site that requires a user to fill in a form before
 displaying a download link.
 
 What I need to do is to hide the file to be downloaded so 
 that it cannot be
 downloaded without the form being filled in - i.e it can only 
 be downloaded
 from a particular generated JSP page.
 
 Can I do this with Tomcat?
 
 Thanks in advance.
 
 
 Kevin 
 
 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: How to hide a download file

2002-07-11 Thread Kevin Passey

I was thinking of setting something in the session for the download page
anyway which would direct a user back to the form.

But if I create a directory called downloads and put the file in there -
what's to stop someone just typing the folder URL and grabbing the file?

Thanks everyone for your input.

Kevin

-Original Message-
From: Cox, Charlie [mailto:[EMAIL PROTECTED]]
Sent: 11 July 2002 17:46
To: 'Tomcat Users List'
Subject: RE: How to hide a download file


you can use a filter to see if the referring page is your form and then
allow the download or redirect to your form appropriately. Alternatively,
you could set a value in the session that is only set by your form
submission that your filter can look for.

I do a similar thing in a filter where I verify a form has been filled out
by checking the database for the user. I also enforce a login to do this,
but you don't need to if you just put something in the session. 

Charlie

 -Original Message-
 From: Alex Short [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 11, 2002 12:36 PM
 To: Tomcat Users List
 Subject: Re: How to hide a download file
 
 
 Certainly not the most elegant solution but you could keep 
 the real file 
 in a unreachable location, and upon submitting it copy's the 
 file to a 
 cookie_date_time_filename.ext and has them download that.  
 Then you run a 
 cleaner script to erase these temp files after 24 hours.
 
 Alex
 
   Hi all,  
  I need to pick your brains again.
  
  I need to publish a site that requires a user to fill in a 
 form before
  displaying a download link.
  
  What I need to do is to hide the file to be downloaded so 
 that it cannot be
  downloaded without the form being filled in - i.e it can 
 only be downloaded
  from a particular generated JSP page.
  
  Can I do this with Tomcat?
  
  Thanks in advance.
  
  
  Kevin 
  
  --
  To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
mailto:[EMAIL PROTECTED]
 
 
 
 


--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: How to hide a download file

2002-07-11 Thread Cox, Charlie

your filter. it should look at the session and see that
'formfilledout=false' and redirect to the form without serving the file(call
response.redirect() instead of doChain()).

Charlie

 -Original Message-
 From: Kevin Passey [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 11, 2002 12:44 PM
 To: 'Tomcat Users List'
 Subject: RE: How to hide a download file
 
 
 I was thinking of setting something in the session for the 
 download page
 anyway which would direct a user back to the form.
 
 But if I create a directory called downloads and put the 
 file in there -
 what's to stop someone just typing the folder URL and 
 grabbing the file?
 
 Thanks everyone for your input.
 
 Kevin
 
 -Original Message-
 From: Cox, Charlie [mailto:[EMAIL PROTECTED]]
 Sent: 11 July 2002 17:46
 To: 'Tomcat Users List'
 Subject: RE: How to hide a download file
 
 
 you can use a filter to see if the referring page is your 
 form and then
 allow the download or redirect to your form appropriately. 
 Alternatively,
 you could set a value in the session that is only set by your form
 submission that your filter can look for.
 
 I do a similar thing in a filter where I verify a form has 
 been filled out
 by checking the database for the user. I also enforce a login 
 to do this,
 but you don't need to if you just put something in the session. 
 
 Charlie
 
  -Original Message-
  From: Alex Short [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, July 11, 2002 12:36 PM
  To: Tomcat Users List
  Subject: Re: How to hide a download file
  
  
  Certainly not the most elegant solution but you could keep 
  the real file 
  in a unreachable location, and upon submitting it copy's the 
  file to a 
  cookie_date_time_filename.ext and has them download that.  
  Then you run a 
  cleaner script to erase these temp files after 24 hours.
  
  Alex
  
Hi all,  
   I need to pick your brains again.
   
   I need to publish a site that requires a user to fill in a 
  form before
   displaying a download link.
   
   What I need to do is to hide the file to be downloaded so 
  that it cannot be
   downloaded without the form being filled in - i.e it can 
  only be downloaded
   from a particular generated JSP page.
   
   Can I do this with Tomcat?
   
   Thanks in advance.
   
   
   Kevin 
   
   --
   To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
  
  
  
  
 
 
 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 
 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: How to hide a download file

2002-07-11 Thread Eddie Bush

If you make them login, you could put a security constraint on your 
downloads directory.  That would pretty well seal it up, I believe =)

HTH,

Eddie

Kevin Passey wrote:
snip

But if I create a directory called downloads and put the file in there -
what's to stop someone just typing the folder URL and grabbing the file?

snip


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: How to hide a download file

2002-07-11 Thread Ian McFarland

Why don't you just handle it by putting something in their session 
saying that they filled out the form correctly, and write a downloader 
servlet that looks for that something, and will only send them the bits 
if they've filed out the form? Writing a servlet to send a file is 
pretty darned trivial. Writing one that knows something about session 
state is also pretty darned trivial.

This would look something like: /downloads/send/filename

...where you have a downloads webapp with a send servlet that exhibits 
the above characteristics. The filename could be gotten from the path 
info as shown here, or you could just use a query string, too.

It sounds like the issue you're having is trying to get the built-in 
file-serving servlet to do something it wasn't intended to do, rather 
than writing some code to do it for you.

Hope this helps...

-Ian

On Thursday, July 11, 2002, at 09:58 AM, Eddie Bush wrote:

 If you make them login, you could put a security constraint on your 
 downloads directory.  That would pretty well seal it up, I believe =)

 HTH,

 Eddie

 Kevin Passey wrote:
snip

 But if I create a directory called downloads and put the file in 
 there -
 what's to stop someone just typing the folder URL and grabbing the 
 file?

snip


 --
 To unsubscribe, e-mail:   mailto:tomcat-user-
 [EMAIL PROTECTED]
 For additional commands, e-mail: mailto:tomcat-user-
 [EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




AW: How to hide a download file

2002-07-11 Thread Ralph Einfeldt

That's not true in all cases. To implement servlets that
implement the complete HTTP 1.1 command set it takes some
knowledge about the spec and the servlet isn't trivial at
 all (have a look at the source of tomcats servlet that 
does this).

For the result the original poster desired there are 2 
simple solutions:
- to place the file in a protected directory and let 
  tomcat handle the authorisation (Form based login)
  and the serving of the file
- let tomcat serve the file and write a filter that
  handles the authorisation. (Denies accesss to the file
  if certain informations are not present)

 -Ursprüngliche Nachricht-
 Von: Ian McFarland [mailto:[EMAIL PROTECTED]]
 Gesendet: Freitag, 12. Juli 2002 00:59
 An: Tomcat Users List
 Betreff: Re: How to hide a download file
 
 Writing a servlet to send a file is pretty darned trivial.
 Writing one that knows something about session state is 
 also pretty darned trivial.
 

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




How download file from servlet?

2001-09-06 Thread Evgeniy Strokin

HI

I trying make servlet for downloading of files.
When I use:
FileInputStream fl=new FileInputStream(dir);
byte b[]=new byte[4096];
int len=0;
ServletOutputStream souts=_response.getOutputStream();
while(len!=-1){
  len=fl.read(b);
  if(len!=-1)souts.write(b,0,len);
}
I get:
E:1933 java.lang.IllegalStateException: Writer is already being used for
this request
In this string:
ServletOutputStream souts=_response.getOutputStream();

Anyway, maybe you know better way how do this thing?

Thanks
Jenya

---
NetZero Platinum
Only $9.95 per month!
Sign up in September to win one of 30 Hawaiian Vacations for 2!
http://my.netzero.net/s/signup?r=platinumrefcd=PT97



Re: How download file from servlet?

2001-09-06 Thread Craig R. McClanahan

On Thu, 6 Sep 2001, Evgeniy Strokin wrote:

 Date: Thu, 6 Sep 2001 11:43:56 -0400
 From: Evgeniy Strokin [EMAIL PROTECTED]
 Reply-To: [EMAIL PROTECTED]
 To: Tomcat-User@Jakarta. Apache. Org [EMAIL PROTECTED]
 Subject: How download file from servlet?

 HI

 I trying make servlet for downloading of files.
 When I use:
 FileInputStream fl=new FileInputStream(dir);
 byte b[]=new byte[4096];
 int len=0;
 ServletOutputStream souts=_response.getOutputStream();
 while(len!=-1){
   len=fl.read(b);
   if(len!=-1)souts.write(b,0,len);
 }
 I get:
 E:1933 java.lang.IllegalStateException: Writer is already being used for
 this request
 In this string:
 ServletOutputStream souts=_response.getOutputStream();

 Anyway, maybe you know better way how do this thing?


This error means that, somewhere while processing the same request, your
servlet called response.getWriter().  You can only get a writer *or* an
output stream for a particular response (depending on whether you want to
send characters or bytes).  You cannot get both.

 Thanks
 Jenya


Craig





RE: How download file from servlet?

2001-09-06 Thread Martin van den Bemt

There is already a _response.getWriter() or getOutputStream() before your
code snippet

Mvgr,
Martin

 -Original Message-
 From: Evgeniy Strokin [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 06, 2001 5:44 PM
 To: Tomcat-User@Jakarta. Apache. Org
 Subject: How download file from servlet?


 HI

 I trying make servlet for downloading of files.
 When I use:
 FileInputStream fl=new FileInputStream(dir);
 byte b[]=new byte[4096];
 int len=0;
 ServletOutputStream souts=_response.getOutputStream();
 while(len!=-1){
   len=fl.read(b);
   if(len!=-1)souts.write(b,0,len);
 }
 I get:
 E:1933 java.lang.IllegalStateException: Writer is already being used for
 this request
 In this string:
 ServletOutputStream souts=_response.getOutputStream();

 Anyway, maybe you know better way how do this thing?

 Thanks
 Jenya

 ---
 NetZero Platinum
 Only $9.95 per month!
 Sign up in September to win one of 30 Hawaiian Vacations for 2!
 http://my.netzero.net/s/signup?r=platinumrefcd=PT97





download file that is stored in a database

2001-02-25 Thread Mon-Quen Huang

I have a file stored in the backend Oracle database
and has JSP communicating with the database in JDBC. 
I would like to allow user to click on a hyperlink and
then download the file which is stored in the
database.
Is this possible?  If so, what are the steps to
implement it?

Thanks,

MH

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: download file that is stored in a database

2001-02-25 Thread Steve Ruby



Mon-Quen Huang wrote:
 
 I have a file stored in the backend Oracle database
 and has JSP communicating with the database in JDBC.
 I would like to allow user to click on a hyperlink and
 then download the file which is stored in the
 database.
 Is this possible?  If so, what are the steps to
 implement it?
 
 Thanks,
 
 MH
 

do a getBinaryStream(col Index) and return that to
response.getOutputStream via your choice of buffering
scheme.


make sure you set the mime type for the response depending
on the type of file you are returning (before you return stuff).

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




TOMCAT DOWNLOAD FILE WHERE??

2001-01-29 Thread R N Mukherjee


SUB:TOMACT DOWNLOAD FILE(WHERE??) AT JAKARTA FOR WIN98/NT

Dear all,
can anyone of you please tell which file to download for tomcat3.2.1 for
WIN98/NT OS.:
(http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.1/bin)




Index of /builds/jakarta-tomcat/release/v3.2.1/bin



 [DIR]  Parent Directory  08-Jan-2001 06:20  -  
 [   ]  jakarta-servletapi-3.2.tar.Z  12-Dec-2000 12:41   479k  tar archive
 [   ]  jakarta-servletapi-3.2.tar.gz 12-Dec-2000 12:41   223k  GZIP
compressed file
 [   ]  jakarta-servletapi-3.2.zip12-Dec-2000 12:41   426k  
 [TXT]  jakarta-tomcat-3.2.1.sea  09-Jan-2001 00:53   3.0M  
 [   ]  jakarta-tomcat-3.2.1.sea.hqx  09-Jan-2001 00:55   4.2M  
 [   ]  jakarta-tomcat-3.2.1.tar  12-Dec-2000 14:26   5.0M  tar archive
 [   ]  jakarta-tomcat-3.2.1.tar.gz   12-Dec-2000 14:29   2.7M  GZIP
compressed file
 [   ]  jakarta-tomcat-3.2.1.zip  12-Dec-2000 14:33   3.0M  
 [DIR]  netware/  12-Dec-2000 12:41  -  
 [DIR]  win32/12-Dec-2000 12:41  -  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: TOMCAT DOWNLOAD FILE WHERE??

2001-01-29 Thread Robuschi \(Delfi\)

The right file is

jakarta-tomcat-3.2.1.zip

Bye!!!

Roberto Robuschi


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: TOMCAT DOWNLOAD FILE WHERE??

2001-01-29 Thread Rick Smith

Download the jakarta-tomcat.3.2.1.zip file and probably the
jakarta-servletapi.zip file then go into
/builds/jakarta-tomcat/release/v3.2.1/bin/win32/i386 and get the *.zip
files there. Depending on your web server and whatever else is in the
setup instructions you will need some of these files. Then very
carefully follow the install instructions. 


Rick 

R N Mukherjee wrote:
 
 SUB:TOMACT DOWNLOAD FILE(WHERE??) AT JAKARTA FOR WIN98/NT
 
 Dear all,
 can anyone of you please tell which file to download for tomcat3.2.1 for
 WIN98/NT OS.:
 (http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.2.1/bin)
 
 Index of /builds/jakarta-tomcat/release/v3.2.1/bin
 
  [DIR]  Parent Directory  08-Jan-2001 06:20  -
  [   ]  jakarta-servletapi-3.2.tar.Z  12-Dec-2000 12:41   479k  tar archive
  [   ]  jakarta-servletapi-3.2.tar.gz 12-Dec-2000 12:41   223k  GZIP
 compressed file
  [   ]  jakarta-servletapi-3.2.zip12-Dec-2000 12:41   426k
  [TXT]  jakarta-tomcat-3.2.1.sea  09-Jan-2001 00:53   3.0M
  [   ]  jakarta-tomcat-3.2.1.sea.hqx  09-Jan-2001 00:55   4.2M
  [   ]  jakarta-tomcat-3.2.1.tar  12-Dec-2000 14:26   5.0M  tar archive
  [   ]  jakarta-tomcat-3.2.1.tar.gz   12-Dec-2000 14:29   2.7M  GZIP
 compressed file
  [   ]  jakarta-tomcat-3.2.1.zip  12-Dec-2000 14:33   3.0M
  [DIR]  netware/  12-Dec-2000 12:41  -
  [DIR]  win32/12-Dec-2000 12:41  -
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]