Class AbstractDownloadStrategy
- java.lang.Object
-
- com.atlassian.bamboo.plugin.servlet.AbstractDownloadStrategy
-
- All Implemented Interfaces:
com.atlassian.plugin.servlet.DownloadStrategy
- Direct Known Subclasses:
ArtifactDownloadStrategy,BambooSpecsZipDownloadStrategy,DefaultDownloadStrategy,DeploymentDownloadStrategy,GlobalArtifactDownloadStrategy,SpecLogsDownloadStrategy
public abstract class AbstractDownloadStrategy extends Object implements com.atlassian.plugin.servlet.DownloadStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected BambooAuthenticationContextauthenticationContextprotected BambooContentTypeResolverbambooContentTypeResolverprotected BambooPermissionManagerbambooPermissionManagerprotected static org.apache.log4j.Loggerlog
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDownloadStrategy(AdministrationConfigurationAccessor administrationConfigurationAccessor, BambooContentTypeResolver bambooContentTypeResolver, BambooAuthenticationContext authenticationContext, BambooPermissionManager bambooPermissionManager)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract @NotNull TitledFilegetFileToServe(RequestPath requestPath, javax.servlet.http.HttpServletRequest request)protected abstract StringgetServletPath()Returns the servlet path handled by this download strategy.protected booleanisCompressionEnabled()booleanmatches(String requestUri)voidserveFile(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse)protected voidthrowPermissionException(RequestPath requestPath)Throws an exception indicating that the current user does not have permission to access the requested item.
-
-
-
Field Detail
-
log
protected static final org.apache.log4j.Logger log
-
bambooContentTypeResolver
protected final BambooContentTypeResolver bambooContentTypeResolver
-
authenticationContext
protected final BambooAuthenticationContext authenticationContext
-
bambooPermissionManager
protected final BambooPermissionManager bambooPermissionManager
-
-
Constructor Detail
-
AbstractDownloadStrategy
protected AbstractDownloadStrategy(AdministrationConfigurationAccessor administrationConfigurationAccessor, BambooContentTypeResolver bambooContentTypeResolver, BambooAuthenticationContext authenticationContext, BambooPermissionManager bambooPermissionManager)
-
-
Method Detail
-
matches
public boolean matches(String requestUri)
- Specified by:
matchesin interfacecom.atlassian.plugin.servlet.DownloadStrategy
-
getServletPath
protected abstract String getServletPath()
Returns the servlet path handled by this download strategy. Includes the leading "/" but no trailing "/", eg. "/download" or "/artifact".
-
serveFile
public void serveFile(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse) throws com.atlassian.plugin.servlet.DownloadException- Specified by:
serveFilein interfacecom.atlassian.plugin.servlet.DownloadStrategy- Throws:
com.atlassian.plugin.servlet.DownloadException
-
getFileToServe
@NotNull protected abstract @NotNull TitledFile getFileToServe(RequestPath requestPath, javax.servlet.http.HttpServletRequest request) throws org.acegisecurity.AccessDeniedException, FileNotFoundException, UserNotLoggedInException, WebValidationException
- Returns:
- file to serve, with an optional display name if file is a directory
- Throws:
org.acegisecurity.AccessDeniedExceptionFileNotFoundExceptionUserNotLoggedInExceptionWebValidationException
-
throwPermissionException
protected void throwPermissionException(RequestPath requestPath) throws UserNotLoggedInException, org.acegisecurity.AccessDeniedException
Throws an exception indicating that the current user does not have permission to access the requested item. The requestPath parameter may be included in the exception message and/or logs.- Throws:
UserNotLoggedInExceptionorg.acegisecurity.AccessDeniedException
-
isCompressionEnabled
protected boolean isCompressionEnabled()
-
-