All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clouway.friendlyserve.RsWithCookie Maven / Gradle / Ivy

package com.clouway.friendlyserve;

import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Map;

/**
 * @author Miroslav Genov ([email protected])
 */
public class RsWithCookie extends RsWrap {

  public RsWithCookie(Cookie cookie) {
    this(new RsEmpty(), cookie);
  }

  public RsWithCookie(final Response origin, final Cookie... cookie) {
    super(new Response() {
      @Override
      public Iterable cookies() {
        return Arrays.asList(cookie);
      }

      @Override
      public Status status() {
        return origin.status();
      }

      @Override
      public Map header() throws IOException {
        return origin.header();
      }

      @Override
      public InputStream body() throws IOException {
        return origin.body();
      }
    });
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy