Package com.googlecode.freewebdav.entities

Examples of com.googlecode.freewebdav.entities.WebdavFolder


        wu.setPassword((new RandPass(RandPass.NONCONFUSING_ALPHABET).getPass(6)));
        wu.setUserId(u.getUserId());
        wu.setUsername(u.getNickname());
        Key<WebdavUser> wuKey = ofy.put(wu);

        WebdavFolder root = new WebdavFolder();
        root.setParent(wuKey);
        ofy.put(root);
      }
     
      resp.getWriter().println(
          String.format(
View Full Code Here


  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    String url = AbstractRequest.stripToPath(Utils.decodePath(req.getRequestURL().toString())).substring(4);
    String fileName = url.substring(url.lastIndexOf('/') + 1);
    WebdavFolder wf = ResourceFactory.getFolder(
              ofy,
              ResourceFactory.getUserKeyFromHost(ofy, req.getHeader(Header.HOST.code)),
              url.substring(0, url.length() - fileName.length()-1));
    if(wf == null) {
      resp.sendError(404);
View Full Code Here

  private Resource getLastItem(Key parent, String[] path, int pos) {
    String name = path[pos];
   
    WebdavFile wfile = null;
    //try for a folder first
    WebdavFolder wfolder = ofy.query(WebdavFolder.class).filter("parent", parent).filter("name", name).get();
    if (wfolder == null) //try for a file next
      wfile = ofy.query(WebdavFile.class).filter("parent", parent).filter("name", name).get();
   
    if ((pos + 1) < path.length) //recurse
      return getLastItem(getKey(wfolder), path, pos+1);
View Full Code Here

    String username = host.substring(0,host.indexOf('.'));
    return ofy.query(WebdavUser.class).filter("username", username).getKey();
  }
 
  public static WebdavFolder getFolder(Objectify ofy, Key<WebdavUser> user, String url) {
    WebdavFolder wf = null;
    if (url.charAt(0) == '/')
      url = url.substring(1);
    String[] parts = url.split("/");
    Key<WebdavFolder> prevKey = ofy.query(WebdavFolder.class).filter("user", user).getKey();
    for(String part : parts) {
View Full Code Here

  public CollectionResource createCollection(String name) throws NotAuthorizedException, ConflictException, BadRequestException {
    return createFolder(ofy, getKey(getFolder()), name);
  }
 
  public static CollectionResource createFolder(Objectify ofy, Key<WebdavFolder> parent, String name) throws NotAuthorizedException, ConflictException, BadRequestException {
    WebdavFolder wf = new WebdavFolder();
    wf.setParent(parent);
    wf.setName(name);
    ofy.put(wf);
    return new FolderResource(wf);   
  }
View Full Code Here

TOP

Related Classes of com.googlecode.freewebdav.entities.WebdavFolder

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.