congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
HttpServerResponse.responseHeaders
Code IndexAdd Tabnine to your IDE (free)

How to use
responseHeaders
method
in
reactor.netty.http.server.HttpServerResponse

Best Java code snippets using reactor.netty.http.server.HttpServerResponse.responseHeaders (Showing top 10 results out of 315)

origin: spring-projects/spring-framework

public ReactorServerHttpResponse(HttpServerResponse response, DataBufferFactory bufferFactory) {
  super(bufferFactory, new HttpHeaders(new NettyHeadersAdapter(response.responseHeaders())));
  Assert.notNull(response, "HttpServerResponse must not be null");
  this.response = response;
}
origin: org.springframework/spring-web

public ReactorServerHttpResponse(HttpServerResponse response, DataBufferFactory bufferFactory) {
  super(bufferFactory, new HttpHeaders(new NettyHeadersAdapter(response.responseHeaders())));
  Assert.notNull(response, "HttpServerResponse must not be null");
  this.response = response;
}
origin: org.springframework.boot/spring-boot

private CompressionPredicate getMimeTypesPredicate(String[] mimeTypes) {
  if (ObjectUtils.isEmpty(mimeTypes)) {
    return ALWAYS_COMPRESS;
  }
  return (request, response) -> {
    String contentType = response.responseHeaders()
        .get(HttpHeaderNames.CONTENT_TYPE);
    if (StringUtils.isEmpty(contentType)) {
      return false;
    }
    MimeType contentMimeType = MimeTypeUtils.parseMimeType(contentType);
    return Arrays.stream(mimeTypes).map(MimeTypeUtils::parseMimeType)
        .anyMatch((candidate) -> candidate.isCompatibleWith(contentMimeType));
  };
}
origin: apache/servicemix-bundles

@Override
protected void applyHeaders() {
  getHeaders().forEach((headerName, headerValues) -> {
    for (String value : headerValues) {
      this.response.responseHeaders().add(headerName, value);
    }
  });
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

public ReactorServerHttpResponse(HttpServerResponse response, DataBufferFactory bufferFactory) {
  super(bufferFactory, new HttpHeaders(new NettyHeadersAdapter(response.responseHeaders())));
  Assert.notNull(response, "HttpServerResponse must not be null");
  this.response = response;
}
origin: reactor/reactor-netty

@Nullable
static BiPredicate<HttpServerRequest, HttpServerResponse> compressPredicate(@Nullable BiPredicate<HttpServerRequest, HttpServerResponse> compressionPredicate,
    int minResponseSize) {
  if (minResponseSize <= 0) {
    if (compressionPredicate != null) {
      return compressionPredicate;
    }
    else {
      return null;
    }
  }
  BiPredicate<HttpServerRequest, HttpServerResponse> lengthPredicate =
      (req, res) -> {
        String length = res.responseHeaders()
                  .get(HttpHeaderNames.CONTENT_LENGTH);
        if (length == null) {
          return true;
        }
        try {
          return Long.parseLong(length) >= minResponseSize;
        }
        catch (NumberFormatException nfe) {
          return true;
        }
      };
  if (compressionPredicate != null) {
    lengthPredicate = lengthPredicate.and(compressionPredicate);
  }
  return lengthPredicate;
}
origin: io.projectreactor.netty/reactor-netty

@Nullable
static BiPredicate<HttpServerRequest, HttpServerResponse> compressPredicate(@Nullable BiPredicate<HttpServerRequest, HttpServerResponse> compressionPredicate,
    int minResponseSize) {
  if (minResponseSize <= 0) {
    if (compressionPredicate != null) {
      return compressionPredicate;
    }
    else {
      return null;
    }
  }
  BiPredicate<HttpServerRequest, HttpServerResponse> lengthPredicate =
      (req, res) -> {
        String length = res.responseHeaders()
                  .get(HttpHeaderNames.CONTENT_LENGTH);
        if (length == null) {
          return true;
        }
        try {
          return Long.parseLong(length) >= minResponseSize;
        }
        catch (NumberFormatException nfe) {
          return true;
        }
      };
  if (compressionPredicate != null) {
    lengthPredicate = lengthPredicate.and(compressionPredicate);
  }
  return lengthPredicate;
}
origin: reactor/reactor-netty

@Test
public void sendZipFileCompressionPredicate_3() throws IOException {
  Path path = Files.createTempFile(null, ".zip");
  Files.copy(this.getClass().getResourceAsStream("/zipFile.zip"), path, StandardCopyOption.REPLACE_EXISTING);
  path.toFile().deleteOnExit();
  try (FileSystem zipFs = FileSystems.newFileSystem(path, null)) {
    Path fromZipFile = zipFs.getPath("/largeFile.txt");
    long fileSize = Files.size(fromZipFile);
    assertSendFile(out -> out.addHeader("test", "test").sendFile(fromZipFile, 0, fileSize), true,
        -1, (req, res) -> !res.responseHeaders().contains("test"));
  }
}
origin: reactor/reactor-netty

@Test
public void sendZipFileCompressionPredicate_2() throws IOException {
  Path path = Files.createTempFile(null, ".zip");
  Files.copy(this.getClass().getResourceAsStream("/zipFile.zip"), path, StandardCopyOption.REPLACE_EXISTING);
  path.toFile().deleteOnExit();
  try (FileSystem zipFs = FileSystems.newFileSystem(path, null)) {
    Path fromZipFile = zipFs.getPath("/largeFile.txt");
    long fileSize = Files.size(fromZipFile);
    assertSendFile(out -> out.addHeader("test", "test").sendFile(fromZipFile, 0, fileSize), true,
        -1, (req, res) -> res.responseHeaders().contains("test"));
  }
}
origin: reactor/reactor-netty

.route(req -> req.uri().startsWith("/3"),
     (req, res) -> {
            res.responseHeaders().set("Content-Length", 2);
            return res.sendString(Mono.just("OK"));
            })
.route(req -> req.uri().startsWith("/6"),
     (req, res) -> {
            res.responseHeaders().set("Content-Length", 2);
            return res.sendHeaders();
            })
.route(req -> req.uri().startsWith("/9"),
     (req, res) -> {
            res.responseHeaders().set("Content-Length", 2);
            return res.send();
            }))
reactor.netty.http.serverHttpServerResponseresponseHeaders

Javadoc

Return headers sent back to the clients

Popular methods of HttpServerResponse

  • status
  • send
  • sendWebsocket
    Upgrade connection to Websocket. Mono and Callback are invoked on handshake success, otherwise the r
  • sendFile
  • header
    Set an outbound header, replacing any pre-existing value.
  • addCookie
    Add an outbound cookie
  • addHeader
    Add an outbound http header, appending the value if the header already exist.
  • alloc
  • sendGroups
  • sendNotFound
    Send 404 status HttpResponseStatus#NOT_FOUND.
  • sendObject
  • sendString
  • sendObject,
  • sendString,
  • chunkedTransfer,
  • compression,
  • headers,
  • options,
  • sendByteArray,
  • sendFileChunked,
  • sendHeaders

Popular in Java

  • Making http requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • compareTo (BigDecimal)
  • setContentView (Activity)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • BoxLayout (javax.swing)
  • JFileChooser (javax.swing)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now