}
private void serializeAMFMessage(HttpServletResponse resp, AMFMessage message) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
AMFSerializer serializer = new AMFSerializer(dos);
serializer.serializeMessage(message);
resp.setContentType("application/x-amf");
resp.setContentLength(baos.size());
ServletOutputStream sos = resp.getOutputStream();
baos.writeTo(sos);
sos.flush();