cancel
Showing results for 
Search instead for 
Did you mean: 

How to display binary content in EP 5.0?

Former Member
0 Kudos

I would like to display binary content in a http-response. Formerly using a BSP-Application in Web-AS I achieved this by something like

call method mserver->response->set_header_field(

name = 'Content-Type' value = mimetype ).

call method mserver->response->set_data( data = mimedata ).

Within the context of AbstractPortalComponent I dont find a way to set the content type in a way to directly display binary content in a PRT-Context.

What did I miss ..?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I know this is a little out of date but you can do the following:

__________________________________________________

/* Get the underlying HttpServletReponse object */

HttpServletResponse httpresp = response.getRequest().getServletResponse(true);

try {

// This seems to be required to get rid of any buffered

// content

httpresp.reset();

//Set appropriate content type here

httpresp.setContentType("application/pdf");

//write out data

//in this case just a PDF in string format

httpresp.getWriter().write(data);

} catch (Exception e) {

// handle errors appropriately

}

__________________________________________________

<b>NOTE:</b> I haven't tested this in a productive environment so test this fully before implementing

Michael