Project

General

Profile

Actions

Support #2023

closed

how to perform multipart response

Added by go mac almost 11 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
07/11/2013
Due date:
% Done:

0%

Estimated time:

Description

Hi,

I have created a RESTful web service that processes a multipart request from an iPhone app, which includes an image and some text. I can extract my payload using getParameter and getUploadedFile.

I can return a response containing an image. The only way I could get it to work was using WStreamResource. This is what I do to return the image (the image file name is in picker*->fileName*.c_str(). My resource class has a parent of WStreamResource

// load image into stream

std::ifstream outImage(picker*->fileName*.c_str(), std::ios::in | std::ios::binary);

// stream response

handleRequestPiecewise(request, response, outImage);

Earlier attempts used WResource but streaming the image file to response.out() didn't seem to work, i.e. the entire file didn't seem to be getting sent in the response.

I would now like the response to be multipart and return, not just the image, but some text as well. How can I load up the multipart response?

regards,

Gordon

Actions #1

Updated by Wim Dumon almost 11 years ago

  • Status changed from New to Resolved

Hello Gordon,

There's currently no provision to support this from a WResource, so you will have to implement the multipart mechanism yourself (which is not too difficult).

We did implement multipart support in our email classes, they can serve as inspiration but the implementation is probably too complex for your case (7-bit ascii and different mail client behaviour...). Maybe take a look at the examples on wikipedia? http://en.wikipedia.org/wiki/MIME#Multipart_messages

BR,

Wim.

Actions #2

Updated by Koen Deforche almost 11 years ago

  • Assignee set to Wim Dumon
Actions #3

Updated by Koen Deforche over 10 years ago

  • Status changed from Resolved to Closed
  • Target version set to 3.3.1
Actions

Also available in: Atom PDF