this is a good idea. which one is faster:
returning the image as a stream or a direct link to a physical file in the
file system?
Onno Scheffers-3 wrote:
>
>>
>> Hi,
>> your understanding is correct, photos are under protected folders. and
>> the
>> scaling will be a problem, but do you think it is good to store photo in
>> the
>> database's blob field? and every rendering requires copying from database
>> to
>> a temporary file?
>
>
>
> You can spool the data from a BLOB straight back to the client without
> having to store it in a file first. You don't even need to fully load it
> into memory. Im using Hibernate + PostgreSQL in my projects. Here's a
> short
> example of a StreamResponse that returns a binary stream from a Blob.
>
> public InputStream getStream() throws IOException {
> [...]
> Blob blob = // SOME_RECORD.getData();
> if(blob == null) {
> [...]
> }
> try {
> return blob.getBinaryStream();
> } catch (SQLException e) {
> [...]
> }
> }
>
> Storing binary data in blobs makes a lot of things easier and we've never
> had any problems with it so far. You can always setup a database
> replication
> scheme to increase the database performance if you have an awful lot of
> visitors.
>
> regards,
>
> Onno
>
>
--
View this message in context:
http://www.nabble.com/t5%3A-protecting-data-from-public-access-tp23959208p23965764.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]