Examples of toJson()


Examples of org.eclipse.orion.server.cf.objects.Domain.toJSON()

        JSONObject domainJSON = resources.getJSONObject(k);
        Domain domain = new Domain();
        domain.setCFJSON(domainJSON);
        if (domainName == null || domainName.equals(domain.getDomainName())) {
          domains.add(domain);
          result.append("Domains", domain.toJSON());
        }
      }

      if (domains.isEmpty())
        return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, "Domain can not be found", null);
View Full Code Here

Examples of org.eclipse.orion.server.cf.objects.Log.toJSON()

      JSONObject jsonResp = new JSONObject();
      Log log = new Log(appName, logName);
      log.setContents(response);
      log.setLocation(new URI(baseRequestLocation));
      jsonResp.put(instanceNo, log.toJSON());

      return new ServerStatus(Status.OK_STATUS, HttpServletResponse.SC_OK, jsonResp);
    } catch (Exception e) {
      String msg = NLS.bind("An error occured when performing operation {0}", commandName); //$NON-NLS-1$
      logger.error(msg, e);
View Full Code Here

Examples of org.eclipse.orion.server.cf.objects.Manifest.toJSON()

            return status;

          ManifestParseTree manifest = parseManifestCommand.getManifest();
          Manifest resp = new Manifest(manifest);

          return new ServerStatus(Status.OK_STATUS, HttpServletResponse.SC_OK, resp.toJSON());

        } catch (Exception e) {
          String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
          ServerStatus status = new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);
          logger.error(msg, e);
View Full Code Here

Examples of org.eclipse.orion.server.cf.objects.Route.toJSON()

        route.setCFJSON(routeJSON);

        if (domainName == null || (domainName.equals(route.getDomainName()) && (hostName == null || hostName.equals(route.getHost())))) {
          if (!orphaned || route.getCFJSON().getJSONObject(CFProtocolConstants.V2_KEY_ENTITY).getJSONArray(CFProtocolConstants.V2_KEY_APPS).length() == 0) {
            routes.add(route);
            result.append("Routes", route.toJSON());
          }
        }
      }

      return new ServerStatus(Status.OK_STATUS, HttpServletResponse.SC_OK, result);
View Full Code Here

Examples of org.eclipse.orion.server.cf.objects.Service.toJSON()

          JSONObject serviceResp = jobStatus.getJsonData();
          boolean isBindable = serviceResp.getJSONObject(CFProtocolConstants.V2_KEY_ENTITY).getBoolean(CFProtocolConstants.V2_KEY_BINDABLE);

          if (isBindable) {
            Service s = new Service(serviceInstanceEntity.getString(CFProtocolConstants.V2_KEY_NAME));
            services.put(s.toJSON());
          }
        }

      } while (serviceInstancesURI != null);
View Full Code Here

Examples of org.eclipse.orion.server.cf.objects.Space.toJSON()

          ServerStatus status = HttpUtil.executeMethod(getDomainsMethod);
          if (!status.isOK())
            return status;

          Space space = new Space().setCFJSON(status.getJsonData());
          return new ServerStatus(Status.OK_STATUS, HttpServletResponse.SC_OK, space.toJSON());
        } catch (Exception e) {
          String msg = NLS.bind("Failed to handle request for {0}", pathString); //$NON-NLS-1$
          ServerStatus status = new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);
          logger.error(msg, e);
          return status;
View Full Code Here

Examples of org.eclipse.orion.server.cf.objects.Target.toJSON()

          if (target == null) {
            String msg = "Target not set"; //$NON-NLS-1$
            return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, msg, null);
          }

          return new ServerStatus(Status.OK_STATUS, HttpServletResponse.SC_OK, target.toJSON());
        } catch (JSONException e) {
          String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
          ServerStatus status = new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);
          logger.error(msg, e);
          return status;
View Full Code Here

Examples of org.eclipse.orion.server.core.ServerStatus.toJSON()

      response = webConversation.getResponse(request);
      status = waitForTask(response);
      assertFalse(status.toString(), status.isOK());

      // clone 2 - fetch task should fail
      JSONObject statusJson = status.toJSON();
      JSONObject result = statusJson.has("Result") ? statusJson.getJSONObject("Result") : statusJson;
      assertEquals("Error", result.getString("Severity"));
    }
  }
View Full Code Here

Examples of org.eclipse.orion.server.core.tasks.TaskInfo.toJSON()

    if (job.getState() == Job.NONE || job.getRealResult() != null) {
      return writeResult(request, response, job, statusHandler, strategy);
    } else {
      TaskInfo task = job.startTask();
      task.setUnqualificationStrategy(strategy);
      JSONObject result = task.toJSON();
      URI taskLocation = createTaskLocation(ServletResourceHandler.getURI(request), task.getId(), task.isKeep());
      result.put(ProtocolConstants.KEY_LOCATION, taskLocation);
      if (!task.isRunning()) {
        job.removeTask(); // Task is not used, we may remove it
        return writeResult(request, response, job, statusHandler, strategy);
View Full Code Here

Examples of org.eclipse.orion.server.git.objects.Blame.toJSON()

      String path = requestInfo.relativePath;
      blame.setFilePath(path);
      blame.setBlameLocation(getURI(request));
      doBlame(blame, requestInfo.db);
      OrionServlet.writeJSONResponse(request, response, blame.toJSON(), JsonURIUnqualificationStrategy.ALL_NO_GIT);
      return true;
    } catch (Exception e) {
      return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
          "Error generating blame response", e));
    }
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.