os.close();
}
private static void demo2(String filePath, String encoding) throws IOException {
OutputStream os = Files.newOutputStream(Paths.get(filePath));
RequestContext rc = new RequestContext(os, new HashMap<String, String>(),
new HashMap<String, String>(),
new ArrayList<RequestContext.RCCookie>());
rc.setEncoding(encoding);
rc.setMimeType("text/plain");
rc.setStatusCode(205);
rc.setStatusText("Idemo dalje");
rc.addRCCookie(new RCCookie("korisnik", "perica", 3600, "127.0.0.1", "/"));
rc.addRCCookie(new RCCookie("zgrada", "B4", null, null, "/"));
// Only at this point will header be created and written...
rc.write("Čevapčići i Šiščevapčići.");
os.close();
}