public class AttachmentServlet extends WebdavServlet
Authentication is done using JSPWiki's normal AAA framework.
This servlet is also capable of managing dynamically created attachments.
Modifier and Type | Field and Description |
---|---|
protected static long |
DEFAULT_EXPIRY
Default expiry period is 1 day
|
SC_FAILED_DEPENDENCY, SC_INSUFFICIENT_STORAGE, SC_LOCKED, SC_MULTISTATUS, SC_PROCESSING, SC_UNPROCESSABLE
Constructor and Description |
---|
AttachmentServlet() |
Modifier and Type | Method and Description |
---|---|
void |
doGet(HttpServletRequest req,
HttpServletResponse res)
Serves a GET with two parameters: 'wikiname' specifying the wikiname
of the attachment, 'version' specifying the version indicator.
|
protected void |
doOptions(HttpServletRequest req,
HttpServletResponse res)
Implements the OPTIONS method.
|
void |
doPost(HttpServletRequest req,
HttpServletResponse res)
Grabs mime/multipart data and stores it into the temporary area.
|
void |
doPropFind(HttpServletRequest req,
HttpServletResponse res)
Implements the PROPFIND method.
|
void |
doPut(HttpServletRequest req,
HttpServletResponse res) |
protected boolean |
executeUpload(WikiContext context,
java.io.InputStream data,
java.lang.String filename,
java.lang.String errorPage,
java.lang.String parentPage,
java.lang.String changenote,
long contentLength) |
void |
init(ServletConfig config)
Initializes the servlet from WikiEngine properties.
|
protected java.lang.String |
upload(HttpServletRequest req)
Uploads a specific mime multipart input set, intercepts exceptions.
|
doCopy, doLock, doMkCol, doMove, doPropPatch, doUnlock, service
protected static final long DEFAULT_EXPIRY
public void init(ServletConfig config) throws ServletException
ServletException
public void doPropFind(HttpServletRequest req, HttpServletResponse res) throws java.io.IOException, ServletException
doPropFind
in class WebdavServlet
req
- The servlet requestres
- The servlet responsejava.io.IOException
- If input/output failsServletException
- If the servlet has issuesprotected void doOptions(HttpServletRequest req, HttpServletResponse res)
req
- The servlet requestres
- The servlet responsepublic void doGet(HttpServletRequest req, HttpServletResponse res) throws java.io.IOException, ServletException
java.io.IOException
ServletException
public void doPost(HttpServletRequest req, HttpServletResponse res) throws java.io.IOException, ServletException
The input to this servlet is generated by an HTML FORM with two parts. The first, named 'page', is the WikiName identifier for the parent file. The second, named 'content', is the binary content of the file.
java.io.IOException
ServletException
public void doPut(HttpServletRequest req, HttpServletResponse res) throws java.io.IOException, ServletException
java.io.IOException
ServletException
protected java.lang.String upload(HttpServletRequest req) throws RedirectException, java.io.IOException
req
- The servlet requestRedirectException
- If there's an error and a redirection is neededjava.io.IOException
- If upload failsFileUploadException
protected boolean executeUpload(WikiContext context, java.io.InputStream data, java.lang.String filename, java.lang.String errorPage, java.lang.String parentPage, java.lang.String changenote, long contentLength) throws RedirectException, java.io.IOException, ProviderException
context
- the wiki contextdata
- the input stream datafilename
- the name of the file to uploaderrorPage
- the place to which you want to get a redirectionparentPage
- the page to which the file should be attachedchangenote
- The change notecontentLength
- The content lengthtrue
if upload results in the creation of a new page;
false
otherwiseRedirectException
- If the content needs to be redirectedjava.io.IOException
- If there is a problem in the upload.ProviderException
- If there is a problem in the backend.stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.