Package com.dyuproject.util.http

Examples of com.dyuproject.util.http.HttpConnector$Response


  public void deleteAttachment(ERS3Attachment attachment)
      throws MalformedURLException, IOException {
    AWSAuthConnection conn = attachment.awsConnection();
    String bucket = attachment.bucket();
    String key = attachment.key();
    Response response = conn.delete(bucket, key, null);
    if (failed(response)) {
      throw new IOException("Failed to delete '" + bucket + "/" + key
          + "' to S3: Error " + response.connection.getResponseCode()
          + ": " + response.connection.getResponseMessage());
    }
View Full Code Here


          headers.put("Content-Disposition", Arrays
              .asList(new String[] { "attachment; filename="
                  + originalFileName }));
        }

        Response response = conn.putStream(bucket, key,
            attachmentStreamObject, headers);
        if (failed(response)) {
          throw new IOException("Failed to write '" + bucket + "/"
              + key + "' to S3: Error "
              + response.connection.getResponseCode() + ": "
View Full Code Here

   
    public static Response serviceGET(String serviceUrl, ConsumerContext context, Endpoint ep,
            Token token, HttpServletRequest request, HttpServletResponse response)
            throws IOException
    {
        HttpConnector connector = context.getHttpConnector();
        UrlEncodedParameterMap params = new UrlEncodedParameterMap(serviceUrl);
        context.getNonceAndTimestamp().put(params, token.getCk());
        Parameter authorization = new Parameter("Authorization",
                HttpAuthTransport.getAuthHeaderValue(params, ep, token,
                context.getNonceAndTimestamp(),  ep.getSignature()));
        return connector.doGET(params.getUrl(), authorization);
       
    }
View Full Code Here

   
    public static Response serviceGET(String serviceUrl, ConsumerContext context, Endpoint ep,
            Token token, HttpServletRequest request, HttpServletResponse response)
            throws IOException
    {
        HttpConnector connector = context.getHttpConnector();
        UrlEncodedParameterMap params = new UrlEncodedParameterMap(serviceUrl);
        context.getNonceAndTimestamp().put(params, token.getCk());
        Parameter authorization = new Parameter("Authorization",
                HttpAuthTransport.getAuthHeaderValue(params, ep, token,
                context.getNonceAndTimestamp(),  ep.getSignature()));
        return connector.doGET(params.getUrl(), authorization);
       
    }
View Full Code Here

        Association association = associationParam==null ? new DiffieHellmanAssociation() :
            (Association)newObjectInstance(associationParam);
       
        // http connector
        String httpConnectorParam = properties.getProperty("openid.httpconnector");
        HttpConnector httpConnector = httpConnectorParam==null ? new SimpleHttpConnector() :
            (HttpConnector)newObjectInstance(httpConnectorParam);      
       
        // user manager
        String managerParam = properties.getProperty("openid.user.manager");
        OpenIdUserManager manager = managerParam == null ? new HttpSessionUserManager() :
View Full Code Here

     * Creates a new instance configured form the {@link Properties} {@code props}.
     */
    public static Consumer newInstance(Properties props) throws IOException
    {
        String httpConnectorParam = props.getProperty("oauth.consumer.httpconnector");
        HttpConnector httpConnector = httpConnectorParam==null ? SimpleHttpConnector.getDefault() :
            (HttpConnector)newObjectInstance(httpConnectorParam);
       
        String ntsParam = props.getProperty("oauth.consumer.nonce_and_timestamp");
        NonceAndTimestamp nonceAndTimestamp = ntsParam==null ? SimpleNonceAndTimestamp.DEFAULT :
            (NonceAndTimestamp)newObjectInstance(ntsParam);
View Full Code Here

    try {
      send_raw(q.build().toByteArray());
    } catch (IOException ex) {
      throw new RqlDriverException(ex.getMessage());
    }
    Response rsp = get();

    // For this version we only support success :-(
    switch(rsp.getType()) {
    case SUCCESS_ATOM:
    case SUCCESS_SEQUENCE:
    case SUCCESS_PARTIAL:
      return new RqlCursor(this,rsp);
    case CLIENT_ERROR:
    case COMPILE_ERROR:
    case RUNTIME_ERROR:
    default:
      throw new RqlDriverException(rsp.toString());             
    }             
  }
View Full Code Here

        ExecuteMethod executeMethod = new ExecuteMethod();
        executeMethod.setParameters(parameters);
        executeMethod.setUrl(path);
        executeMethod.setHttpMethod(methodName);

        Response response = method.getResponse();
        if (response != null) {
            Representation representation = response.getRepresentation();
            if (representation != null) {
                String mediaType = representation.getMediaType();
                executeMethod.setResponseType(mediaType);
            }
        }
View Full Code Here

    // verify correctness
    Assert.assertEquals("server content length unequal", contents.length, req.getContent().length);
    Assert.assertTrue("server contents do not match", Arrays.equals(contents, req.getContent()));

    // echo message back to client
    final Response rsp = new Response();
    rsp.setPayload(contents);
    Assert.assertTrue(Arrays.equals(contents, rsp.getPayload()));
    handler.sendResponse(rsp, req);

    // read out message at client
    final byte[] msg1 = readInputStream(in, true);
    Assert.assertTrue("zero-length message", msg1.length > 0);
View Full Code Here

    // verify correctness
    Assert.assertEquals("server content length unequal", contents.length, req.getContent().length);
    Assert.assertTrue("server contents do not match", Arrays.equals(contents, req.getContent()));

    // echo message back to client
    final Response rsp = new Response();
    rsp.setPayload(contents);
    Assert.assertTrue(Arrays.equals(contents, rsp.getPayload()));
    handler.sendResponse(rsp, req);
    // handler.sendResponse(rsp, req);

    // read out message at client
    final byte[] msg1 = readInputStream(in, true);
View Full Code Here

TOP

Related Classes of com.dyuproject.util.http.HttpConnector$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.