?
Solved

How to expose Blob (Image) data via REST webservice

Posted on 2011-02-14
3
Medium Priority
?
1,179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Cyber Threats to Small Businesses (Part 2)

The evolving cybersecurity landscape presents SMBs with a host of new threats to their clients, their data, and their bottom line. In part 2 of this blog series, learn three quick processes Webroot’s CISO, Gary Hayslip, recommends to help small businesses beat modern threats.

Question has a verified solution.

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

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, …
In this post we will learn different types of Android Layout and some basics of an Android App.
The viewer will learn how to implement Singleton Design Pattern in Java.
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.
Suggested Courses
Course of the Month12 days, 8 hours left to enroll

777 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