Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty 9 as a Front-end Server


Shane,


hmmm there used to be a way... without wrapping the request, to do this, but the only way I can see now is to do fake the headers for an include.... but that will result in inefficient sending.

This use-case has come up from time to time, so I'll think about this and add a way for it to be done.   Can you open a bugzilla requesting this to remind me.

However, the otherway to proceed is to use the jetty API's.   In Jetty 9 the fast asynchronous sending of content can be achieved by something like:


                    final AsyncContext async = request.startAsync();

                    ((HttpOutput)response.getOutputStream()).sendContent(content,new Callback()
                    {
                        @Override
                        public void succeeded()
                        {  
                            async.complete();
                        }

                        @Override
                        public void failed(Throwable x)
                        {
                            LOG.debug(x);
                            async.complete();
                        }
                    });

Content can be a ByteBuffer (in which case it can be file mapped) or it can be an instanceof HttpContent, in which case it sets headers for you as well.


cheers







--
Greg Wilkins <gregw@xxxxxxxxxxx>
http://www.webtide.com
Developer advice and support from the Jetty & CometD experts.
Intalio, the modern way to build business applications.

Back to the top