oracle.cabo.servlet.io
Class BaseFileUploadManager
java.lang.Object
|
+--oracle.cabo.servlet.io.FileUploadManager
|
+--oracle.cabo.servlet.io.BaseFileUploadManager
- Direct Known Subclasses:
- DefaultFileUploadManager, OrdFileUploadManager
- public abstract class BaseFileUploadManager
- extends FileUploadManager
BaseFileUploadManager manages creation of the required PageEvent, allowing clients to subclass doUploadFile
to manage the actual bytes transfer from the request, optionally returning a token for the event parameter value to identify the uploaded file.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BaseFileUploadManager
public BaseFileUploadManager()
decodeMultipartRequest
public PageEvent decodeMultipartRequest(BajaContext context,
Page page)
throws java.io.IOException,
javax.servlet.ServletException
- Decodes a multipart request. If null is returned, the page broker will automatically create a page event based on the servlet request parameters.
-
- Overrides:
decodeMultipartRequest
in class FileUploadManager
-
- Parameters:
context
- the BajaContext
page
- the page the client is requesting
- Returns:
- the PageEvent to be processed in the response
setMaximumAllowedBytes
public void setMaximumAllowedBytes(long maxAllowedBytes)
- Sets the maximum number of bytes that MultipartFormItem.writeFile() will be allowed to write. This value may be set immediately before or between calls to MultipartFormItem.writeFile(). If any call to writeFile() exceeds this value, an EOFException will be thrown.
-
- Parameters:
maxAllowedBytes
- the maximum number of bytes that MultipartFormItem.writeFile() will be allowed to write. Defaults to 128MB.
- See Also:
MultipartFormItem.writeFile(java.io.OutputStream)
getMaximumAllowedBytes
public long getMaximumAllowedBytes()
- Gets the maximum number of bytes that MultipartFormItem.writeFile() will be allowed to write.
doUploadFile
protected abstract java.lang.String doUploadFile(BajaContext context,
Page page,
MultipartFormItem item)
throws java.io.IOException
- Handler for uploading a file. Clients should override this method to process the MultipartFormItem. The return value of this function will be added to the PageEvent; if clients need further processing of the item in subsequent handling of the page, they should return a meaningful string after reading the file.
-
- Parameters:
context
- the BajaContext for this request
page
- the page the file is being uploaded from; this page object has not yet been validated for login or any other handling
item
- a MultipartFormItem that can be used to retrieve the file
- Returns:
- a value that will be inserted into the PageEvent as a substitute for the actual file contents.