public class AttachmentServlet extends javax.servlet.http.HttpServlet
Authentication is done using JSPWiki's normal AAA framework.
This servlet is also capable of managing dynamically created attachments.
| Constructor and Description |
|---|
AttachmentServlet() |
| Modifier and Type | Method and Description |
|---|---|
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)
Implements the OPTIONS method.
|
void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Grabs mime/multipart data and stores it into the temporary area.
|
protected boolean |
executeUpload(Context 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(javax.servlet.ServletConfig config)
Initializes the servlet from Engine properties.
|
protected java.lang.String |
upload(javax.servlet.http.HttpServletRequest req)
Uploads a specific mime multipart input set, intercepts exceptions.
|
doDelete, doHead, doPut, doTrace, getLastModified, service, servicepublic AttachmentServlet()
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
init in interface javax.servlet.Servletinit in class javax.servlet.GenericServletjavax.servlet.ServletExceptionprotected void doOptions(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
doOptions in class javax.servlet.http.HttpServletreq - The servlet requestres - The servlet responsepublic void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws java.io.IOException
doGet in class javax.servlet.http.HttpServletjava.io.IOExceptionpublic void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws java.io.IOException
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.HttpServletjava.io.IOExceptionprotected java.lang.String upload(javax.servlet.http.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 failsprotected boolean executeUpload(Context 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.Copyright (c) 2001-2022 The Apache Software Foundation. All rights reserved.