Package hudson.model
Class DirectoryBrowserSupport
- java.lang.Object
-
- hudson.model.DirectoryBrowserSupport
-
- All Implemented Interfaces:
org.kohsuke.stapler.HttpResponse
public final class DirectoryBrowserSupport extends Object implements org.kohsuke.stapler.HttpResponse
Has convenience methods to serve file system.This object can be used in a mix-in style to provide a directory browsing capability to a
ModelObject
.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DirectoryBrowserSupport.Path
Represents information about one file or folder.
-
Field Summary
Fields Modifier and Type Field Description static boolean
ALLOW_SYMLINK_ESCAPE
static boolean
ALLOW_TMP_DISPLAY
static String
CSP_PROPERTY_NAME
static String
DEFAULT_CSP_VALUE
ModelObject
owner
String
title
-
Constructor Summary
Constructors Constructor Description DirectoryBrowserSupport(ModelObject owner, FilePath base, String title, String icon, boolean serveDirIndex)
DirectoryBrowserSupport(ModelObject owner, String title)
Deprecated.DirectoryBrowserSupport(ModelObject owner, VirtualFile base, String title, String icon, boolean serveDirIndex)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
generateResponse(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, Object node)
void
serveFile(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, FilePath root, String icon, boolean serveDirIndex)
Deprecated.as of 1.297 Instead of calling this method explicitly, just return theDirectoryBrowserSupport
object from thedoXYZ
method and let Stapler generate a response for you.void
setIndexFileName(String fileName)
If the directory is requested but the directory listing is disabled, a file of this name is served.
-
-
-
Field Detail
-
ALLOW_SYMLINK_ESCAPE
public static boolean ALLOW_SYMLINK_ESCAPE
-
ALLOW_TMP_DISPLAY
public static boolean ALLOW_TMP_DISPLAY
-
owner
public final ModelObject owner
-
title
public final String title
-
CSP_PROPERTY_NAME
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final String CSP_PROPERTY_NAME
-
DEFAULT_CSP_VALUE
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final String DEFAULT_CSP_VALUE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DirectoryBrowserSupport
@Deprecated public DirectoryBrowserSupport(ModelObject owner, String title)
Deprecated.
-
DirectoryBrowserSupport
public DirectoryBrowserSupport(ModelObject owner, FilePath base, String title, String icon, boolean serveDirIndex)
- Parameters:
owner
- The parent model object under which the directory browsing is added.base
- The root of the directory that's bound to URL.title
- Used in the HTML caption.icon
- The icon file name, like "folder.gif"serveDirIndex
- True to generate the directory index. False to serve "index.html"
-
DirectoryBrowserSupport
public DirectoryBrowserSupport(ModelObject owner, VirtualFile base, String title, String icon, boolean serveDirIndex)
- Parameters:
owner
- The parent model object under which the directory browsing is added.base
- The root of the directory that's bound to URL.title
- Used in the HTML caption.icon
- The icon file name, like "folder.gif"serveDirIndex
- True to generate the directory index. False to serve "index.html"- Since:
- 1.532
-
-
Method Detail
-
generateResponse
public void generateResponse(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, Object node) throws IOException, javax.servlet.ServletException
- Specified by:
generateResponse
in interfaceorg.kohsuke.stapler.HttpResponse
- Throws:
IOException
javax.servlet.ServletException
-
setIndexFileName
public void setIndexFileName(String fileName)
If the directory is requested but the directory listing is disabled, a file of this name is served. By default it's "index.html".- Since:
- 1.312
-
serveFile
@Deprecated public void serveFile(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, FilePath root, String icon, boolean serveDirIndex) throws IOException, javax.servlet.ServletException, InterruptedException
Deprecated.as of 1.297 Instead of calling this method explicitly, just return theDirectoryBrowserSupport
object from thedoXYZ
method and let Stapler generate a response for you.Serves a file from the file system (Maps the URL to a directory in a file system.)- Parameters:
icon
- The icon file name, like "folder-open.gif"serveDirIndex
- True to generate the directory index. False to serve "index.html"- Throws:
IOException
javax.servlet.ServletException
InterruptedException
-
-