2013-12-20 07:46:30 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright 2013 Brian Rosenberger (Brutex Network)
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-08-12 09:59:47 +00:00
|
|
|
package net.brutex.xservices.ws.rs;
|
|
|
|
|
|
2013-12-20 07:46:30 +00:00
|
|
|
import java.io.File;
|
|
|
|
|
|
2012-08-12 09:59:47 +00:00
|
|
|
import javax.ws.rs.DefaultValue;
|
|
|
|
|
import javax.ws.rs.GET;
|
|
|
|
|
import javax.ws.rs.Path;
|
|
|
|
|
import javax.ws.rs.Produces;
|
|
|
|
|
import javax.ws.rs.QueryParam;
|
|
|
|
|
import javax.ws.rs.core.Context;
|
|
|
|
|
import javax.ws.rs.core.HttpHeaders;
|
|
|
|
|
import javax.ws.rs.core.Response;
|
2013-12-20 07:46:30 +00:00
|
|
|
import javax.ws.rs.core.UriInfo;
|
|
|
|
|
|
|
|
|
|
import net.brutex.xservices.ws.XServicesFault;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The FileBrowsing Rest Service.
|
|
|
|
|
*
|
|
|
|
|
* @author Brian Rosenberger, bru(at)brutex.de
|
|
|
|
|
*/
|
2012-08-12 09:59:47 +00:00
|
|
|
|
|
|
|
|
@Path("/FileService/")
|
2014-05-20 10:18:19 +00:00
|
|
|
@Produces({ "text/xml" })
|
2013-12-20 07:46:30 +00:00
|
|
|
public abstract interface FileInfo {
|
2012-08-12 09:59:47 +00:00
|
|
|
|
2013-12-20 07:46:30 +00:00
|
|
|
public final static String BASE_PATH = "/FileService/";
|
2015-08-24 07:58:52 +00:00
|
|
|
public final static String SERVICE_NAME = "FileInfoService";
|
2013-12-20 07:46:30 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the file/ directory listing.
|
|
|
|
|
*
|
|
|
|
|
* @param paramHttpHeaders the param http headers
|
|
|
|
|
* @param uriInfo request url info
|
|
|
|
|
* @param directory The directory to list.
|
|
|
|
|
* @param includeDirectories Whether or not to include directories in the listing. Default is true.
|
|
|
|
|
* @param includeFiles Whether or not to include files in the listing. Default is true.
|
|
|
|
|
* @param depth Include subdirectories down to a given depth. Default is 1.
|
|
|
|
|
* @param search Additional "Glob search pattern" for the file/ directory name. I.e. '*.log'
|
|
|
|
|
* @param itemsPerPage How many items to return with one call. Default is 50.
|
|
|
|
|
* @param page Paging support. Default is 1.
|
|
|
|
|
* @param useCache whether or not to use cache. Defaults to true.
|
|
|
|
|
* @return the FileInfo Set as an XML structure
|
|
|
|
|
*/
|
|
|
|
|
@GET
|
|
|
|
|
@Path("getFiles/")
|
|
|
|
|
public abstract Response getFiles(
|
|
|
|
|
@Context HttpHeaders paramHttpHeaders,
|
|
|
|
|
@Context UriInfo uriInfo,
|
|
|
|
|
@QueryParam("directory") String directory,
|
|
|
|
|
@QueryParam("includeDirectories") @DefaultValue("0") boolean includeDirectories,
|
|
|
|
|
@QueryParam("includeFiles") @DefaultValue("1") boolean includeFiles,
|
|
|
|
|
@QueryParam("depth") @DefaultValue("1") int depth,
|
|
|
|
|
@QueryParam("search") String search,
|
|
|
|
|
@QueryParam("itemsPerPage") @DefaultValue("50") int itemsPerPage,
|
|
|
|
|
@QueryParam("page") @DefaultValue("1") int page,
|
|
|
|
|
@QueryParam("usecache") @DefaultValue("1") boolean useCache);
|
|
|
|
|
|
|
|
|
|
@GET
|
|
|
|
|
@Path("getFile/")
|
|
|
|
|
//@Produces("application/octet-stream")
|
|
|
|
|
public abstract Response getFile(
|
|
|
|
|
@Context HttpHeaders paramHttpHeaders,
|
|
|
|
|
@QueryParam("file") String file);
|
|
|
|
|
}
|