|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.ecyrd.jspwiki.dav.WebdavServlet
com.ecyrd.jspwiki.attachment.AttachmentServlet
public class AttachmentServlet
This is a simple file upload servlet customized for JSPWiki. It receives a mime/multipart POST message, as sent by an Attachment page, stores it temporarily, figures out what WikiName to use to store it, checks for previously existing versions.
This servlet does not worry about authentication; we leave that to the container, or a previous servlet that chains to us.
Field Summary | |
---|---|
protected static long |
DEFAULT_EXPIRY
Default expiry period is 1 day |
static String |
HDR_NAME
|
static String |
HDR_VERSION
|
Fields inherited from class com.ecyrd.jspwiki.dav.WebdavServlet |
---|
SC_FAILED_DEPENDENCY, SC_INSUFFICIENT_STORAGE, SC_LOCKED, SC_MULTISTATUS, SC_PROCESSING, SC_UNPROCESSABLE |
Constructor Summary | |
---|---|
AttachmentServlet()
|
Method Summary | |
---|---|
void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Serves a GET with two parameters: 'wikiname' specifying the wikiname of the attachment, 'version' specifying the version indicator. |
protected void |
doOptions(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
|
void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Grabs mime/multipart data and stores it into the temporary area. |
void |
doPropFind(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
|
void |
doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
|
protected boolean |
executeUpload(WikiContext context,
InputStream data,
String filename,
String errorPage,
String parentPage,
long contentLength)
|
void |
init(javax.servlet.ServletConfig config)
Initializes the servlet from WikiEngine properties. |
protected String |
upload(javax.servlet.http.HttpServletRequest req)
Uploads a specific mime multipart input set, intercepts exceptions. |
Methods inherited from class com.ecyrd.jspwiki.dav.WebdavServlet |
---|
doCopy, doLock, doMkCol, doMove, doPropPatch, doUnlock, service |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doHead, doTrace, getLastModified, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String HDR_VERSION
public static final String HDR_NAME
protected static final long DEFAULT_EXPIRY
Constructor Detail |
---|
public AttachmentServlet()
Method Detail |
---|
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
public void doPropFind(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws IOException, javax.servlet.ServletException
doPropFind
in class WebdavServlet
IOException
javax.servlet.ServletException
protected void doOptions(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
doOptions
in class javax.servlet.http.HttpServlet
public void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws IOException, javax.servlet.ServletException
doGet
in class javax.servlet.http.HttpServlet
IOException
javax.servlet.ServletException
public void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws IOException, javax.servlet.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.
doPost
in class javax.servlet.http.HttpServlet
IOException
javax.servlet.ServletException
public void doPut(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws IOException, javax.servlet.ServletException
doPut
in class javax.servlet.http.HttpServlet
IOException
javax.servlet.ServletException
protected String upload(javax.servlet.http.HttpServletRequest req) throws RedirectException, IOException
RedirectException
IOException
protected boolean executeUpload(WikiContext context, InputStream data, String filename, String errorPage, String parentPage, long contentLength) throws RedirectException, 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 attached
true
if upload results in the creation of a new page;
false
otherwise
RedirectException
IOException
ProviderException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |