Package com.sun.net.httpserver

Examples of com.sun.net.httpserver.Headers


    StringBuffer sb = new StringBuffer();
    sb = Handler.getElementByObject(sb, r);
    byte[] rb = sb.toString().getBytes("utf-8");

    Headers hd = httpExchange.getResponseHeaders();
    hd.put("Content-Type", Arrays.asList("text/plain; charset=utf-8"));
    hd.put("Content-Length", Arrays.asList(Long.toString(rb.length + 2)));

    httpExchange.sendResponseHeaders(200, rb.length + 2);
    OutputStream w = httpExchange.getResponseBody();
    w.write(rb);
    w.write("\r\n".getBytes());
View Full Code Here


    StringBuffer sb = new StringBuffer();
    sb = Handler.getElementByObject(sb, r);
    byte[] rb = sb.toString().getBytes("utf-8");

    Headers hd = httpExchange.getResponseHeaders();
    hd.put("Content-Type", Arrays.asList("text/plain; charset=utf-8"));
    hd.put("Content-Length", Arrays.asList(Long.toString(rb.length + 2)));

    httpExchange.sendResponseHeaders(200, rb.length + 2);
    OutputStream w = httpExchange.getResponseBody();
    w.write(rb);
    w.write("\r\n".getBytes());
View Full Code Here

    StringBuffer sb = new StringBuffer();
    sb = Handler.getElementByObject(sb, r);
    byte[] rb = sb.toString().getBytes("utf-8");

    Headers hd = httpExchange.getResponseHeaders();
    hd.put("Content-Type", Arrays.asList("text/plain; charset=utf-8"));
    hd.put("Content-Length", Arrays.asList(Long.toString(rb.length + 2)));

    httpExchange.sendResponseHeaders(200, rb.length + 2);
    OutputStream w = httpExchange.getResponseBody();
    w.write(rb);
    w.write("\r\n".getBytes());
View Full Code Here

    StringBuffer sb = new StringBuffer();
    sb = Handler.getElementByObject(sb, r);
    byte[] rb = sb.toString().getBytes("utf-8");

    Headers hd = httpExchange.getResponseHeaders();
    hd.put("Content-Type", Arrays.asList("text/plain; charset=utf-8"));
    hd.put("Content-Length", Arrays.asList(Long.toString(rb.length + 2)));

    httpExchange.sendResponseHeaders(200, rb.length + 2);
    OutputStream w = httpExchange.getResponseBody();
    w.write(rb);
    w.write("\r\n".getBytes());
View Full Code Here

    StringBuffer sb = new StringBuffer();
    sb = Handler.getElementByObject(sb, r);
    byte[] rb = sb.toString().getBytes("utf-8");

    Headers hd = httpExchange.getResponseHeaders();
    hd.put("Content-Type", Arrays.asList("text/plain; charset=utf-8"));
    hd.put("Content-Length", Arrays.asList(Long.toString(rb.length + 2)));

    httpExchange.sendResponseHeaders(200, rb.length + 2);
    OutputStream w = httpExchange.getResponseBody();
    w.write(rb);
    w.write("\r\n".getBytes());
View Full Code Here

    StringBuffer sb = new StringBuffer();
    sb = Handler.getElementByObject(sb, r);
    byte[] rb = sb.toString().getBytes("utf-8");

    Headers hd = httpExchange.getResponseHeaders();
    hd.put("Content-Type", Arrays.asList("text/plain; charset=utf-8"));
    hd.put("Content-Length", Arrays.asList(Long.toString(rb.length + 2)));

    httpExchange.sendResponseHeaders(200, rb.length + 2);
    OutputStream w = httpExchange.getResponseBody();
    w.write(rb);
    w.write("\r\n".getBytes());
View Full Code Here

    StringBuffer sb = new StringBuffer();
    sb = Handler.getElementByObject(sb, r);
    byte[] rb = sb.toString().getBytes("utf-8");

    Headers hd = httpExchange.getResponseHeaders();
    hd.put("Content-Type", Arrays.asList("text/plain; charset=utf-8"));
    hd.put("Content-Length", Arrays.asList(Long.toString(rb.length + 2)));

    httpExchange.sendResponseHeaders(200, rb.length + 2);
    OutputStream w = httpExchange.getResponseBody();
    w.write(rb);
    w.write("\r\n".getBytes());
View Full Code Here

  public void writeLogToFile(Object[] objs, HttpExchange httpExchange,
      ITaskAPI ta) throws SysException, IOException {
    ta.writeLogToFile(((Long) (objs[0])).longValue(), ((File) (objs[1])),
        ((String) (objs[2])));

    Headers hd = httpExchange.getResponseHeaders();
    hd.put("Content-Type", Arrays.asList("text/plain; charset=utf-8"));
    hd.put("Content-Length", Arrays.asList(Long.toString(2)));
    httpExchange.sendResponseHeaders(200, 2);
    OutputStream w = httpExchange.getResponseBody();
    w.write("\r\n".getBytes());
    w.close();
  }
View Full Code Here

    //  System.out.println("!!! l = " + rb.length);
    //  Object o = Handler.getObjectByElement(sb.toString());
    //  System.out.println("!!! object.class = " + o.getClass());
    //}

    Headers hd = httpExchange.getResponseHeaders();
    hd.put("Content-Type", Arrays.asList("text/plain; charset=utf-8"));
    hd.put("Content-Length", Arrays.asList(Long.toString(rb.length + 2)));

    OutputStream w = httpExchange.getResponseBody();
    httpExchange.sendResponseHeaders(200, rb.length + 2);
    w.write(rb);
    w.write("\r\n".getBytes());
View Full Code Here

              byte[] buf = res.toString().getBytes(enc);
              is = new ByteArrayInputStream(buf);
              l = buf.length;
            }

            Headers hd = httpExchange.getResponseHeaders();
            hd.put("Content-Type", Arrays.asList("text/plain; charset=" + enc));
            hd.put("Content-Length", Arrays.asList(Long.toString(l)));
            String h = cntx.getFullName(grp_out, "hdrs.");
            Map<String, Object> result = cntx.getGroupParams(grp_out);
            for (Map.Entry<String, Object> e : result.entrySet()) {
              String k = e.getKey();
              if (k.indexOf(h) == 0) {
                k = k.substring(h.length());
                Object o = e.getValue();
                String v;
                if (o != null && o instanceof IDependentParam) {
                  IDependentParam idp = (IDependentParam)o;
                  try {
                    o = idp.getValue(cntx);
                  } catch (CalculateException e1) {
                    e1.printStackTrace();
                  }
                }
                if (o == null)
                  continue;
                v = Strings.getString(o);
                hd.put(k, Arrays.asList(v));
              }
            }
            httpExchange.sendResponseHeaders(200, l);
            OutputStream w = httpExchange.getResponseBody();
            byte[] buf = new byte[8 * 1024];
 
View Full Code Here

TOP

Related Classes of com.sun.net.httpserver.Headers

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.