Hi Chuck,
What you are doing is fine. If you only need to send one image file
you do not need to use "application/form-data". GET would be
inappropriate.
Paul.
On Jun 10, 2010, at 11:00 PM, Chuck Dascalos wrote:
> I want to do something as simple as this, send a file to the
> webservice, and return it's name.
>
> @Path("/processimage")
> public class ProcessImageResource {
>
> @POST
> @Consumes("image/jpg")
> @Produces("text/plain")
> public String processImage(File image) {
> return image.getName();
> }
> }
>
> Attempting to test this, using something like this...
>
> public void testProcessImage() {
> WebResource r;
>
> File bob = new File("lena.jpg");
>
> String responseMsg =
> r
> .path
> ("processimage").type(MediaType.something_here).post(String.class,
> bob);
> assertEquals("lena.jpg", responseMsg);
> }
>
> Would it be better to do this with a GET?
>
> Most of the Post examples I have seen show them sending in multipart
> form parameters. I only want to send in one parameter, so what
> should I use for mediatype?
>
> Thanks for any help at all.
>
> The New Busy think 9 to 5 is a cute idea. Combine multiple calendars
> with Hotmail. Get busy.