예제 #1
0
  protected void triggerHeadersHandlers() {
    if (!headersHandlerTriggered) {
      headersHandlerTriggered = true;
      // if there are handlers call them
      if (headersHandler != null) {
        Handler<Void> handler;
        while ((handler = headersHandler.pollFirst()) != null) {
          handler.handle();
        }
      }

      // convert the cookies
      for (HttpCookie cookie : getCookies()) {
        appendHeader(Headers.SET_COOKIE, ServerCookieEncoder.encode(cookie));
      }

      //      // if there is a filter then putAt the right get
      //      if (filter != null) {
      //        // verify if the filter can filter this content
      //        if (filter.canFilter(getResponse.getHeaders().get("content-type"))) {
      //          getResponse.putHeader("content-encoding", filter.encoding());
      //        } else {
      //          // disable the filter
      //          filter = null;
      //        }
      //      }

      // if there is no content and method is not HEAD delete content-type, content-encoding
      if (!hasBody() && ctx.getRequest().getMethod() != Method.HEAD) {
        removeHeader("Content-Encoding");
        removeHeader("Content-Type");
      }
    }
  }
예제 #2
0
 protected void triggerEndHandlers() {
   if (endHandler != null) {
     Handler<Void> handler;
     while ((handler = endHandler.pollFirst()) != null) {
       handler.handle(null);
     }
   }
 }