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

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

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

origin: spring-projects/spring-framework

@Override
protected void applyCookies() {
  for (String name : getCookies().keySet()) {
    for (ResponseCookie httpCookie : getCookies().get(name)) {
      Cookie cookie = new DefaultCookie(name, httpCookie.getValue());
      if (!httpCookie.getMaxAge().isNegative()) {
        cookie.setMaxAge(httpCookie.getMaxAge().getSeconds());
      }
      if (httpCookie.getDomain() != null) {
        cookie.setDomain(httpCookie.getDomain());
      }
      if (httpCookie.getPath() != null) {
        cookie.setPath(httpCookie.getPath());
      }
      cookie.setSecure(httpCookie.isSecure());
      cookie.setHttpOnly(httpCookie.isHttpOnly());
      this.response.addCookie(cookie);
    }
  }
}
origin: org.springframework/spring-web

@Override
protected void applyCookies() {
  for (String name : getCookies().keySet()) {
    for (ResponseCookie httpCookie : getCookies().get(name)) {
      Cookie cookie = new DefaultCookie(name, httpCookie.getValue());
      if (!httpCookie.getMaxAge().isNegative()) {
        cookie.setMaxAge(httpCookie.getMaxAge().getSeconds());
      }
      if (httpCookie.getDomain() != null) {
        cookie.setDomain(httpCookie.getDomain());
      }
      if (httpCookie.getPath() != null) {
        cookie.setPath(httpCookie.getPath());
      }
      cookie.setSecure(httpCookie.isSecure());
      cookie.setHttpOnly(httpCookie.isHttpOnly());
      this.response.addCookie(cookie);
    }
  }
}
origin: reactor/reactor-netty

.port(0)
.cookieCodec(ServerCookieEncoder.LAX, ServerCookieDecoder.LAX)
.handle((req, res) -> res.addCookie(new DefaultCookie("cookie1", "test_value"))
             .sendString(Mono.just("test")))
.wiretap(true)
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

@Override
protected void applyCookies() {
  for (String name : getCookies().keySet()) {
    for (ResponseCookie httpCookie : getCookies().get(name)) {
      Cookie cookie = new DefaultCookie(name, httpCookie.getValue());
      if (!httpCookie.getMaxAge().isNegative()) {
        cookie.setMaxAge(httpCookie.getMaxAge().getSeconds());
      }
      if (httpCookie.getDomain() != null) {
        cookie.setDomain(httpCookie.getDomain());
      }
      if (httpCookie.getPath() != null) {
        cookie.setPath(httpCookie.getPath());
      }
      cookie.setSecure(httpCookie.isSecure());
      cookie.setHttpOnly(httpCookie.isHttpOnly());
      this.response.addCookie(cookie);
    }
  }
}
origin: reactor/reactor-netty

@Test
public void clientWithoutCookieGetsANewOneFromServer() {
  DisposableServer server =
      HttpServer.create()
           .port(0)
           .route(r -> r.get("/test", (req, resp) ->
                    resp.addCookie(new DefaultCookie("cookie1", "test_value"))
                      .send(req.receive()
                           .log("server received"))))
           .wiretap(true)
           .bindNow();
  Mono<Map<CharSequence, Set<Cookie>>> cookieResponse =
      HttpClient.create()
           .port(server.port())
           .wiretap(true)
           .get()
           .uri("/test")
           .responseSingle((res, buf) -> Mono.just(res.cookies()))
           .doOnSuccess(System.out::println)
           .doOnError(t -> System.err.println("Failed requesting server: " + t.getMessage()));
  StepVerifier.create(cookieResponse)
        .expectNextMatches(l -> {
          Set<Cookie> cookies = l.get("cookie1");
          return cookies.stream().anyMatch(e -> e.value().equals("test_value"));
        })
        .expectComplete()
        .verify(Duration.ofSeconds(30));
  server.disposeNow();
}
origin: apache/servicemix-bundles

@Override
protected void applyCookies() {
  for (String name : getCookies().keySet()) {
    for (ResponseCookie httpCookie : getCookies().get(name)) {
      Cookie cookie = new DefaultCookie(name, httpCookie.getValue());
      if (!httpCookie.getMaxAge().isNegative()) {
        cookie.setMaxAge(httpCookie.getMaxAge().getSeconds());
      }
      if (httpCookie.getDomain() != null) {
        cookie.setDomain(httpCookie.getDomain());
      }
      if (httpCookie.getPath() != null) {
        cookie.setPath(httpCookie.getPath());
      }
      cookie.setSecure(httpCookie.isSecure());
      cookie.setHttpOnly(httpCookie.isHttpOnly());
      this.response.addCookie(cookie);
    }
  }
}
reactor.netty.http.serverHttpServerResponseaddCookie

Javadoc

Add an outbound cookie

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.
  • 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

  • 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
  • Top PhpStorm plugins
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