Re: Securing File System Resources ?
Re: Securing File System Resources ?
- Subject: Re: Securing File System Resources ?
- From: Dov Rosenberg <email@hidden>
- Date: Tue, 13 Dec 2005 01:57:09 -0500
- Thread-topic: Securing File System Resources ?
The key is - this must be super fast and efficient. These applications
deliver a high volume of files and we would prefer making the interaction as
small and fast as possible. We do not want to burden the main processing
loop with serving files if possible. We would prefer this to occur in
completely different process than our application if possible.
On 12/13/05 1:11 AM, "Davin" <email@hidden> wrote:
> 4.) Use a component action.
>
> Wrap a hyperlink in a conditional making the hyperlink
> available to only authenticated users. Bind the
> hyperlink to a component action which downloads the
> file:
>
> import java.io.*;
>
> String filePath;
>
> WOActionResults downloadFile() {
> try
> {
> filePath =
> getFilePathForCurrentResourceToDownload();
> WOResponse response = new WOResponse();
> String contentType =
> WOApplication.application().resourceManager().contentTypeForResourceNamed(file
> path);
> response.setHeader(contentType, "content-type");
> File f = new File(filepath);
> int bufferSize = (f.length() < 1024*1024) ? (int)
> f.length() : 1024*1024;
> response.setContentStream(new FileInputStream(f),
> bufferSize, (int) f.length());
> String fileName = NSPathUtilities.lastPathComponent(
> filepath );
> response.setHeader("filename="+fileName,
> "content-disposition");
> return response;
> }
> catch (Exception e)
> {
> WOResponse response = new WOResponse();
> response.appendContentString("Error downloading
> file: " + e);
> return response;
> }
> }
>
> Davin.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Dov Rosenberg
Inquira Inc
370 Centerpointe Circle, ste 1178
Altamonte Springs, FL 32701
(407) 339-1177 x 102
(407) 339-6704 (fax)
email@hidden
AOL IM: dovrosenberg
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden