Subversion Repositories XServices

Rev

Rev 156 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 177
1
/*
1
/*
2
 *   Copyright 2013 Brian Rosenberger (Brutex Network)
2
 *   Copyright 2013 Brian Rosenberger (Brutex Network)
3
 *
3
 *
4
 *   Licensed under the Apache License, Version 2.0 (the "License");
4
 *   Licensed under the Apache License, Version 2.0 (the "License");
5
 *   you may not use this file except in compliance with the License.
5
 *   you may not use this file except in compliance with the License.
6
 *   You may obtain a copy of the License at
6
 *   You may obtain a copy of the License at
7
 *
7
 *
8
 *       http://www.apache.org/licenses/LICENSE-2.0
8
 *       http://www.apache.org/licenses/LICENSE-2.0
9
 *
9
 *
10
 *   Unless required by applicable law or agreed to in writing, software
10
 *   Unless required by applicable law or agreed to in writing, software
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *   See the License for the specific language governing permissions and
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
14
 *   limitations under the License.
15
 */
15
 */
16
 
16
 
17
package net.brutex.xservices.ws.rs;
17
package net.brutex.xservices.ws.rs;
18
 
18
 
19
import java.io.File;
19
import java.io.File;
20
 
20
 
21
import javax.ws.rs.DefaultValue;
21
import javax.ws.rs.DefaultValue;
22
import javax.ws.rs.GET;
22
import javax.ws.rs.GET;
23
import javax.ws.rs.Path;
23
import javax.ws.rs.Path;
24
import javax.ws.rs.Produces;
24
import javax.ws.rs.Produces;
25
import javax.ws.rs.QueryParam;
25
import javax.ws.rs.QueryParam;
26
import javax.ws.rs.core.Context;
26
import javax.ws.rs.core.Context;
27
import javax.ws.rs.core.HttpHeaders;
27
import javax.ws.rs.core.HttpHeaders;
28
import javax.ws.rs.core.Response;
28
import javax.ws.rs.core.Response;
29
import javax.ws.rs.core.UriInfo;
29
import javax.ws.rs.core.UriInfo;
30
 
30
 
31
import net.brutex.xservices.ws.XServicesFault;
31
import net.brutex.xservices.ws.XServicesFault;
32
 
32
 
33
 
33
 
34
/**
34
/**
35
 * The FileBrowsing Rest Service.
35
 * The FileBrowsing Rest Service.
36
 * 
36
 * 
37
 * @author Brian Rosenberger, bru(at)brutex.de
37
 * @author Brian Rosenberger, bru(at)brutex.de
38
 */
38
 */
39
 
39
 
40
@Path("/FileService/")
40
@Path("/FileService/")
41
@Produces({ "text/xml" })
41
@Produces({ "text/xml" })
42
public abstract interface FileInfo {
42
public abstract interface FileInfo {
43
 
43
 
44
	public final static String BASE_PATH = "/FileService/";
44
	public final static String BASE_PATH = "/FileService/";
-
 
45
	public final static String SERVICE_NAME = "FileInfoService";
45
	
46
	
46
	/**
47
	/**
47
	 * Get the file/ directory listing.
48
	 * Get the file/ directory listing.
48
	 *
49
	 *
49
	 * @param paramHttpHeaders the param http headers
50
	 * @param paramHttpHeaders the param http headers
50
	 * @param uriInfo request url info
51
	 * @param uriInfo request url info
51
	 * @param directory The directory to list.
52
	 * @param directory The directory to list.
52
	 * @param includeDirectories Whether or not to include directories in the listing. Default is true.
53
	 * @param includeDirectories Whether or not to include directories in the listing. Default is true.
53
	 * @param includeFiles Whether or not to include files in the listing. Default is true.
54
	 * @param includeFiles Whether or not to include files in the listing. Default is true.
54
	 * @param depth Include subdirectories down to a given depth. Default is 1.
55
	 * @param depth Include subdirectories down to a given depth. Default is 1.
55
	 * @param search Additional "Glob search pattern" for the file/ directory name. I.e. '*.log'
56
	 * @param search Additional "Glob search pattern" for the file/ directory name. I.e. '*.log'
56
	 * @param itemsPerPage How many items to return with one call. Default is 50.
57
	 * @param itemsPerPage How many items to return with one call. Default is 50.
57
	 * @param page Paging support. Default is 1.
58
	 * @param page Paging support. Default is 1.
58
	 * @param useCache whether or not to use cache. Defaults to true.
59
	 * @param useCache whether or not to use cache. Defaults to true.
59
	 * @return the FileInfo Set as an XML structure
60
	 * @return the FileInfo Set as an XML structure
60
	 */
61
	 */
61
	@GET
62
	@GET
62
	@Path("getFiles/")
63
	@Path("getFiles/")
63
	public abstract Response getFiles(
64
	public abstract Response getFiles(
64
			@Context HttpHeaders paramHttpHeaders,
65
			@Context HttpHeaders paramHttpHeaders,
65
			@Context UriInfo uriInfo,
66
			@Context UriInfo uriInfo,
66
			@QueryParam("directory") String directory,
67
			@QueryParam("directory") String directory,
67
			@QueryParam("includeDirectories") @DefaultValue("0") boolean includeDirectories,
68
			@QueryParam("includeDirectories") @DefaultValue("0") boolean includeDirectories,
68
			@QueryParam("includeFiles") @DefaultValue("1") boolean includeFiles,
69
			@QueryParam("includeFiles") @DefaultValue("1") boolean includeFiles,
69
			@QueryParam("depth") @DefaultValue("1") int depth,
70
			@QueryParam("depth") @DefaultValue("1") int depth,
70
			@QueryParam("search") String search,
71
			@QueryParam("search") String search,
71
			@QueryParam("itemsPerPage") @DefaultValue("50") int itemsPerPage,
72
			@QueryParam("itemsPerPage") @DefaultValue("50") int itemsPerPage,
72
			@QueryParam("page") @DefaultValue("1") int page,
73
			@QueryParam("page") @DefaultValue("1") int page,
73
			@QueryParam("usecache") @DefaultValue("1") boolean useCache);
74
			@QueryParam("usecache") @DefaultValue("1") boolean useCache);
74
 
75
 
75
	@GET
76
	@GET
76
	@Path("getFile/")
77
	@Path("getFile/")
77
	//@Produces("application/octet-stream")
78
	//@Produces("application/octet-stream")
78
	public abstract Response getFile(
79
	public abstract Response getFile(
79
			@Context HttpHeaders paramHttpHeaders,
80
			@Context HttpHeaders paramHttpHeaders,
80
			@QueryParam("file") String file);
81
			@QueryParam("file") String file);
81
}
82
}