Search code examples
javaajaxservletszk

Get Servlet Output Stream in ZK


In case of Servlets we have,

protected void doGet(HttpServletRequest req, HttpServletResponse resp){
    resp.getOuputStream().write(somthing);
    }

the above gives servlet output stream is there any way in ZK to do the same.


Solution

  • What's your real use-case for this ?

    If you are writing some details in html , it's better to use zk component directly.

    In some case you could get the response from the execution.

    ((HttpServletResponse)Executions.getCurrent().getNativeResponse()).getOutputStream()
    

    But I don't think that's a good idea, be sure you know what you are exactly doing before you use this approach.

    It's better to provide your use-case instead of code snippets.