Package com.webobjects.appserver

Examples of com.webobjects.appserver.WORequest


        return aDirectoryArray;
    }


    public WOResponse getPathAction() {
        WORequest aRequest = request();
        ERXResponse aResponse = new ERXResponse();

        if (aRequest.isUsingWebServer())  {
            aResponse.setStatus(WOMessage.HTTP_STATUS_FORBIDDEN);
            aResponse.appendContentString("Access Denied");
            return aResponse;
        }
        String aPath = aRequest.headerForKey("filepath");
        boolean showFiles = (aRequest.headerForKey("showFiles") != null) ? true : false;

        // looking for roots, or root listing of only 1 root
        if (aPath == null && !singleRoot) {
            aResponse.appendContentString(xmlRoots);
            aResponse.setHeader("YES", "isRoots");
View Full Code Here


        String contentXML = (new _JavaMonitorCoder()).encodeRootObjectForKey(xmlDict, "instanceRequest");
        NSData content = new NSData(contentXML);

        //        String urlString = MObject.adminActionStringPrefix + anInstance.application().realName() + MObject.adminActionStringPostfix;
        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);
View Full Code Here

        }

        // we had errors reaching a host last time - do it again!
        if (aConfig.hostErrorArray.count() > 0) {
            _syncRequest = null;
            final WORequest aSyncRequest = syncRequest(aConfig);
            final _NSThreadsafeMutableArray syncHosts = aConfig.hostErrorArray;
            if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelDetailed, NSLog.DebugGroupDeployment))
                NSLog.debug.appendln("Sending sync requests to: " + syncHosts.array());
            // final MSiteConfig finalConfig = aConfig;
            Thread[] workers = new Thread[syncHosts.count()];
            for (int i = 0; i < workers.length; i++) {
                final int j = i;
                Runnable work = new Runnable() {
                    public void run() {
                        MHost aHost = (MHost) syncHosts.objectAtIndex(j);
                        aHost.sendRequestToWotaskd(aSyncRequest, true, true);
                    }
                };
                workers[j] = new Thread(work);
                workers[j].start();
            }

            try {
                for (int i = 0; i < workers.length; i++) {
                    workers[i].join();
                }
            } catch (InterruptedException ie) {
            }
        }

        final WORequest aRequest = new WORequest(MObject._POST, MObject.directActionString, MObject._HTTP1, aConfig
                .passwordDictionary(), content, null);
        final NSArray finalWotaskdArray = wotaskdArray;
        final boolean wc = willChange;

        Thread[] workers = new Thread[wotaskdArray.count()];
View Full Code Here

                    data, "sync");
            NSMutableDictionary<String, NSMutableDictionary<String, NSMutableDictionary<String, NSDictionary>>> monitorRequest = new NSMutableDictionary<String, NSMutableDictionary<String, NSMutableDictionary<String, NSDictionary>>>(
                    updateWotaskd, "updateWotaskd");
            NSData content = new NSData((new _JavaMonitorCoder()).encodeRootObjectForKey(monitorRequest,
                    "monitorRequest"));
            _syncRequest = new WORequest(MObject._POST, MObject.directActionString, MObject._HTTP1, aConfig
                    .passwordDictionary(), content, null);
        }
        return _syncRequest;
    }
View Full Code Here

        if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog. DebugLevelInformational, NSLog.DebugGroupDeployment))
            NSLog.debug.appendln("!@#$!@#$ getSiteConfigFromHostAndPort creates a WOHTTPConnection");
        NSDictionary monitorRequest = new NSDictionary<String, String>("SITE", "queryWotaskd");
        NSData content = new NSData( (new _JavaMonitorCoder()).encodeRootObjectForKey(monitorRequest, "monitorRequest") );

        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);
View Full Code Here

     */
    public WOActionResults ipnAction() { // processor for Instant Payment Notifications

      boolean isSandboxMode = false;
     
        WORequest ppIPNRequest = request(); // the incoming PayPal IPN (Instant Payment Notification)
        if (NSLog.debugLoggingAllowedForLevel(NSLog.DebugLevelInformational)) {
            NSLog.debug.appendln("PayPal's request looks like: " + ppIPNRequest + "\n\n");
            NSLog.debug.appendln("PayPal's request content looks like: " + ppIPNRequest.contentString() + "\n\n");
        }
       
        WOResponse ppValidationResponse = null; // PayPal's validation of our echoed data
        String ppValidationResponseString = null;
        boolean connectionSuccess;
        if (ppIPNRequest.formValues().containsKey("test_ipn")) {
          isSandboxMode = true;
        } 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
        }
View Full Code Here

            if (aContext != null) {
                try {
                    WOComponent component = aContext.page();
                    String componentName = component != null ? component.name() : "NoNameComponent";
                    String additionalInfo = "(no additional Info)";
                    WORequest request = aContext.request();
                    String requestHandler = request != null ? request.requestHandlerKey() : "NoRequestHandler";
                    if (!requestHandler.equals("wo")) {
                        additionalInfo = additionalInfo + aContext.request().uri();
                    }
                    return new ERXNormalRequestDescription(componentName, requestHandler, additionalInfo);
                }
View Full Code Here

   */
  private NSArray<String> languages() {
    if( hasSession() ) {
      return session().languages();
    }
    WORequest request = context().request();
    if( request != null ) {
      return request.browserLanguages();
    }
    return null;
  }
View Full Code Here

  @Override
  public void savePage(WOComponent page) {
    WOContext context = context();
    if (ERXAjaxApplication.shouldNotStorePage(context)) {
      if (logger.isDebugEnabled()) logger.debug("Considering pageReplacementCache for " + context.request().uri() + " with contextID " + context.contextID());
      WORequest request = context.request();
      WOResponse response = context.response();
      String pageCacheKey = null;
      if (response != null) {
        pageCacheKey = response.headerForKey(ERXAjaxSession.PAGE_REPLACEMENT_CACHE_LOOKUP_KEY);
      }
      if (pageCacheKey == null && request != null) {
        pageCacheKey = request.headerForKey(ERXAjaxSession.PAGE_REPLACEMENT_CACHE_LOOKUP_KEY);
      }

      // A null pageCacheKey should mean an Ajax request that is not returning a content update or an expliclty not cached non-Ajax request
      if (pageCacheKey != null) {
        if (logger.isDebugEnabled()) logger.debug("Will use pageCacheKey " + pageCacheKey);
View Full Code Here

      WOContext context = page.context();
      if(context == null) {
          page._awakeInContext(context());
          context = page.context();
      }
      WORequest request = context.request();
      // MS: I suspect we don't have to do this all the time, but I don't know if we have
      // enough information at this point to know whether to do it or not, unfortunately.
      if (request != null) {
        request.setHeader(contextID, ERXAjaxSession.ORIGINAL_CONTEXT_ID_KEY);
      }
    }

    return page;
  }
View Full Code Here

TOP

Related Classes of com.webobjects.appserver.WORequest

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.