Tabnine Logo
HttpServerResponse.addHeader
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: netifi-proteus/proteus-java

private Mono<Void> handle(HttpServerRequest req, HttpServerResponse res) {
 res.status(HttpResponseStatus.OK);
 res.addHeader("Content-Type", TextFormat.CONTENT_TYPE_004);
 return res.sendString(Mono.just(registry.scrape())).then();
}
origin: io.scalecube/scalecube-gateway-http

private Publisher<Void> methodNotAllowed(HttpServerResponse httpResponse) {
 return httpResponse.addHeader(ALLOW, POST.name()).status(METHOD_NOT_ALLOWED).send();
}
origin: scalecube/scalecube-services

private Publisher<Void> methodNotAllowed(HttpServerResponse httpResponse) {
 return httpResponse.addHeader(ALLOW, POST.name()).status(METHOD_NOT_ALLOWED).send();
}
origin: reactor/reactor-netty

@Test
public void sendZipFileCompressionSize_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(HttpHeaderNames.CONTENT_LENGTH, "1245")
                 .sendFile(fromZipFile, 0, fileSize), true, 2048, (req, res) -> true);
  }
}
origin: reactor/reactor-netty

@Test
public void sendZipFileCompressionSize_4() 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(HttpHeaderNames.CONTENT_LENGTH, "1245")
                 .sendFile(fromZipFile, 0, fileSize), true, 512, (req, res) -> false);
  }
}
origin: reactor/reactor-netty

@Test
public void sendZipFileCompressionSize_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(HttpHeaderNames.CONTENT_LENGTH, "1245")
                 .sendFile(fromZipFile, 0, fileSize), true, 512, null);
  }
}
origin: reactor/reactor-netty

@Test
public void sendZipFileCompressionSize_1() 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(HttpHeaderNames.CONTENT_LENGTH, "1245")
                 .sendFile(fromZipFile, 0, fileSize), true, 2048, null);
  }
}
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

@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

response.chunkedTransfer(false);
return response.addHeader("Content-type", "text/plain")
       .addHeader("Expires", "0")
       .addHeader("X-GPFDIST-VERSION",
           "Spring XD")
       .addHeader("X-GP-PROTO", "1")
       .addHeader("Cache-Control", "no-cache")
       .addHeader("Connection", "close")
       .options(NettyPipeline.SendOptions::flushOnEach)
       .send(bufferStream.doOnNext(d -> integer.getAndIncrement())
origin: reactor/reactor-netty

@Test
public void testDeferredHeader() {
  DisposableServer context =
      HttpServer.create()
           .host("localhost")
           .route(r -> r.get("/201", (req, res) -> res.addHeader
               ("Content-Length", "0")
                                 .status(HttpResponseStatus.CREATED)
                                 .sendHeaders()))
           .bindNow();
  createHttpClientForContextWithAddress(context)
      .headersWhen(h -> Mono.just(h.set("test", "test")).delayElement(Duration.ofSeconds(2)))
      .observe((c, s) -> System.out.println(s + "" + c))
      .get()
      .uri("/201")
      .responseContent()
      .repeat(4)
      .blockLast();
  context.disposeNow();
}
origin: reactor/reactor-netty

HttpServer.create()
     .host("localhost")
     .route(r -> r.put("/201", (req, res) -> res.addHeader("Content-Length", "0")
                           .status(HttpResponseStatus.CREATED)
                           .sendHeaders())
            .put("/204", (req, res) -> res.status(HttpResponseStatus.NO_CONTENT)
                           .sendHeaders())
            .get("/200", (req, res) -> res.addHeader("Content-Length", "0")
                           .sendHeaders()))
     .bindNow();
origin: reactor/reactor-netty

@Test
public void testCookie() {
  DisposableServer context =
      HttpServer.create()
           .host("localhost")
           .route(r -> r.get("/201",
               (req, res) -> res.addHeader("test",
                             req.cookies()
                               .get("test")
                               .stream()
                               .findFirst()
                               .get()
                               .value())
                        .status(HttpResponseStatus.CREATED)
                        .sendHeaders()))
           .bindNow();
  createHttpClientForContextWithAddress(context)
      .cookie("test", c -> c.setValue("lol"))
      .get()
      .uri("/201")
      .responseContent()
      .blockLast();
  context.disposeNow();
}
origin: reactor/reactor-netty

HttpServer.create()
     .host("localhost")
     .route(r -> r.get("/201", (req, res) -> res.addHeader
         ("Content-Length", "0")
                           .status(HttpResponseStatus.CREATED)
                (HttpResponseStatus.NO_CONTENT)
                           .sendHeaders())
            .get("/200", (req, res) -> res.addHeader("Content-Length", "0")
                           .sendHeaders()))
     .bindNow();
origin: reactor/reactor-netty

.route(r -> r.get("/", (request, response) -> {
  response.addHeader("X-CUSTOM", "12345");
reactor.netty.http.serverHttpServerResponseaddHeader

Javadoc

Add an outbound http header, appending the value if the header already exist.

Popular methods of HttpServerResponse

  • status
  • send
  • responseHeaders
    Return headers sent back to the clients
  • 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
  • alloc
  • sendGroups
  • sendNotFound
    Send 404 status HttpResponseStatus#NOT_FOUND.
  • sendObject
  • sendString
  • sendObject,
  • sendString,
  • chunkedTransfer,
  • compression,
  • headers,
  • options,
  • sendByteArray,
  • sendFileChunked,
  • sendHeaders

Popular in Java

  • Running tasks concurrently on multiple threads
  • setContentView (Activity)
  • findViewById (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Menu (java.awt)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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