Examples of PathGenerator


Examples of cn.jhc.um.generator.PathGenerator

    computeHumanReadableSizeLimit(properties);
    //for test
    properties.list(System.err);
    context.setAttribute(SC_UM_CONFIG, properties);
    checkUploadDirectories(properties);
    PathGenerator pathGenerator = loadPathGenerator(properties);
    context.setAttribute(SC_PATH_GENERATOR, pathGenerator);
   
    ConstraintChecker checker = new ConstraintChecker(properties);
    context.setAttribute(SC_CONSTRAINT_CHECKER, checker);
   
View Full Code Here

Examples of cn.jhc.um.generator.PathGenerator

      }
    }
    if(!foundInterface)
      throw new RuntimeException("Cann't assign to PathGenerator interface, "
          + "the " + PATH_GENERATOR + " in configure file is wrong.");
    PathGenerator pathGenerator = null;
    try {
      pathGenerator = (PathGenerator)clazz.newInstance();
    } catch (InstantiationException e) {
      throw new RuntimeException(e);
    } catch (IllegalAccessException e) {
View Full Code Here

Examples of cn.jhc.um.generator.PathGenerator

    ConstraintChecker checker = (ConstraintChecker)servletContext.getAttribute(SC_CONSTRAINT_CHECKER);

    String destUrl = config.getProperty(DEST_URL_PREFIX);

    PathGenerator pathGenerator = (PathGenerator) servletContext.getAttribute(SC_PATH_GENERATOR);
   
    ResourceBundle bundle = ResourceBundle.getBundle("messages", request.getLocale());
   
      String type = request.getParameter("type");

      String editorId = request.getParameter("editorid");
   
    Collection<Part> parts = null;
    try {
      parts = request.getParts();
    } catch (IllegalStateException e) {
      String pattern = bundle.getString(MSG_UPLOAD_EXCEEDED);
      out.println(buildResponseScript(editorId, destUrl,
          MessageFormat.format(pattern,
              config.getProperty(HUMAN_UPLOAD_FILE_SIZE_LIMIT),
              config.getProperty(HUMAN_REQUEST_SIZE_LIMIT))));
      return;
    } catch (ServletException e) {
      out.println(buildResponseScript(editorId, destUrl, bundle.getString(MSG_WRONG_ENCTYPE)));
      return;
    } catch (IOException e) {
      out.println(buildResponseScript(editorId, destUrl, bundle.getString(MSG_IO_ERROR)));
      return;
    }
    for (Part part : parts) {
      String fileName = extractFileName(part);
      if(fileName == null) continue;
      // 检查扩展名
      String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1)
          .toLowerCase();
      if( !checker.checkFileExtension(fileExt) ) {
        out.println(buildResponseScript(editorId, destUrl, bundle.getString(MSG_EXT_VIOLATED)));
        return;
      }

      String path = pathGenerator.generate(request, fileName);
      int last = path.lastIndexOf(File.separator);
      if(last > 0) {
        File lastDir = new File(uploadRoot, path.substring(0, last));
        if(!lastDir.exists())
          lastDir.mkdirs();
View Full Code Here

Examples of net.sf.swtbot.finder.PathGenerator

    buf.append("\n");
  }

  public void getLocationInformation(Control control, StringBuffer buf) {
    TreePath path = controlFinder.getPath(control);
    String stringFromPath = new PathGenerator().getPathAsString(path);
    buf.append("Location: \n").append(stringFromPath).append("\n\n");
  }
View Full Code Here

Examples of net.sf.swtbot.finder.PathGenerator

      Widget previousWidget = SWTUtils.previousWidget((Widget) obj);
      if ((previousWidget instanceof Label) && mnemonicTextMatcher.match(previousWidget))
        return true;

      if (previousWidget == null) {
        TreePath path = new PathGenerator().getPath(text);
        int segmentCount = path.getSegmentCount();
        for (int i = 0; i < segmentCount; i++) {
          previousWidget = (Widget) path.getSegment(i);
          if ((previousWidget instanceof Label) && mnemonicTextMatcher.match(previousWidget))
            return true;
View Full Code Here

Examples of net.sf.swtbot.finder.PathGenerator

        if (!result && log.isTraceEnabled())
          log.trace("did not match " + ClassUtils.simpleClassName(obj) + " {" + text + "}, using matcher: " + description());
      }

      if (log.isTraceEnabled() && (obj instanceof Widget)) {
        PathGenerator pathGenerator = new PathGenerator();
        TreePath path = pathGenerator.getPath((Widget) obj);
        int segmentCount = path.getSegmentCount();

        String prefix = "";
        for (int i = 0; i < segmentCount - 1; i++)
          prefix += "    ";
View Full Code Here

Examples of org.eclipse.swtbot.swt.finder.finders.PathGenerator

        } else
          log.trace(MessageFormat.format("did not match {0} with text \"{1}\", using matcher: {2}", ClassUtils.simpleClassName(item), text, StringDescription.toString(this))); //$NON-NLS-1$
      }

      if (log.isTraceEnabled() && (item instanceof Widget)) {
        PathGenerator pathGenerator = new PathGenerator();
        TreePath path = pathGenerator.getPath((Widget) item);
        int segmentCount = path.getSegmentCount();

        String prefix = ""; //$NON-NLS-1$
        for (int i = 0; i < segmentCount - 1; i++)
          prefix += "    "; //$NON-NLS-1$
View Full Code Here

Examples of org.eclipse.swtbot.swt.finder.finders.PathGenerator

    this.matcher = matcher;
  }

  protected boolean doMatch(Object obj) {
    Widget previousWidget = SWTUtils.previousWidget((Widget) obj);
    TreePath path = new PathGenerator().getPath((Widget) obj);
    int segmentCount = path.getSegmentCount();
    for (int i = 1; i < segmentCount; i++) {
      previousWidget = (Widget) path.getSegment(segmentCount - i - 1);
      if ((previousWidget instanceof Group) && matcher.matches(previousWidget))
        return true;
View Full Code Here

Examples of org.eclipse.swtbot.swt.finder.finders.PathGenerator

    this.matcher = matcher;
  }

  protected boolean doMatch(Object obj) {
    Widget previousWidget = SWTUtils.previousWidget((Widget) obj);
    TreePath path = new PathGenerator().getPath((Widget) obj);
    int segmentCount = path.getSegmentCount();
    for (int i = 1; i < segmentCount; i++) {
      previousWidget = (Widget) path.getSegment(segmentCount - i - 1);
      if ((previousWidget instanceof Group) && matcher.matches(previousWidget))
        return true;
View Full Code Here

Examples of org.eclipse.swtbot.swt.finder.finders.PathGenerator

    buf.append("\n"); //$NON-NLS-1$
  }

  public void getLocationInformation(Control control, StringBuffer buf) {
    TreePath path = controlFinder.getPath(control);
    String stringFromPath = new PathGenerator().getPathAsString(path);
    buf.append("Location: \n").append(stringFromPath).append("\n\n"); //$NON-NLS-1$ //$NON-NLS-2$
  }
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.