147 |
brianR |
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 |
|
92 |
brianR |
17 |
package net.brutex.xservices.ws.rs;
|
|
|
18 |
|
147 |
brianR |
19 |
import java.io.File;
|
|
|
20 |
|
92 |
brianR |
21 |
import javax.ws.rs.DefaultValue;
|
|
|
22 |
import javax.ws.rs.GET;
|
|
|
23 |
import javax.ws.rs.Path;
|
|
|
24 |
import javax.ws.rs.Produces;
|
|
|
25 |
import javax.ws.rs.QueryParam;
|
|
|
26 |
import javax.ws.rs.core.Context;
|
|
|
27 |
import javax.ws.rs.core.HttpHeaders;
|
|
|
28 |
import javax.ws.rs.core.Response;
|
147 |
brianR |
29 |
import javax.ws.rs.core.UriInfo;
|
92 |
brianR |
30 |
|
147 |
brianR |
31 |
import net.brutex.xservices.ws.XServicesFault;
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
* The FileBrowsing Rest Service.
|
|
|
36 |
*
|
|
|
37 |
* @author Brian Rosenberger, bru(at)brutex.de
|
|
|
38 |
*/
|
|
|
39 |
|
92 |
brianR |
40 |
@Path("/FileService/")
|
147 |
brianR |
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(
|
|
|
79 |
@Context HttpHeaders paramHttpHeaders,
|
|
|
80 |
@QueryParam("file") String file);
|
92 |
brianR |
81 |
}
|