Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Fwd: BOSH on ebmedded Jetty - server side.

It's good to hear it's possible but how to do that it's not clear. Are there a guidelines, documentation how this can be done?

Here is the code in our custom HttpServlet (the same is for doPost):

protected void doGet(HttpServletRequest request,
        HttpServletResponse response) throws ServletException,
    IOException {
        String rBody = readRequestContent(request);
        request.startAsync(request, response);
        AsyncContext acont = request.getAsyncContext();

        class MT extends Thread {
            AsyncContext acont;
            public MT(AsyncContext acont) {
                this.acont = acont;
            public void run() {
                try {
                } catch (InterruptedException e) {}

                HttpServletRequest req = (HttpServletRequest) acont.getRequest();
                HttpServletResponse resp = (HttpServletResponse) acont.getResponse();
                try {
                    resp.getWriter().println("<h1>Hello from HelloServlet</h1>");
                } catch (IOException e) {

        new MT(acont).start();


Our HTTP client sends several requests and doesn't wait for a response before sending the next request.
We expect to get into this method before sending a response after 2000 mseconds but it never happens.

вт, 23 июл. 2019 г. в 21:35, Simone Bordet <sbordet@xxxxxxxxxxx>:

On Tue, Jul 23, 2019 at 6:40 PM Sergey O <osnsergey@xxxxxxxxx> wrote:
> The problem is that we already have a client which we do not want to modify. It supports some BOSH subset (over one connection).
> CometD is not an options for us...

Well, then it's fairly easy to implement BOSH on the server if you
already have the client, it's basically just about handling the

Simone Bordet
Developer advice, training, services and support
from the Jetty & CometD experts.
jetty-users mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top