Exemplo n.º 1
0
  public static List<String> getClientLibs(ServletContext context) throws IOException {
    List<String> list = new ArrayList<String>();
    URL resource = RaplaJNLPPageGenerator.class.getResource("/clientlibs.properties");
    if (resource != null) {
      byte[] bytes = IOUtil.readBytes(resource);
      String string = new String(bytes);

      String[] split = string.split(";");
      for (String file : split) {
        list.add("webclient/" + file);
      }
    } else {
      String base = context.getRealPath(".");
      if (base != null) {
        java.io.File baseFile = new java.io.File(base);
        java.io.File[] files = IOUtil.getJarFiles(base, "webclient");
        for (File file : files) {
          String relativeURL = IOUtil.getRelativeURL(baseFile, file);
          list.add(relativeURL);
        }
      }
    }
    int size = list.size();
    for (int i = 0; i < size; i++) {
      String entry = list.get(i);
      if (entry.indexOf("raplaclient") >= 0) {
        list.remove(i);
        list.add(0, entry);
      }
    }
    return list;
  }
Exemplo n.º 2
0
 private final byte[] loadResource(String fileName) throws IOException {
   return IOUtil.readBytes(getResourceFromFile(fileName));
 }