	public static void main(String[] args) {
		 HostConfiguration hostConfig = new HostConfiguration();           
	     HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
	     HttpConnectionManagerParams params = new HttpConnectionManagerParams();
	     int maxHostConnections = 20;
	     params.setMaxConnectionsPerHost(hostConfig, maxHostConnections);
	     connectionManager.setParams(params);    
	     HttpClient client = new HttpClient(connectionManager);
	     Credentials creds = new UsernamePasswordCredentials("admin", "admin");
	     client.getState().setCredentials(AuthScope.ANY, creds);
	     client.setHostConfiguration(hostConfig);
	     String select = 
    		"<D:select>" + 
				"<D:prop  xmlns:ns1=\"http://ns.everydo.com/basic\" xmlns:ns0=\"DAV:\">"+
					"<ns0:displayname />"+
					"<ns1:subjects />"+
					"<ns0:iscollection />"+
					"<ns0:getlastmodified />"+
				"</D:prop>"+ 
			"</D:select>";
	     String from = 
		     "<D:from>"+
				"<D:scope>"+
					"<D:depth>infinity</D:depth>"+
				"</D:scope>"+
			"</D:from>";
	     String lessDay = get_custom_time_string(0, 0, 0);
	     String greaterDay = get_custom_time_string(23, 59, 59);
	     String where = 
			"<D:where>"+
				"<D:lte caseless=\"no\">"+
					"<D:prop xmlns=\"DAV:\">"+
						"<getlastmodified />"+
					"</D:prop>"+
					"<D:literal>" + greaterDay + "</D:literal>"+
				"</D:lte>"+
				"<D:gte caseless=\"no\">"+
				"<D:prop xmlns=\"DAV:\">"+
					"<getlastmodified />"+
				"</D:prop>"+
				"<D:literal>" + lessDay + "</D:literal>"+
				"</D:gte>"+
			"</D:where>";
	    String orderby = 
	    	 "<D:orderby>"+
				"<D:order>"+ 
					"<D:prop xmlns:ns0=\"DAV:\">"+
						"<ns0:displayname />"+ 
					"</D:prop>"+ 
					"<D:descending />"+ 
				"</D:order>"+
			"</D:orderby>";
        String limit = 
            "<D:limit>"+
                "<D:nresults>20</D:nresults>"+
            "</D:limit>";
	    String query = select + from + where + orderby + limit;
	    SearchMethod searchMethod=null;
		try {
			 searchMethod = new SearchMethod("http://localhost:8089/files?start=20",query,"D:basicsearch");
			 client.executeMethod(searchMethod);
			 Namespace edoNamespace = Namespace.getNamespace("http://ns.everydo.com/basic");
		     if (searchMethod.getStatusCode() != 207){
				 System.out.println("����ִ��ʧ�ܣ���������ǣ�" + searchMethod.getStatusCode());
				 return;
 			 }
			 MultiStatusResponse[] responses = null;
			 try{
				 MultiStatus resp = searchMethod.getResponseBodyAsMultiStatus();
				 responses = resp.getResponses();
			 } catch (DavException e){
				 System.out.println(e.getMessage());
			 }
			 for (int i=0; i<responses.length; i++) {
				 MultiStatusResponse content = responses[i];
				 String docHref = content.getHref();
				 System.out.println("source url: " + URLDecoder.decode(docHref, "utf-8"));
				 DavPropertySet properys = content.getProperties(200);
			     Boolean isFile = properys.get("iscollection").getValue().equals("0");
			     System.out.println("IsFile: " + isFile.toString());
			     String sourceName = properys.get("displayname").getValue().toString();
	             System.out.println("display name: " + sourceName);
			     if (isFile){
		             DavProperty subjects = properys.get("subjects", edoNamespace);
		             if (subjects == null || subjects.getValue() == null){
		            	 System.out.println("subjects: null");
		             }else{
		            	 System.out.println("subjects: " + subjects.getValue().toString());
		             }
			     }
			 } 
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		 HostConfiguration hostConfig = new HostConfiguration();           
	     HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
	     HttpConnectionManagerParams params = new HttpConnectionManagerParams();
	     int maxHostConnections = 20;
	     params.setMaxConnectionsPerHost(hostConfig, maxHostConnections);
	     connectionManager.setParams(params);    
	     HttpClient client = new HttpClient(connectionManager);
	     Credentials creds = new UsernamePasswordCredentials("admin", "admin");
	     client.getState().setCredentials(AuthScope.ANY, creds);
	     client.setHostConfiguration(hostConfig);
	     String select = 
    		"<D:select>" + 
				"<D:prop  xmlns:ns1=\"http://ns.everydo.com/basic\" xmlns:ns0=\"DAV:\">"+
					"<ns0:displayname />"+
					"<ns1:subjects />"+
					"<ns0:iscollection />"+
					"<ns0:getlastmodified />"+
				"</D:prop>"+ 
			"</D:select>";
	     String from = 
		     "<D:from>"+
				"<D:scope>"+
					"<D:href>/</D:href>"+
					"<D:depth>infinity</D:depth>"+
				"</D:scope>"+
			"</D:from>";
	     String lessDay = get_custom_time_string(0, 0, 0);
	     String greaterDay = get_custom_time_string(23, 59, 59);
	     String where = 
			"<D:where>"+
				"<D:lte caseless=\"no\">"+
					"<D:prop xmlns=\"DAV:\">"+
						"<getlastmodified />"+
					"</D:prop>"+
					"<D:literal>" + greaterDay + "</D:literal>"+
				"</D:lte>"+
				"<D:gte caseless=\"no\">"+
				"<D:prop xmlns=\"DAV:\">"+
					"<getlastmodified />"+
				"</D:prop>"+
				"<D:literal>" + lessDay + "</D:literal>"+
				"</D:gte>"+
			"</D:where>";
	    String orderby = 
	    	 "<D:orderby>"+
				"<D:order>"+ 
					"<D:prop xmlns:ns0=\"DAV:\">"+
						"<ns0:displayname />"+ 
					"</D:prop>"+ 
					"<D:descending />"+ 
				"</D:order>"+
			"</D:orderby>";
        String limit = 
            "<D:limit>"+
                "<D:nresults>20</D:nresults>"+
            "</D:limit>";
	    String query = select + from + where + orderby + limit;
	    SearchMethod searchMethod=null;
		try {
			 searchMethod = new SearchMethod("http://localhost:8089/files?start=20",query,"D:basicsearch");
			 client.executeMethod(searchMethod);
			 Namespace edoNamespace = Namespace.getNamespace("http://ns.everydo.com/basic");
		     if (searchMethod.getStatusCode() != 207){
				 System.out.println("����ִ��ʧ�ܣ���������ǣ�" + searchMethod.getStatusCode());
				 return;
 			 }
			 MultiStatusResponse[] responses = null;
			 try{
				 MultiStatus resp = searchMethod.getResponseBodyAsMultiStatus();
				 responses = resp.getResponses();
			 } catch (DavException e){
				 System.out.println(e.getMessage());
			 }
			 for (int i=0; i<responses.length; i++) {
				 MultiStatusResponse content = responses[i];
				 String docHref = content.getHref();
				 System.out.println("source url: " + URLDecoder.decode(docHref, "utf-8"));
				 DavPropertySet properys = content.getProperties(200);
			     Boolean isFile = properys.get("iscollection").getValue().equals("0");
			     System.out.println("IsFile: " + isFile.toString());
			     String sourceName = properys.get("displayname").getValue().toString();
	             System.out.println("display name: " + sourceName);
			     if (isFile){
		             DavProperty subjects = properys.get("subjects", edoNamespace);
		             if (subjects == null || subjects.getValue() == null){
		            	 System.out.println("subjects: null");
		             }else{
		            	 System.out.println("subjects: " + subjects.getValue().toString());
		             }
			     }
			 } 
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
