Package fitnesse.responders

Examples of fitnesse.responders.ErrorResponder


    childPageData.setOrRemoveAttribute(PageData.LAST_MODIFYING_USER, user);
    childPage.commit(childPageData);
  }

  private Response errorResponse(FitNesseContext context, Request request) {
    return new ErrorResponder("Invalid Child Name").makeResponse(context, request);
  }
View Full Code Here


  private Response errorResponse(FitNesseContext context, Request request) {
    return new ErrorResponder("Invalid Child Name").makeResponse(context, request);
  }

  private Response alreadyExistsResponse(FitNesseContext context, Request request) {
    return new ErrorResponder("Child page already exists", 409).makeResponse(context, request);
  }
View Full Code Here

    catch (SocketException se) {
      throw se;
    }
    catch (Exception e) {
      LOG.log(Level.WARNING, "Unable to handle request", e);
      response = new ErrorResponder(e).makeResponse(context, request);
    }
    // Add those as default headers?
    response.addHeader("Server", "FitNesse-" + context.version);
    response.addHeader("Connection", "close");
    return response;
View Full Code Here

    return parseThread;
  }

  private void reportError(int status, String message) {
    try {
      response = new ErrorResponder(message).makeResponse(context, request);
      response.setStatus(status);
      hasError = true;
    }
    catch (Exception e) {
      LOG.log(Level.WARNING, "Can not report error (status = " + status + ", message = " + message + ")", e);
View Full Code Here

      LOG.log(Level.WARNING, "Can not report error (status = " + status + ", message = " + message + ")", e);
    }
  }

  private void reportError(Exception e) {
    response = new ErrorResponder(e).makeResponse(context, request);
    hasError = true;
  }
View Full Code Here

  public Response makeResponse(FitNesseContext context, Request request) {
    resource = request.getResource();
    version = (String) request.getInput("version");
    this.context = context;
    if (version == null)
      return new ErrorResponder("No version specified.").makeResponse(context, request);

    PageCrawler pageCrawler = context.root.getPageCrawler();
    WikiPagePath path = PathParser.parse(resource);
    WikiPage page = pageCrawler.getPage(path);
    if (page == null)
View Full Code Here

    return false;
  }

  private Response makeErrorResponse(FitNesseContext context, Request request,
      String message) {
    return new ErrorResponder(message).makeResponse(context, request);
  }
View Full Code Here

    }
  }

  private boolean isValidWikiPageName(String linkName) {
    if (page.hasChildPage(linkName)) {
      response = new ErrorResponder(resource + " already has a child named " + linkName + ".").makeResponse(context, null);
      response.setStatus(412);
      return false;
    } else if (!PathParser.isSingleWikiWord(linkName)) {
      response = new ErrorResponder(linkName + " is not a valid WikiWord.").makeResponse(context, null);
      response.setStatus(412);
      return false;
    }
    return true;
  }
View Full Code Here

  private boolean isValidLinkPathName(String linkPath) throws IOException {
    if (isFilePath(linkPath) && !isValidDirectoryPath(linkPath)) {
      String message = "Cannot create link to the file system path '" + linkPath + "'." +
              " The canonical file system path used was ;" + createFileFromPath(linkPath).getCanonicalPath() + "'." +
              " Either it doesn't exist or it's not a directory.";
      response = new ErrorResponder(message).makeResponse(context, null);
      response.setStatus(404);
      return false;
    } else if (!isFilePath(linkPath) && isInternalPageThatDoesntExist(linkPath)) {
      response = new ErrorResponder("The page to which you are attempting to link, " + HtmlUtil.escapeHTML(linkPath) + ", doesn't exist.").makeResponse(context, null);
      response.setStatus(404);
      return false;
    }
    return true;
  }
View Full Code Here

    String filename = (String) request.getInput("filename");

    final File pathName = new File(new File(context.getRootPagePath(), resource), filename);

    if (!FileResponder.isInFilesDirectory(new File(context.getRootPagePath()), pathName)) {
      return new ErrorResponder("Invalid path: " + pathName.getName()).makeResponse(context, request);
    }

    context.versionsController.delete(new FileVersion() {
      @Override
      public File getFile() {
View Full Code Here

TOP

Related Classes of fitnesse.responders.ErrorResponder

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.