Subversion Repositories XServices

Rev

Rev 109 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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