Examples of PostRequest


Examples of com.apitrary.api.request.PostRequest

    if (entity == null) {
      throw new ApitraryOrmException("Cannot persist null entity");
    }
    log.debug("Saving " + entity.getClass());

    PostRequest request = new PostRequest();
    request.setEntity(resolveApitraryEntity(entity));

    String payload = marshall(entity);

    request.setRequestPayload(payload);

    PostResponse response = resolveApitraryClient().send(request);

    if (HttpStatus.Created.ordinal() == response.getStatusCode()) {
      return (T) new PostResponseUnmarshaller().unMarshall(response, entity);
View Full Code Here

Examples of org.eclipse.ecf.internal.bulletinboard.commons.webapp.PostRequest

  protected WebRequest createMemberGroupListRequest() {
    return new GetRequest(httpClient, url, "groupcp.php");
  }

  public boolean login(IBBCredentials credentials) throws BBException {
    PostRequest request = new PostRequest(httpClient, url, "login.php");
    NameValuePair params[] = {
        new NameValuePair("username", credentials.getUsername()),
        new NameValuePair("password", credentials.getPassword()),
        // disabled checkbox: new NameValuePair("autologin", "on"),
        new NameValuePair("redirect", ""),
        new NameValuePair("login", "Log in") };
    request.setParameters(params);

    try {
      request.execute();
      request.releaseConnection();
      Map<String, String> detectedCookies = PHPBBCookies
          .detectCookies(httpClient.getState().getCookies());
      if (detectedCookies.containsKey(PHPBBCookies.KEY_SESS_ID)) {
        // We have a session id
        sessionId = detectedCookies.get(PHPBBCookies.KEY_SESS_ID);
View Full Code Here

Examples of org.xadoop.servlet.utils.PostRequest

  public static final String ACTIONNAME = "login";

  public AbstractResult execute(HttpServletRequest req) {

    // get required parameters
    PostRequest postReq = new PostRequest();
    try {
      postReq.parse(req, null, false);
    } catch (Exception e) {
      return new Failure(e.getMessage());
    }
    String username = postReq.getFormField(LoginPage.USERNAME);
    String enteredPw = postReq.getFormField(LoginPage.PASSWORD);
    if (username == null) {
      return new Failure("No username given.");
    }
    if (username.length() > 40) {
      return new Failure("Too long username entered.");
View Full Code Here

Examples of org.xlightweb.PostRequest

          ConnectionUtils.registerMBean(server);
         
          HttpClient httpClient = new HttpClient();

          IHttpResponse response = httpClient.call(new PostRequest("http://localhost:" + server.getLocalPort() + "/s/", new NameValuePair("param", "value"), new NameValuePair("param2", "value2")));
          Assert.assertEquals(200, response.getStatus());

          QAUtil.sleep(1000);

         
View Full Code Here

Examples of org.xlightweb.PostRequest

        Assert.assertEquals("test", resp.getBlockingBody().readString());
       
       
        QAUtil.sleep(1000);
       
        resp = httpClient.call(new PostRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, resp.getStatus());
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
        Assert.assertEquals("test", resp.getBlockingBody().readString());

       
View Full Code Here

Examples of org.xlightweb.PostRequest

        Assert.assertEquals("test", resp.getBody().readString());
       
       
        QAUtil.sleep(1000);
       
        resp = httpClient.call(new PostRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, resp.getStatus());
        Assert.assertNull(resp.getHeader(CacheHandler.XHEADER_NAME));
        Assert.assertEquals("test", resp.getBody().readString());

       
View Full Code Here

Examples of org.xlightweb.PostRequest

          ConnectionUtils.registerMBean(server);
         
          HttpClient httpClient = new HttpClient();

          IHttpResponse response = httpClient.call(new PostRequest("http://localhost:" + server.getLocalPort() + "/s/", new String[] { "param=value", "param2=value2" }));
          Assert.assertEquals(200, response.getStatus());

          QAUtil.sleep(1000);

         
View Full Code Here

Examples of org.xlightweb.PostRequest

   
    HttpServer server = new HttpServer(new RequestHandler());
    server.start();
   
    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
    IHttpResponse response = con.call(new PostRequest("/", "test/plain", "test"));
   
    Assert.assertEquals(200, response.getStatus());
    Assert.assertEquals("it works", response.getBody().toString());
 
    con.close();
View Full Code Here

Examples of org.xlightweb.PostRequest

   
    IHttpRequestHandler filter = new IHttpRequestHandler() {

      public void onRequest(final IHttpExchange exchange) throws IOException {

        PostRequest newRequest = new PostRequest(exchange.getRequest().getRequestUrl().toString(), "text/plain", "Hello");
       
        IHttpResponseHandler respHdl = new IHttpResponseHandler() {
       
          public void onResponse(IHttpResponse response) throws IOException {
            exchange.send(response);
          }
         
          public void onException(IOException ioe) {
           
          }
         
        };
       
       
        exchange.forward(newRequest, respHdl);
      }
    };
   
   
    chain.addLast(filter);
    chain.addLast(new EchoHandler());
   
    IServer server = new HttpServer(0, chain);
    ConnectionUtils.start(server);
   
   
    PostRequest req = new PostRequest("http://localhost:" + server.getLocalPort() + "/", "text/plain", "test123456");
    req.setHeader("Host", "localhost");
    req.setHeader("User-Agent", "me");

   
    IBlockingConnection con = new BlockingConnection("localhost", server.getLocalPort());

    con.write(req.toString());
     
    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    int contentLength = QAUtil.readContentLength(header);
     
    String body = con.readStringByLength(contentLength);
View Full Code Here

Examples of org.xlightweb.PostRequest

   
    IServer server = new HttpServer(0, chain);
    ConnectionUtils.start(server);
   
   
    PostRequest req = new PostRequest("http://localhost:" + server.getLocalPort() + "/", "text/plain", "test123456");
    req.setHeader("Host", "localhost");
    req.setHeader("User-Agent", "me");

   
    IBlockingConnection con = new BlockingConnection("localhost", server.getLocalPort());

    con.write(req.toString());
     
    String header = con.readStringByDelimiter("\r\n\r\n") + "\r\n";
    int contentLength = QAUtil.readContentLength(header);
     
    String body = con.readStringByLength(contentLength);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.