Package fitnesse.responders

Examples of fitnesse.responders.ErrorResponder


    if (uploadedFile.isUsable()) {

      final File file = makeFileToCreate(makeRelativeFilename(uploadedFile.getName()), resource);

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

      context.versionsController.makeVersion(new FileVersion() {

        @Override
View Full Code Here


    return request.getInput("days") != null && getDaysInput(request) >= 0;

  }

  private Response makeErrorResponse(FitNesseContext context, Request request) {
    return new ErrorResponder("Invalid Amount Of Days").makeResponse(context, request);
  }
View Full Code Here

    String resource = request.getResource();
    String dirname = (String) request.getInput("dirname");
    final File file = new File(new File(context.getRootPagePath(), resource), dirname);

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

    final String user = request.getAuthorizationUsername();
    if (!file.exists())
      context.versionsController.addDirectory(new FileVersion() {
View Full Code Here

    String resource = request.getResource();

    try {
      resource = URLDecoder.decode(resource, "UTF-8");
    } catch (UnsupportedEncodingException e) {
      return new ErrorResponder(e);
    }

    File requestedFile = new File(rootPath, resource);

    if (!isInFilesDirectory(new File(rootPath), requestedFile)) {
      return new ErrorResponder("Invalid path: " + resource);
    } else if (requestedFile.isDirectory())
      return new DirectoryResponder(resource, requestedFile);
    else
      return new FileResponder(resource, requestedFile);
  }
View Full Code Here

    return new PageTitle("Test History", PathParser.parse(resource),tags);
  }

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

    String resource = request.getResource();
    File rootPath = new File(context.getRootPagePath());
    final File pathName = new File(rootPath, resource);

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

    final String oldFileName = (String) request.getInput("filename");
    final String newFileName = ((String) request.getInput("newName")).trim();

    final File oldFile = new File(pathName, oldFileName);
    final File newFile = new File(pathName, newFileName);

    if (!FileResponder.isInFilesDirectory(rootPath, oldFile)) {
      return new ErrorResponder("Invalid path: " + oldFileName).makeResponse(context, request);
    }

    if (!FileResponder.isInFilesDirectory(rootPath, newFile)) {
      return new ErrorResponder("Invalid path: " + newFileName).makeResponse(context, request);
    }

    context.versionsController.rename(new FileVersion() {

      @Override
View Full Code Here

    oldRefactoredPage = context.root.getPageCrawler().getPage(path);
    return (oldRefactoredPage != null);
  }

  private Responder makeErrorMessageResponder(String message) {
    return new ErrorResponder(getErrorMessageHeader() + " " + message);
  }
View Full Code Here

      return makeCorruptFileResponse(request);
    }
  }

  private Response makeCorruptFileResponse(Request request) {
    return new ErrorResponder("Corrupt Test Result File").makeResponse(context, request);
  }
View Full Code Here

    SimpleResponse response = new SimpleResponse();

    String resource = request.getResource();
    String version = (String) request.getInput("version");
    if (version == null)
      return new ErrorResponder("Missing version.").makeResponse(context, request);

    WikiPagePath path = PathParser.parse(resource);
    WikiPage page = context.root.getPageCrawler().getPage(path);
    if (page == null)
      return new NotFoundResponder().makeResponse(context, request);
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.