Package org.nutz.http

Examples of org.nutz.http.Response


    fw.write("abc");
    fw.flush();
    fw.close();
    req.getParams().put("file", f);
    FilePostSender sender = new FilePostSender(req);
    Response resp = sender.send();
    assertEquals("image&3", resp.getContent());
  }
View Full Code Here


        fw.write("abc");
        fw.flush();
        fw.close();
        req.getParams().put("file", f);
        FilePostSender sender = new FilePostSender(req);
        Response resp = sender.send();
        assertEquals("image&3", resp.getContent());
    }
View Full Code Here

  public static Map<String, Object> verify(String audience, String assertion) throws IOException {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("audience", audience);
    params.put("assertion", assertion);
    Request req = Request.create(VerifyURL, METHOD.POST, params);
    Response resp = Sender.create(req).send();
    if (resp.getStatus() != 200) {
      throw new RuntimeException("server resp code != 200");
    }
    return Json.fromJson(Map.class, Streams.utf8r(resp.getStream()));
  }
View Full Code Here

    if (!requestParams.containsKey("ticket")) {
      throw new SocialAuthException("Not ticket found!! Auth fail!! ->" + Json.toJson(requestParams));
    }
    String url = String.format("https://cas.sdo.com/cas/Validate.Ex?service=%s&ticket=%s", URLEncoder.encode(Mvcs.getReq().getRequestURL().toString(), Encoding.UTF8), requestParams.get("ticket"));
    System.out.println(url);
    Response resp = Http.get(url);
    byte[] d = new byte[1024];
    GZIPInputStream in = new GZIPInputStream(resp.getStream());
    in.read(d);
    String[] data = new String(d).trim().split("\n");
    System.out.println(Json.toJson(data));
    if ("yes".endsWith(data[0])) {
      String uid = data[1];
View Full Code Here

TOP

Related Classes of org.nutz.http.Response

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.