Should be, using your ServletResponse res
res.setContentType( "image/jpeg" );
PrintWriter out = res.getWriter();
out.println( jpgdata );
Though I have a feeling the PrintWriter isn't the right class to use for the output (it'll probably interpret the funny char's in the jpgdata), but I don't know what to recommend to use instead.