Package org.eclipse.orion.server.core

Examples of org.eclipse.orion.server.core.ServerStatus


  protected CFJob handleGet(T resource, final HttpServletRequest request, final HttpServletResponse response, final String path) {
    return new CFJob(request, false) {
      @Override
      protected IStatus performJob() {
        String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
        return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_IMPLEMENTED, msg, null);
      }
    };
  }
View Full Code Here


  protected CFJob handlePut(T resource, final HttpServletRequest request, final HttpServletResponse response, final String path) {
    return new CFJob(request, false) {
      @Override
      protected IStatus performJob() {
        String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
        return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_IMPLEMENTED, msg, null);
      }
    };
  }
View Full Code Here

  protected CFJob handlePost(final T resource, final HttpServletRequest request, final HttpServletResponse response, final String path) {
    return new CFJob(request, false) {
      @Override
      protected IStatus performJob() {
        String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
        return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_IMPLEMENTED, msg, null);
      }
    };
  }
View Full Code Here

  protected CFJob handleDelete(T resource, final HttpServletRequest request, final HttpServletResponse response, final String path) {
    return new CFJob(request, false) {
      @Override
      protected IStatus performJob() {
        String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
        return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_IMPLEMENTED, msg, null);
      }
    };
  }
View Full Code Here

   * @param path Path mapped to the handled request. Used to display the error message.
   * @return <code>true</code> iff the 404 has been sent, <code>false</code> otherwise.
   */
  protected boolean handleNotExistingResource(HttpServletRequest request, HttpServletResponse response, String path) throws ServletException {
    String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
    ServerStatus status = new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, msg, null);
    return statusHandler.handleRequest(request, response, status);
  }
View Full Code Here

   * @param path Path mapped to the handled request. Used to display the error message.
   * @return <code>true</code> iff the 409 has been sent, <code>false</code> otherwise.
   */
  protected boolean handleConflictingResource(HttpServletRequest request, HttpServletResponse response, String path) throws ServletException {
    String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
    ServerStatus status = new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_CONFLICT, msg, null);
    return statusHandler.handleRequest(request, response, status);
  }
View Full Code Here

      GetMethod getRoutesMethod = new GetMethod(routesURI.toString());
      HttpUtil.configureHttpMethod(getRoutesMethod, target);
      getRoutesMethod.setQueryString("inline-relations-depth=1"); //$NON-NLS-1$

      ServerStatus getRouteStatus = HttpUtil.executeMethod(getRoutesMethod);
      if (!getRouteStatus.isOK())
        return getRouteStatus;

      /* extract available routes */
      JSONObject routesJSON = getRouteStatus.getJsonData();

      if (routesJSON.getInt(CFProtocolConstants.V2_KEY_TOTAL_RESULTS) < 1) {
        return new ServerStatus(IStatus.OK, HttpServletResponse.SC_OK, null, null);
      }

      JSONObject result = new JSONObject();
      routes = new ArrayList<Route>();
      JSONArray resources = routesJSON.getJSONArray(CFProtocolConstants.V2_KEY_RESOURCES);
      for (int k = 0; k < resources.length(); ++k) {
        JSONObject routeJSON = resources.getJSONObject(k);
        Route route = new Route();
        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);
    } catch (Exception e) {
      String msg = NLS.bind("An error occured when performing operation {0}", commandName); //$NON-NLS-1$
      logger.error(msg, e);
      return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, e);
    }
  }
View Full Code Here

          /* we don't know how to handle this request */
          return false;
      }
    } 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);
      return statusHandler.handleRequest(request, response, status);
    }
  }
View Full Code Here

          }

          return new GetInfoCommand(this.userId, target.getCloud()).doIt();
        } 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);
          return status;
        }
      }
    };
View Full Code Here

      return HttpUtil.executeMethod(attachRouteMethod);

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

TOP

Related Classes of org.eclipse.orion.server.core.ServerStatus

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.