public class DownloadServlet
extends java.lang.Object
implements javax.servlet.Servlet
Provides streaming downloads for all binary objects (FxBinary
).
The requested value is identified by its XPath or by a unique tree path.
/download/pk{n.m}/xpath/filename.ext
/download/tree/[edit,live]/fqn-path
When no XPath is provided, the first mandatory binary property of the instance's type is chosen.
?param=value¶m2
):
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BASEURL |
Constructor and Description |
---|
DownloadServlet() |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
(package private) static com.flexive.shared.value.BinaryDescriptor |
findBinaryDescriptor(com.flexive.shared.content.FxContent content,
long hintBinaryId) |
static java.lang.String |
getLink(com.flexive.shared.content.FxPK pk,
java.lang.String xpath,
java.lang.String fileName)
Returns a link (absolute to the server context) to download the binary stored under
the given XPath for the given object.
|
static java.lang.String |
getLink(java.lang.String downloadServletPath,
com.flexive.shared.content.FxPK pk,
java.lang.String xpath,
java.lang.String fileName)
Returns a link (absolute to the server context) to download the binary stored under
the given XPath for the given object.
|
static java.lang.String |
getLink(java.lang.String downloadServletPath,
java.lang.String fullXPath,
java.lang.String filename)
Returns a link (absolute to the server context) to download the binary stored under
the given XPath.
|
javax.servlet.ServletConfig |
getServletConfig() |
java.lang.String |
getServletInfo() |
void |
init(javax.servlet.ServletConfig servletConfig) |
void |
service(javax.servlet.ServletRequest servletRequest,
javax.servlet.ServletResponse servletResponse) |
public static final java.lang.String BASEURL
public void init(javax.servlet.ServletConfig servletConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
javax.servlet.ServletException
public javax.servlet.ServletConfig getServletConfig()
getServletConfig
in interface javax.servlet.Servlet
public java.lang.String getServletInfo()
getServletInfo
in interface javax.servlet.Servlet
public void destroy()
destroy
in interface javax.servlet.Servlet
public void service(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse) throws javax.servlet.ServletException, java.io.IOException
service
in interface javax.servlet.Servlet
javax.servlet.ServletException
java.io.IOException
public static java.lang.String getLink(com.flexive.shared.content.FxPK pk, java.lang.String xpath, java.lang.String fileName)
fileName
is the filename visible to
the browser, the actual name of the downloaded file is determined by the stored filename.pk
- the object pkxpath
- the XPath of the binary property to be downloadedfileName
- the filename visible to the browserpublic static java.lang.String getLink(java.lang.String downloadServletPath, com.flexive.shared.content.FxPK pk, java.lang.String xpath, @Nullable java.lang.String fileName)
fileName
is the filename visible to
the browser, the actual name of the downloaded file is determined by the stored filename.downloadServletPath
- a custom download servlet pathpk
- the object pkxpath
- the XPath of the binary property to be downloadedfileName
- the filename visible to the browserpublic static java.lang.String getLink(java.lang.String downloadServletPath, java.lang.String fullXPath, java.lang.String filename)
fileName
is the filename visible to
the browser, the actual name of the downloaded file is determined by the stored filename.
Note: XPath must contain pk.downloadServletPath
- a custom download servlet path. If not set the default
BASEURL
will be used.fullXPath
- a full XPath (i.e. including the pk of a stored content instance)filename
- the filename visible to the browserstatic com.flexive.shared.value.BinaryDescriptor findBinaryDescriptor(com.flexive.shared.content.FxContent content, long hintBinaryId)