Binary file output via LiveSite AJAX component

I was hoping to be able to return a binary response (file) via the AjaxOutput option of a LiveSite component, specifically by directly writing to the HttpServletResponse (headers and output stream). Unfortunately, this generates an error "getWriter() has already been called for this response" - likely due to how the doOutputAjax **method in **com.interwoven.livesite.runtime.rendering.RenderingManager opens the PrintWriter **prior to executing the **ExternalAjaxOutputGenerator. I did try the HttpServletResponse.reset() option, but it doesn't seem to fix the issue.

My questions are:

  1. has anyone done this in TeamSite/LiveSite before, and
  2. is there any easy/alternative way I should be doing this?

This is using TeamSite 7.4.1.3.0.

Comments

  • In case anyone looks up this thread, I ended up just base64 encoding the file contents, using the standard AjaxOutput, and then encoding back to binary on the client side.

TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs