• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
WORedirect with a known MIME type?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

WORedirect with a known MIME type?


  • Subject: WORedirect with a known MIME type?
  • From: "email@hidden" <email@hidden>
  • Date: Sun, 09 Oct 2016 21:24:19 +0200

Hello there,

at the moment, my application can return a file to the user through

===
    WOResponse downloadFile(String mimeType, File path) {
        WOResponse wor=new WOResponse()
        wor.setHeader("$mimeType; name=\"$path.name\"","content-type")
        wor.setContent(path.getText("utf-8"))
        wor.disableClientCaching()
        wor.removeHeadersForKey("Cache-Control")
        wor.removeHeadersForKey("cache-control")
        wor.removeHeadersForKey("pragma")
        wor
    }
===

The 'path' though happens to map to an URL, accessible directly through the HTTP server (without a need to go through the application at all). Therefore, I would like to replace the code above by something like

===
    WORedirect downloadFile(String mimeType, File path) {
        WORedirect wor=new WORedirect(context())
        wor.setUrl(URLForFile(path))
        wor
    }
===

to save, especially for bigger files, the memory and CPU. Nevertheless, I can't see any way how to set the MIME type; is there any trick to do that?

Thanks,
OC


 _______________________________________________
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


  • Follow-Ups:
    • Re: WORedirect with a known MIME type?
      • From: Samuel Pelletier <email@hidden>
    • Re: WORedirect with a known MIME type?
      • From: Hugi Thordarson <email@hidden>
  • Prev by Date: Maven migration: last two hurdles
  • Next by Date: Re: Changes
  • Previous by thread: Re: Maven migration: last two hurdles
  • Next by thread: Re: WORedirect with a known MIME type?
  • Index(es):
    • Date
    • Thread