Solved

How to expose Blob (Image) data via REST webservice

Posted on 2011-02-14
3
1,155 Views
Last Modified: 2012-05-11
Hello,

I'm storing images in blob form in a MySql database table. I need to expose these images via a REST webservices and was wondering what my options are. The main option I see is to read the database, create the image and store it on the filesystem and send the path to the image in the REST response. Any other ideas here? I'm thinking I will use RESTeasy for my JAX-RS implementation. Thanks for the help!
0
Comment
Question by:cgray1223
  • 2
3 Comments
 
LVL 92

Expert Comment

by:objects
ID: 34894577
you shouldn't need to store it to file. for example the following shows how to return an image using a servlet http://helpdesk.objects.com.au/java/how-can-i-return-an-image-using-a-servlet
So you would map the appropriate path to something that returns the image
0
 

Author Comment

by:cgray1223
ID: 34898671
Thanks for the suggestion objects.  One other complication is the the consumer of the webservice needs to receive other data with the request, they're not just displaying the image.  They need to do some flash transformations on the image using the data coming in from the xml.
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 34901711
when the image is a component of the response then you could return the path to the image, and the client would need to make another request if they wanted the actual image
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
To properly understand GitHub, let’s divide it into two words ‘Git’ and ‘Hub’. Git is basically a ‘Distribution Version Control’ (DVC) and ‘Source Code Management’ (SCM) system widely used by software programmers while Hub means the efficient centre…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now