Subversion Repositories XServices

Rev

Rev 147 | Rev 177 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

/*
 *   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.
 */

package net.brutex.xservices.ws.rs;

import java.io.File;

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;
import javax.ws.rs.core.UriInfo;

import net.brutex.xservices.ws.XServicesFault;


/**
 * The FileBrowsing Rest Service.
 * 
 * @author Brian Rosenberger, bru(at)brutex.de
 */

@Path("/FileService/")
@Produces({ "text/xml" })
public abstract interface FileInfo {

        public final static String BASE_PATH = "/FileService/";
        
        /**
         * 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);
}