org.apache.hadoop.fs.http.server
Class HttpFSServer

java.lang.Object
  extended by org.apache.hadoop.fs.http.server.HttpFSServer

public class HttpFSServer
extends Object

Main class of HttpFSServer server.

The HttpFSServer class uses Jersey JAX-RS to binds HTTP requests to the different operations.


Constructor Summary
HttpFSServer()
           
 
Method Summary
protected  URI createUploadRedirectionURL(javax.ws.rs.core.UriInfo uriInfo, Enum<?> uploadOperation)
          Creates the URL for an upload operation (create or append).
 javax.ws.rs.core.Response delete(Principal user, HttpFSParams.FsPathParam path, HttpFSParams.DeleteOpParam op, HttpFSParams.DeleteRecursiveParam recursive, HttpFSParams.DoAsParam doAs)
          Binding to handle all DELETE requests.
 javax.ws.rs.core.Response get(Principal user, HttpFSParams.FsPathParam path, HttpFSParams.GetOpParam op, HttpFSParams.OffsetParam offset, HttpFSParams.LenParam len, HttpFSParams.FilterParam filter, HttpFSParams.DoAsParam doAs, HttpFSParams.OverwriteParam override, HttpFSParams.BlockSizeParam blockSize, HttpFSParams.PermissionParam permission, HttpFSParams.ReplicationParam replication)
          Binding to handle all GET requests, supported operations are
 javax.ws.rs.core.Response post(InputStream is, Principal user, javax.ws.rs.core.UriInfo uriInfo, HttpFSParams.FsPathParam path, HttpFSParams.PostOpParam op, HttpFSParams.DataParam hasData, HttpFSParams.DoAsParam doAs)
          Binding to handle all OPST requests, supported operations are
 javax.ws.rs.core.Response put(InputStream is, Principal user, javax.ws.rs.core.UriInfo uriInfo, HttpFSParams.FsPathParam path, HttpFSParams.PutOpParam op, HttpFSParams.ToPathParam toPath, HttpFSParams.OwnerParam owner, HttpFSParams.GroupParam group, HttpFSParams.OverwriteParam override, HttpFSParams.BlockSizeParam blockSize, HttpFSParams.PermissionParam permission, HttpFSParams.ReplicationParam replication, HttpFSParams.ModifiedTimeParam modifiedTime, HttpFSParams.AccessTimeParam accessTime, HttpFSParams.DataParam hasData, HttpFSParams.DoAsParam doAs)
          Binding to handle all PUT requests, supported operations are
 javax.ws.rs.core.Response root(Principal user, HttpFSParams.GetOpParam op, HttpFSParams.FilterParam filter, HttpFSParams.DoAsParam doAs)
          Special binding for '/' as it is not handled by the wildcard binding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpFSServer

public HttpFSServer()
Method Detail

root

public javax.ws.rs.core.Response root(@Context
                                      Principal user,
                                      HttpFSParams.GetOpParam op,
                                      HttpFSParams.FilterParam filter,
                                      HttpFSParams.DoAsParam doAs)
                               throws IOException,
                                      FileSystemAccessException
Special binding for '/' as it is not handled by the wildcard binding.

Parameters:
user - principal making the request.
op - GET operation, default value is @link org.apache.hadoop.fs.http.client.HttpFSFileSystem.GetOpValues#OPEN}.
filter - Glob filter, default value is none. Used only if the operation is @link org.apache.hadoop.fs.http.client.HttpFSFileSystem.GetOpValues#LISTSTATUS}
doAs - user being impersonated, defualt value is none. It can be used only if the current user is a HttpFSServer proxyuser.
Returns:
the request response
Throws:
IOException - thrown if an IO error occurred. Thrown exceptions are handled by HttpFSExceptionProvider.
FileSystemAccessException - thrown if a FileSystemAccess releated error occurred. Thrown exceptions are handled by HttpFSExceptionProvider.

get

public javax.ws.rs.core.Response get(@Context
                                     Principal user,
                                     HttpFSParams.FsPathParam path,
                                     HttpFSParams.GetOpParam op,
                                     HttpFSParams.OffsetParam offset,
                                     HttpFSParams.LenParam len,
                                     HttpFSParams.FilterParam filter,
                                     HttpFSParams.DoAsParam doAs,
                                     HttpFSParams.OverwriteParam override,
                                     HttpFSParams.BlockSizeParam blockSize,
                                     HttpFSParams.PermissionParam permission,
                                     HttpFSParams.ReplicationParam replication)
                              throws IOException,
                                     FileSystemAccessException
Binding to handle all GET requests, supported operations are

Parameters:
user - principal making the request.
path - path for the GET request.
op - GET operation, default value is @link org.apache.hadoop.fs.http.client.HttpFSFileSystem.GetOpValues#OPEN}.
offset - of the file being fetch, used only with
len - amounts of bytes, used only with @link org.apache.hadoop.fs.http.client.HttpFSFileSystem.GetOpValues#OPEN} operations.
filter - Glob filter, default value is none. Used only if the operation is @link org.apache.hadoop.fs.http.client.HttpFSFileSystem.GetOpValues#LISTSTATUS}
doAs - user being impersonated, defualt value is none. It can be used only if the current user is a HttpFSServer proxyuser.
override - default is true. Used only for
blockSize - block size to set, used only by
permission - permission to set, used only by
replication - replication factor to set, used only by
Returns:
the request response.
Throws:
IOException - thrown if an IO error occurred. Thrown exceptions are handled by HttpFSExceptionProvider.
FileSystemAccessException - thrown if a FileSystemAccess releated error occurred. Thrown exceptions are handled by HttpFSExceptionProvider.

