Class JettyBridgeResponseWriter

  • All Implemented Interfaces:
    org.glassfish.jersey.server.spi.ContainerResponseWriter

    public class JettyBridgeResponseWriter
    extends Object
    implements org.glassfish.jersey.server.spi.ContainerResponseWriter
    A ResponseWriter which copies that output of JAX-RS computation over to HttpServletResponse object used by the Jetty server.

    Since we're not running Jersey as a full server or as a servlet that Jetty knows about, we need to connect the response Jersey outputs with the actual objects that Jetty sends back to clients.

    Inspired and partially copied from the JettyHttpContainer.ResponseWriter class available in the jersey-container-jetty-http artifact.

    • Constructor Detail

      • JettyBridgeResponseWriter

        public JettyBridgeResponseWriter​(javax.servlet.http.HttpServletResponse httpServletResponse)
    • Method Detail

      • writeResponseStatusAndHeaders

        public OutputStream writeResponseStatusAndHeaders​(long contentLength,
                                                          org.glassfish.jersey.server.ContainerResponse context)
                                                   throws org.glassfish.jersey.server.ContainerException
        Specified by:
        writeResponseStatusAndHeaders in interface org.glassfish.jersey.server.spi.ContainerResponseWriter
        Throws:
        org.glassfish.jersey.server.ContainerException
      • suspend

        public boolean suspend​(long timeOut,
                               TimeUnit timeUnit,
                               org.glassfish.jersey.server.spi.ContainerResponseWriter.TimeoutHandler timeoutHandler)
        Specified by:
        suspend in interface org.glassfish.jersey.server.spi.ContainerResponseWriter
      • setSuspendTimeout

        public void setSuspendTimeout​(long timeOut,
                                      TimeUnit timeUnit)
                               throws IllegalStateException
        Specified by:
        setSuspendTimeout in interface org.glassfish.jersey.server.spi.ContainerResponseWriter
        Throws:
        IllegalStateException
      • commit

        public void commit()
        Specified by:
        commit in interface org.glassfish.jersey.server.spi.ContainerResponseWriter
      • failure

        public void failure​(Throwable error)
        Specified by:
        failure in interface org.glassfish.jersey.server.spi.ContainerResponseWriter
      • enableResponseBuffering

        public boolean enableResponseBuffering()
        Specified by:
        enableResponseBuffering in interface org.glassfish.jersey.server.spi.ContainerResponseWriter