Solved

How to expose Blob (Image) data via REST webservice

Posted on 2011-02-14
3
1,141 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

771 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

10 Experts available now in Live!

Get 1:1 Help Now