Solved

How to expose Blob (Image) data via REST webservice

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
replace a word with other 1 44
How to automatically insert items to sell into Ebay.com 2 45
jdbc error in jsp application 20 44
eclipse apache tomcat admin console 52 96
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Online collaboration is quickly becoming embedded in the workplace, and its benefits are tangible. See what the current landscape looks like and what the future holds for collaboration tools and the future of work.
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 if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

785 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