Package com.webobjects.appserver

Examples of com.webobjects.appserver.WORequest


  @Override
  public void appendToResponse(WOResponse response, WOContext context) {
    Session session = (Session) context.session();
    if (session.hasNotifications()) {
      WORequest request = context.request();
      AjaxUtils.appendScriptHeaderIfNecessary(request, response);
      response.appendContentString("notificationsUpdate();");
      AjaxUtils.appendScriptFooterIfNecessary(request, response);
    }
  }
View Full Code Here


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

      }
      try {
        EOEditingContext editingContext = transaction.editingContext();
        try {
          for (Object record : transaction.records()) {
            WORequest recordRequest = (WORequest)record;
            setExecutingTransaction(transaction, context, recordRequest);
            recordRequest.removeHeadersForKey(ERXRestTransactionRequestAdaptor.CLIENT_ID_HEADER_KEY);
            recordRequest.removeHeadersForKey(ERXRestTransactionRequestAdaptor.SEQUENCE_ID_HEADER_KEY);
            recordRequest.removeHeadersForKey(ERXRestTransactionRequestAdaptor.TRANSACTION_HEADER_KEY);
           
            ERXRouteRequestHandler requestHandler = (ERXRouteRequestHandler)WOApplication.application().handlerForRequest(recordRequest);
            WOResponse response = requestHandler.handleRequest(recordRequest);
            if (response.status() < 200 || response.status() > 299) {
              throw new RuntimeException("Transaction failed: " + response.contentString());
View Full Code Here

  @Override
  @SuppressWarnings("unchecked")
  public WOAction getActionInstance(Class class1, Class[] aclass, Object[] aobj) {
    ERXRouteController controller = (ERXRouteController) super.getActionInstance(class1, aclass, aobj);
    WORequest request = (WORequest) aobj[0];
    setupRouteControllerFromUserInfo(controller, request.userInfo());
    return controller;
  }
View Full Code Here

   * @param context the WOContext
   * @param javascript the javascript to send
   * @return a new response
   */
  public static WOResponse javascriptResponse(String javascript, WOContext context) {
    WORequest request = context.request();
    AjaxResponse response = AjaxUtils.createResponse(request, context);
    AjaxUtils.appendScriptHeaderIfNecessary(request, response);
    response.appendContentString(javascript);
    AjaxUtils.appendScriptFooterIfNecessary(request, response);
    return response;
View Full Code Here

    public WOComponent displayWotaskdInfoClicked() {
        if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelDetailed, NSLog.DebugGroupDeployment))
            NSLog.debug.appendln("!@#$!@#$ displayWotaskdInfoClicked creates a WOHTTPConnection");
        WotaskdInfoPage aPage = (WotaskdInfoPage) pageWithName("WotaskdInfoPage");
        WORequest aRequest = new WORequest(MObject._POST, "/", MObject._HTTP1, siteConfig().passwordDictionary(), null,
                null);

        WOResponse aResponse = null;

        try {
View Full Code Here

    // This is the biggie - this processes all requests from Monitor
    public WOActionResults monitorRequestAction() {
        Application theApplication = (Application) WOApplication.application();
        MSiteConfig aConfig = theApplication.siteConfig();

        WORequest aRequest = request();
        WOResponse aResponse = theApplication.createResponseInContext(null);

        // Aren't allowed to call this through the Web server.
        if (aRequest.isUsingWebServer()) {
            NSLog.debug.appendln("Attempt to call DirectAction: monitorRequestAction through Web server");
            if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelCritical, NSLog.DebugGroupDeployment))
                NSLog.debug.appendln(aRequest.contentString());
            aResponse.setStatus(WOMessage.HTTP_STATUS_FORBIDDEN);
            aResponse.appendContentString(_accessDenied);
            return aResponse;
        }

        // Checking to see if the password was corrent
        theApplication._lock.startReading();
        try {
            String passwordHeader = aRequest.headerForKey("password");
            if (!aConfig.comparePasswordWithPassword(passwordHeader)) {
                NSLog.debug.appendln("Attempt to call DirectAction: monitorRequestAction with incorrect password.");
                aResponse.setStatus(WOMessage.HTTP_STATUS_FORBIDDEN);
                aResponse.appendContentString(_invalidPassword);
                // we endReading at the finally block
                return aResponse;
            }
        } finally {
            theApplication._lock.endReading();
        }

        NSDictionary requestDict;
        try {
            requestDict = (NSDictionary) new _JavaMonitorDecoder().decodeRootObject(aRequest.content());
        } catch (WOXMLException wxe) {
            NSLog.err.appendln("Wotaskd monitorRequestAction: Error parsing request");
            if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelInformational, NSLog.DebugGroupDeployment))
                NSLog.debug.appendln("Wotaskd monitorRequestAction: " + aRequest.contentString());
            aResponse.appendContentString(_invalidXML);
            return aResponse;
        }

        if (NSLog.debugLoggingAllowedForLevelAndGroups(NSLog.DebugLevelInformational, NSLog.DebugGroupDeployment))
View Full Code Here

    @Override
    public WOActionResults defaultAction() {
        // KH - make this faster as well :)
        Application theApplication = (Application) WOApplication.application();
        WOResponse aResponse = theApplication.createResponseInContext(null);
        WORequest aRequest = request();
        MSiteConfig aConfig = theApplication.siteConfig();

        theApplication._lock.startReading();
        try {

            // Check for correct password
            String passwordHeader = aRequest.headerForKey("password");
            if (!aConfig.comparePasswordWithPassword(passwordHeader)) {
                NSLog.debug.appendln("Attempt to call Direct Action: defaultAction with incorrect password.");
                aResponse.setStatus(WOMessage.HTTP_STATUS_FORBIDDEN);
                aResponse.appendContentString("Attempt to call Direct Action: defaultAction on wotaskd with incorrect password.");
                // we endReading at the finally block
View Full Code Here


    // Adaptor Config Response
    public WOResponse woconfigAction() {
        Application theApplication = (Application) WOApplication.application();
        WORequest aRequest = request();

        // This will return true if we match either WOHost or any known local address
        // We aren't going to regenerate the list, though, since this gets called a lot.
        boolean shouldIncludeUnregisteredInstances = WOHostUtilities.isAnyLocalInetAddress(aRequest._originatingAddress(), false);

        theApplication._lock.startReading();
        String xml;
        try {
            xml = ((Application)WOApplication.application()).siteConfig().generateAdaptorConfigXML(true, shouldIncludeUnregisteredInstances);
View Full Code Here

    // used by WOInfoCenter and perhaps others
    public WOActionResults findPortAction() {
        Application theApplication = (Application) WOApplication.application();
        WOResponse aResponse = theApplication.createResponseInContext(null);
        WORequest aRequest = request();
        String portString = null;

        // We wouldn't have registered it in the first place, so we don't regenerate
        if (WOHostUtilities.isAnyLocalInetAddress(aRequest._originatingAddress(), false) ) {
            String anAppName = request().stringFormValueForKey("appName");
            portString = theApplication.localMonitor().portForUnregisteredAppNamed(anAppName);
        }

        if (portString == null) {
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.