Search in sources :

Example 1 with TyrusHttpUpgradeHandler

use of org.glassfish.tyrus.servlet.TyrusHttpUpgradeHandler in project spring-framework by spring-projects.

the class GlassFishRequestUpgradeStrategy method handleSuccess.

@Override
protected void handleSuccess(HttpServletRequest request, HttpServletResponse response, UpgradeInfo upgradeInfo, TyrusUpgradeResponse upgradeResponse) throws IOException, ServletException {
    TyrusHttpUpgradeHandler handler = request.upgrade(TyrusHttpUpgradeHandler.class);
    Writer servletWriter = newServletWriter(handler);
    handler.preInit(upgradeInfo, servletWriter, request.getUserPrincipal() != null);
    response.setStatus(upgradeResponse.getStatus());
    upgradeResponse.getHeaders().forEach((key, value) -> response.addHeader(key, Utils.getHeaderFromList(value)));
    response.flushBuffer();
}
Also used : TyrusHttpUpgradeHandler(org.glassfish.tyrus.servlet.TyrusHttpUpgradeHandler) Writer(org.glassfish.tyrus.spi.Writer)

Aggregations

TyrusHttpUpgradeHandler (org.glassfish.tyrus.servlet.TyrusHttpUpgradeHandler)1 Writer (org.glassfish.tyrus.spi.Writer)1