Package org.mycore.services.zipper
Class MCRCompressServlet<T extends AutoCloseable>
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.mycore.frontend.servlets.MCRServlet
org.mycore.services.zipper.MCRCompressServlet<T>
- All Implemented Interfaces:
jakarta.servlet.Servlet
,jakarta.servlet.ServletConfig
,Serializable
- Direct Known Subclasses:
MCRTarServlet
,MCRZipServlet
This servlet delivers the contents of MCROjects to the client in
container files (see classes extending this servlet). Read permission is required.
There are three modes
- if id=mycoreobjectID (delivers the metadata, including all derivates)
- if id=derivateID (delivers all files of the derivate)
- if id=derivateID/directoryPath (delivers all files in the given directory of the derivate)
HttpServletRequest.getPathInfo()
or as
MCRServlet.getProperty(HttpServletRequest, String)
.- Author:
- Thomas Scheffler (yagee)
- See Also:
-
Field Summary
Fields inherited from class org.mycore.frontend.servlets.MCRServlet
ATTR_MYCORE_SESSION, CURRENT_THREAD_NAME_KEY, INITIAL_SERVLET_NAME_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
createContainer
(jakarta.servlet.ServletOutputStream sout, String comment) protected abstract void
disposeContainer
(T container) protected abstract String
protected String
getFilename
(MCRPath path) Constructs a path name in form of {ownerID}+'/'+{path} or {ownerID} if path is root component.protected abstract String
protected void
render
(MCRServletJob job, Exception ex) 2nd phase of doGetPost This method has a seperate transaction and gets the same MCRServletJob from the first phase (think) and any exception that occurs at the first phase.protected abstract void
sendCompressedDirectory
(MCRPath file, BasicFileAttributes attrs, T container) protected abstract void
sendCompressedFile
(MCRPath file, BasicFileAttributes attrs, T container) protected abstract void
sendMetadataCompressed
(String fileName, byte[] content, long modified, T container) protected void
think
(MCRServletJob job) 1st phase of doGetPost.Methods inherited from class org.mycore.frontend.servlets.MCRServlet
allowCrossDomainRequests, buildRedirectURL, cleanupMCRSession, doGet, doGet, doGetPost, doPost, doPost, getErrorI18N, getLastModified, getLayoutService, getProperty, getReferer, getServletBaseURL, getSession, handleException, init, initializeMCRSession, reportException, toReferrer, toReferrer
Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, service, service
Methods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
KEY_OBJECT_ID
-
KEY_PATH
-
-
Constructor Details
-
MCRCompressServlet
public MCRCompressServlet()
-
-
Method Details
-
think
Description copied from class:MCRServlet
1st phase of doGetPost. This method has a seperate transaction. Per default id does nothing as a fallback to the old behaviour.- Overrides:
think
in classMCRServlet
- Throws:
Exception
- See Also:
-
render
Description copied from class:MCRServlet
2nd phase of doGetPost This method has a seperate transaction and gets the same MCRServletJob from the first phase (think) and any exception that occurs at the first phase. By default this method calls doGetPost(MCRServletJob) as a fallback to the old behaviour.- Overrides:
render
in classMCRServlet
- Parameters:
job
- same instance as of think(MCRServlet job)ex
- any exception thrown by think(MCRServletJob) or transaction commit- Throws:
Exception
- if render could not handleex
to produce a nice user page
-
getFilename
Constructs a path name in form of {ownerID}+'/'+{path} or {ownerID} if path is root component.- Parameters:
path
- absolute path
-
sendCompressedDirectory
protected abstract void sendCompressedDirectory(MCRPath file, BasicFileAttributes attrs, T container) throws IOException - Throws:
IOException
-
sendCompressedFile
protected abstract void sendCompressedFile(MCRPath file, BasicFileAttributes attrs, T container) throws IOException - Throws:
IOException
-
sendMetadataCompressed
protected abstract void sendMetadataCompressed(String fileName, byte[] content, long modified, T container) throws IOException - Throws:
IOException
-
getMimeType
-
getFileExtension
-
createContainer
-
disposeContainer
- Throws:
IOException
-