Examples of WOHTTPConnection


Examples of com.webobjects.appserver.WOHTTPConnection

    if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelDetailed, NSLog.DebugGroupDeployment))
      NSLog.debug.appendln("!@#$!@#$ fileListForStartingPathHost creates a WOHTTPConnection");
    NSDictionary aFileListDictionary = null;
    try {
      Application theApplication = (Application) WOApplication.application();
      WOHTTPConnection anHTTPConnection = new WOHTTPConnection(aHost.name(), theApplication.lifebeatDestinationPort());
      @SuppressWarnings("cast")
      NSMutableDictionary<String, NSMutableArray<String>> aHeadersDict = (NSMutableDictionary<String, NSMutableArray<String>>) WOTaskdHandler.siteConfig().passwordDictionary().mutableClone();
      WORequest aRequest = null;
      WOResponse aResponse = null;
      boolean requestSucceeded = false;
      aHeadersDict.setObjectForKey(new NSMutableArray<String>(aString != null && aString.length() > 0 ? aString
          : "/Library/WebObjects"), "filepath");
      if (showFiles) {
        aHeadersDict.setObjectForKey(new NSMutableArray<String>("YES"), "showFiles");
      }

      aRequest = new WORequest(MObject._GET, RemoteBrowseClient.getPathString, MObject._HTTP1, aHeadersDict,
          null, null);
      anHTTPConnection.setReceiveTimeout(5000);

      requestSucceeded = anHTTPConnection.sendRequest(aRequest);

      if (requestSucceeded) {
        aResponse = anHTTPConnection.readResponse();
      }

      if ((aResponse == null) || (!requestSucceeded) || (aResponse.status() != 200)) {
        throw new MonitorException("Error requesting directory listing for " + aString + " from " + aHost.name());
      }
View Full Code Here

Examples of com.webobjects.appserver.WOHTTPConnection

                null);

        WOResponse aResponse = null;

        try {
            WOHTTPConnection anHTTPConnection = new WOHTTPConnection(currentHost.name(), theApplication
                    .lifebeatDestinationPort());
            anHTTPConnection.setReceiveTimeout(10000);

            if (anHTTPConnection.sendRequest(aRequest)) {
                aResponse = anHTTPConnection.readResponse();
            }
        } catch (Throwable localException) {
            NSLog._conditionallyLogPrivateException(localException);
        }
        if (aResponse == null) {
View Full Code Here

Examples of com.webobjects.appserver.WOHTTPConnection

        String urlString = MObject.adminActionStringPrefix + anInstance.applicationName() + MObject.adminActionStringPostfix;
        WORequest aRequest = new WORequest(MObject._POST, urlString, MObject._HTTP1, null, content, null);
        WOResponse aResponse = null;

        try {
            WOHTTPConnection anHTTPConnection = new WOHTTPConnection(anInstance.host().name(), anInstance.port().intValue());
            anHTTPConnection.setReceiveTimeout(_receiveTimeout);

            boolean requestSucceeded = anHTTPConnection.sendRequest(aRequest);

            if (requestSucceeded) {
                aResponse = anHTTPConnection.readResponse();
            } else {
                throw new MonitorException(_hostName + ": Failed to receive response from " + anInstance.displayName());
            }
            anInstance.succeededInConnection();
        } catch (NSForwardException ne) {
View Full Code Here

Examples of com.webobjects.appserver.WOHTTPConnection

        if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelDetailed, NSLog.DebugGroupDeployment))
            NSLog.debug.appendln("!@#$!@#$ sendRequestToWotaskd creates a WOHTTPConnection");
        WOResponse aResponse = null;

        try {
            WOHTTPConnection anHTTPConnection = new WOHTTPConnection(name(), WOApplication.application().lifebeatDestinationPort());
            anHTTPConnection.setReceiveTimeout(_receiveTimeout);

            boolean requestSucceeded = anHTTPConnection.sendRequest(aRequest);

            isAvailable = true;

            if (requestSucceeded) {
                aResponse = anHTTPConnection.readResponse();
            } else {
                isAvailable = false;
            }

            if (aResponse == null) {
View Full Code Here

Examples of com.webobjects.appserver.WOHTTPConnection

        WORequest aRequest = new ERXRequest(MObject._POST, MObject.directActionString, MObject._HTTP1, NSDictionary.EmptyDictionary, content, null);
        WOResponse aResponse = null;

        try {
            WOHTTPConnection anHTTPConnection = new WOHTTPConnection(configHostName, aPort);
            anHTTPConnection.setReceiveTimeout(5000);

            if (anHTTPConnection.sendRequest(aRequest)) {
                aResponse = anHTTPConnection.readResponse();
            }
        } catch(Exception localException) {
            log.error("Failed to connect to Host: " + configHostName + " and Port: " + aPort);
            throw new MonitorException("Failed to connect to Host: " + configHostName + " and Port: " + aPort);
        }
View Full Code Here

Examples of com.webobjects.appserver.WOHTTPConnection

        } else {
          isSandboxMode = false;
        }

        String returnString = ppIPNRequest.contentString() + "&cmd=_notify-validate";
      WOHTTPConnection ppEchoConnection = new WOHTTPConnection(paypalSite, 80); // our echo to PayPal
        if (isSandboxMode) {
          ppEchoConnection = new WOHTTPConnection(sandboxSite, 80); // our echo to PayPal
        }
        // assemble User-Agent header
        StringBuilder ua = new StringBuilder();
        ua.append("WebObjects/ " + ERXProperties.webObjectsVersion() + " (");
        ua.append(System.getProperty("os.arch"));
        ua.append("; ");
        ua.append(System.getProperty("os.name"));
        ua.append(' ');
        ua.append(System.getProperty("os.version"));
        ua.append(')');

        NSMutableDictionary headers = new NSMutableDictionary();
        headers.setObjectForKey("en", "Accept-Language");
        headers.setObjectForKey("iso-8859-1,*,utf-8", "Accept-Charset");
        headers.setObjectForKey("image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*", "Accept");
        headers.setObjectForKey(ua.toString(),"User-Agent");

        // the response back to PayPal
        WORequest paypalEchoRequest;
        paypalEchoRequest = new WORequest("POST", paypalCgi, "HTTP/1.1", headers, null, null);

        paypalEchoRequest.setContent(returnString);
        ppEchoConnection.setReceiveTimeout(90 * 1000); // 90 second timeout -- this might be too long!?!
        connectionSuccess = ppEchoConnection.sendRequest(paypalEchoRequest);
        if (connectionSuccess) {
          ppValidationResponse = ppEchoConnection.readResponse(); // read PayPal's validation
        }

        ppValidationResponseString = ppValidationResponse.contentString();

        if (connectionSuccess) {
View Full Code Here

Examples of com.webobjects.appserver.WOHTTPConnection

     *
     * output -- The format in which the output should be generated. The
     * options are xml, kml, csv, or json.
     */

    WOHTTPConnection connection = new WOHTTPConnection("maps.google.com", 80);
    String encodedAddress = "";
    try {
      encodedAddress = URLEncoder.encode(address, CharEncoding.UTF_8);
    }
    catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }
    String url = "/maps/geo?q=" + encodedAddress + "&output=csv&key=" + apiKey();
    WORequest request = new WORequest("GET", url, "HTTP/1.0", null, null, null);
    boolean success = connection.sendRequest(request);
    if (success) {

      /*
       * A reply returned in the csv format consists of four numbers,
       * separated by commas. The first number is the status code, the
       * second is the accuracy, the third is the latitude, while the
       * fourth one is the longitude.
       */

      String responseText = connection.readResponse().contentString();
      result = new NSDictionary(responseText.split(","), GEOCODER_RESPONSE_KEYS);
    }
    return result;
  }
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.