createUploadRedirectionURL

protected URI createUploadRedirectionURL(javax.ws.rs.core.UriInfo uriInfo,
                                         Enum<?> uploadOperation)
Creates the URL for an upload operation (create or append).

Parameters:
uriInfo - uri info of the request.
uploadOperation - operation for the upload URL.
Returns:
the URI for uploading data.

delete

public javax.ws.rs.core.Response delete(@Context
                                        Principal user,
                                        HttpFSParams.FsPathParam path,
                                        HttpFSParams.DeleteOpParam op,
                                        HttpFSParams.DeleteRecursiveParam recursive,
                                        HttpFSParams.DoAsParam doAs)
                                 throws IOException,
                                        FileSystemAccessException
Binding to handle all DELETE requests.

Parameters:
user - principal making the request.
path - path for the DELETE request.
op - DELETE operation, default value is @link org.apache.hadoop.fs.http.client.HttpFSFileSystem.DeleteOpValues#DELETE}.
recursive - indicates if the delete is recursive, default is false
doAs - user being impersonated, defualt value is none. It can be used only if the current user is a HttpFSServer proxyuser.
Returns:
the request response.
Throws:
IOException - thrown if an IO error occurred. Thrown exceptions are handled by HttpFSExceptionProvider.
FileSystemAccessException - thrown if a FileSystemAccess releated error occurred. Thrown exceptions are handled by HttpFSExceptionProvider.

put

public javax.ws.rs.core.Response put(InputStream is,
                                     @Context
                                     Principal user,
                                     @Context
                                     javax.ws.rs.core.UriInfo uriInfo,
                                     HttpFSParams.FsPathParam path,
                                     HttpFSParams.PutOpParam op,
                                     HttpFSParams.ToPathParam toPath,
                                     HttpFSParams.OwnerParam owner,
                                     HttpFSParams.GroupParam group,
                                     HttpFSParams.OverwriteParam override,
                                     HttpFSParams.BlockSizeParam blockSize,
                                     HttpFSParams.PermissionParam permission,
                                     HttpFSParams.ReplicationParam replication,
                                     HttpFSParams.ModifiedTimeParam modifiedTime,
                                     HttpFSParams.AccessTimeParam accessTime,
                                     HttpFSParams.DataParam hasData,
                                     HttpFSParams.DoAsParam doAs)
                              throws IOException,
                                     FileSystemAccessException
Binding to handle all PUT requests, supported operations are

Parameters:
is - request input stream, used only for
user - principal making the request.
uriInfo - the request uriInfo.
path - path for the PUT request.
op - PUT operation, no default value.
toPath - new path, used only for HttpFSFileSystem.PutOpValues.RENAME operations.
owner - owner to set, used only for
group - group to set, used only for
override - default is true. Used only for
blockSize - block size to set, used only by
permission - permission to set, used only by
replication - replication factor to set, used only by
modifiedTime - modified time, in seconds since EPOC, used only by
accessTime - accessed time, in seconds since EPOC, used only by
hasData - indicates if the append request is uploading data or not (just getting the handle).
doAs - user being impersonated, defualt value is none. It can be used only if the current user is a HttpFSServer proxyuser.
Returns:
the request response.
Throws:
IOException - thrown if an IO error occurred. Thrown exceptions are handled by HttpFSExceptionProvider.
FileSystemAccessException - thrown if a FileSystemAccess releated error occurred. Thrown exceptions are handled by HttpFSExceptionProvider.

post

public javax.ws.rs.core.Response post(InputStream is,
                                      @Context
                                      Principal user,
                                      @Context
                                      javax.ws.rs.core.UriInfo uriInfo,
                                      HttpFSParams.FsPathParam path,
                                      HttpFSParams.PostOpParam op,
                                      HttpFSParams.DataParam hasData,
                                      HttpFSParams.DoAsParam doAs)
                               throws IOException,
                                      FileSystemAccessException
Binding to handle all OPST requests, supported operations are

Parameters:
is - request input stream, used only for
user - principal making the request.
uriInfo - the request uriInfo.
path - path for the POST request.
op - POST operation, default is @link org.apache.hadoop.fs.http.client.HttpFSFileSystem.PostOpValues#APPEND}.
hasData - indicates if the append request is uploading data or not (just getting the handle).
doAs - user being impersonated, defualt value is none. It can be used only if the current user is a HttpFSServer proxyuser.
Returns:
the request response.
Throws:
IOException - thrown if an IO error occurred. Thrown exceptions are handled by HttpFSExceptionProvider.
FileSystemAccessException - thrown if a FileSystemAccess releated error occurred. Thrown exceptions are handled by HttpFSExceptionProvider.


Copyright © 2012 Apache Software Foundation. All Rights Reserved.