Package com.webobjects.appserver

Examples of com.webobjects.appserver.WOResponse


   * The pane content is rendered when an Ajax request is received.
   * @return the children rendered as HTML
   */
  @Override
  public WOActionResults handleRequest(WORequest request, WOContext context) {
    WOResponse response = null;
    String didSelect = request.stringFormValueForKey("didSelect");

    // This is not set when the tab is initially loaded, that is our cue to generate our content
    if ( didSelect == null) {
      response = AjaxUtils.createResponse(request, context);
View Full Code Here


        exception = newException;
    }

    @Override
    public WOResponse generateResponse() {
        WOResponse response = super.generateResponse();
        // we don't need the exception to stick around if we leave the page
        error = null;
        errorline = null;
        return response;
    }
View Full Code Here

  }

  /** Ask the an JSONRPCBridge object to handle the json request. */
  @Override
  public WOActionResults handleRequest(WORequest request, WOContext context) {
    WOResponse response = AjaxUtils.createResponse(request, context);

    String inputString = request.contentString();
    if (log.isDebugEnabled()) {
      log.debug("AjaxProxy.handleRequest: input = " + inputString);
    }

    // Process the request
    JSONObject input = null;
    Object output = null;
    try {
      input = new JSONObject(inputString);

      Object proxy;
      if (canGetValueForBinding("proxy")) {
        proxy = valueForBinding("proxy");
      }
      else {
        proxy = parent();
      }
      String proxyName = (String) valueForBinding("proxyName");

      JSONRPCBridge bridge = null;
      if (canGetValueForBinding("AjaxBridge")) {
        bridge = (JSONRPCBridge) valueForBinding("AjaxBridge");
      }
      else {
        bridge = JSONBridge.createBridge();
        if (canSetValueForBinding("AjaxBridge")) {
          setValueForBinding(bridge, "AjaxBridge");
        }
      }
      bridge.registerObject(proxyName, proxy);
      output = bridge.call(new Object[] { request, context, response, proxy }, input);
    }
    catch (NoSuchElementException e) {
      log.error("No method in request");
      output = JSONRPCResult.MSG_ERR_NOMETHOD;
    }
    catch (Exception e) {
      log.error("Exception", e);
      output = JSONRPCResult.MSG_ERR_NOMETHOD;
    }

    // Write the response
    if (log.isDebugEnabled()) {
      log.debug("AjaxProxy.handleRequest: output = " + output);
    }
    response.appendContentString(output.toString());
    return response;
  }
View Full Code Here

    }
   
    public WOActionResults keepAliveAction() {
      WOApplication application = WOApplication.application();
      WOContext context = context();
      WOResponse response = application.createResponseInContext(context);
      String sessionID = context.request().stringFormValueForKey("erxsid");
      if (!application.isRefusingNewSessions()) {
        WOSession session = application.restoreSessionWithID(sessionID, context);
        if (session != null) {
          log.debug("Pinging " + sessionID);
          // CHECKME TH do we still need that?
          // we give over the session id as we also need to touch the session anyway
          response.setHeader(ERXSession.DONT_STORE_PAGE, sessionID);
          response.setHeader("application/x-empty", ERXResponse.ContentTypeHeaderKey);
        }
        else {
          log.debug("Couldn't ping " + sessionID);
        }
      }
View Full Code Here

    _valueAssociation.setValue(objValue, component);

    // just executing action, ignoring result
    valueForBinding("action", component);

    WOResponse response = AjaxUtils.createResponse(request, context);
    _appendValueAttributeToResponse(response, context);

    return response;
  }
View Full Code Here

   * XML 互換性の為にオーバライド
   * </span>
   */
  @Override
  public void appendToResponse(WOResponse woresponse, WOContext wocontext) {
    WOResponse newResponse = ERXPatcher.DynamicElementsPatches.cleanupXHTML ? new ERXResponse() : woresponse;
    super.appendToResponse(newResponse, wocontext);

    ERXPatcher.DynamicElementsPatches.processResponse(this, newResponse, wocontext, 0, nameInContext(wocontext, wocontext.component()));
    if (ERXPatcher.DynamicElementsPatches.cleanupXHTML) {
      woresponse.appendContentString(newResponse.contentString());
    }
  }
View Full Code Here

public WOActionResults defaultAction() {
    return pageWithName(Main.class.getName());
  }
 
  public WOActionResults exampleReplacementAction() {
    WOResponse response = WOApplication.application().createResponseInContext(context());
    response.appendContentString("Example Replacement " + System.currentTimeMillis());
    return response;
  }
View Full Code Here

    ERXFutureTask<?> _future = new ERXFutureTask(taskInfoGID);
    ERXExecutorService.executorService().execute(_future);

    ERXRouteResults results = (ERXRouteResults)response(taskInfo, ERXKeyFilter.filterWithAttributesAndToOneRelationships());   
    WOResponse response = results.generateResponse();
    String location = hostName() + ERXRouteUrlUtils.actionUrlForRecord(_context, taskInfo, "show", format().name(), new NSDictionary(), request().isSecure(), request().isSessionIDInRequest());
    response.setHeader(location, "Content-Location");
    response.setStatus(ERXHttpStatusCodes.ACCEPTED);
    return response; 
  }
View Full Code Here

 
  public WOActionResults showAction() throws Throwable {
    TaskInfo taskInfo = routeObjectForKey("taskInfo");
    if (TaskInfo.WORKFLOW_PRIME_CHECKED.equals(taskInfo.workflowState())) {
      ERXRouteResults results = (ERXRouteResults)response(taskInfo, ERXKeyFilter.filterWithNone());   
      WOResponse response = results.generateResponse();
      String location = hostName() + ERXRouteUrlUtils.actionUrlForRecord(_context, taskInfo, "results", format().name(), new NSDictionary(), request().isSecure(), request().isSessionIDInRequest());
      response.setHeader(location, "Content-Location");
      response.setStatus(ERXHttpStatusCodes.SEE_OTHER);
      return response;
    }
    return response(taskInfo.workflowState(), ERXKeyFilter.filterWithAttributes());
  }
View Full Code Here

      if (request.uri().indexOf("/wo/") > -1) log.info("Received component action request " + request.uri());
      else if (request.uri().indexOf("/wa/") > -1) log.info("Received direct action request " + request.uri());
      else if (request.uri().indexOf("/ajax/") > -1) log.info("Received ajax action request " + request.uri());
      NSLog.out.appendln("form values " + request.formValues());
     
      WOResponse response =  super.dispatchRequest(request);
     
        //NSLog.out.appendln("returned response " + response.contentString());
        NSLog.out.appendln("returned response headers " + response.headers());
        NSLog.out.appendln("\n");
        return response;
    }

    return super.dispatchRequest(request);
View Full Code Here

TOP

Related Classes of com.webobjects.appserver.WOResponse

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.