| java.lang.Object | ||
| ↳ | com.microstrategy.web.tasks.AbstractBaseTask | |
| ↳ | com.microstrategy.web.tasks.UploadFileTask | |
This Task processes the file uploaded from an HTML form and returns the content of the file to client. Client side JavaScript can not read the contents of local files for security reasons.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| class | UploadFileTask.UploadFileParseOptions | A class which holds all parsing options used by the parseUploadedFile(com.microstrategy.web.tasks.UploadFileTask.UploadFileParseOptions, PostedFile, StringBuffer)
method. |
|||||||||
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.microstrategy.web.tasks.AbstractBaseTask
| |||||||||||
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.microstrategy.web.tasks.AbstractBaseTask
| |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
UploadFileTask()
Creates a new UploadFileTask object.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| void |
processRequest(TaskRequestContext context, TaskOutput taskOutput)
This method uploads the contents of a file and processes it for
use in the MicroStrategy Prompts page.
| ||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| void |
constructTaskOutput(TaskOutput taskOutput, String uploadText, boolean isTruncated, TaskRequestContext ctx, UploadFileTask.UploadFileParseOptions options)
Construct the Task output given the upload file text.
| ||||||||||
| UploadFileTask.UploadFileParseOptions |
generateParseOptions(RequestKeys requestKeys)
Generate a list of parse options based on the contents of the
Task parameters.
| ||||||||||
| boolean |
parseUploadedFile(UploadFileTask.UploadFileParseOptions options, PostedFile file, StringBuffer buffer)
Parses the contents of the uploaded file text.
| ||||||||||
| PostedFile |
retrieveUploadedFile(TaskRequestContext context, RequestKeys requestKeys)
Retrieves the uploaded file as an instance of a PostedFile.
| ||||||||||
| void |
validateExtension(RequestKeys requestKeys, PostedFile file)
Validates whether the extension of the file is acceptable or
not.
| ||||||||||
| void |
validateMaxSize(RequestKeys requestKeys, PostedFile file)
Validate that the maximum size of the uploaded file does not
exceed the maximum specified.
| ||||||||||
| void |
validateUploadedFile(RequestKeys requestKeys, PostedFile file)
Performs a validation of the uploaded file.
| ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.microstrategy.web.tasks.AbstractBaseTask
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.microstrategy.web.tasks.Task
| |||||||||||
Creates a new UploadFileTask object.
This method uploads the contents of a file and processes it for use in the MicroStrategy Prompts page. It follows through these steps:
retrieveUploadedFile(TaskRequestContext, RequestKeys).validateUploadedFile(RequestKeys, PostedFile).generateParseOptions(RequestKeys).parseUploadedFile(com.microstrategy.web.tasks.UploadFileTask.UploadFileParseOptions, PostedFile, StringBuffer).constructTaskOutput(TaskOutput, String, boolean, TaskRequestContext, com.microstrategy.web.tasks.UploadFileTask.UploadFileParseOptions).| context | The TaskRequestContext that contains all
information about this Task invocation. |
|---|---|
| taskOutput | The TaskOutput that contains our response. |
| TaskException | If anything fails along the way. See the individual methods invoked by this method. |
|---|
Construct the Task output given the upload file text.
| taskOutput | The TaskOutput instance to populate into. |
|---|---|
| uploadText | The uploaded, processed file text. |
| isTruncated | Whether the uploaded text has been truncated because the size limitation |
| options | A UploadFileTask.UploadFileParseOptions object that controls how
the parsing is performed. |
| TaskException | If there was any problem serializing the results to the TaskOutput. |
|---|
Generate a list of parse options based on the contents of the Task parameters.
| requestKeys | The RequestKeys that contains the values of
all Task parameters. |
|---|
UploadFileTask.UploadFileParseOptions class that
contains values for all parse options.
Parses the contents of the uploaded file text.
| options | A UploadFileTask.UploadFileParseOptions object that controls how
the parsing is performed. |
|---|---|
| file | The PostedFile that represents the uploade file. |
| buffer | The output buffer to append the content from file. |
true means the file is longer than the
limitation set in options, and truncated content has been put into the output buffer. false
means full content of the file has been put into the output buffer.| TaskException | If anything fails while parsing the contents of the file. |
|---|
Retrieves the uploaded file as an instance of a PostedFile.
| context | The TaskRequestContext that contains all
information about the incoming Task request. |
|---|---|
| requestKeys | The RequestKeys that contains all Task
parameter values. |
PostedFile that contains the contents of the uploaded
file.| TaskException | If there is no file uploaded. |
|---|
Validates whether the extension of the file is acceptable or not.
| requestKeys | The RequestKeys instance that contains all
values of Task parameters. |
|---|---|
| file | The PostedFile that represents our uploaded file. |
| TaskException | If validation fails. |
|---|
Validate that the maximum size of the uploaded file does not exceed the maximum specified.
| requestKeys | The RequestKeys instance that contains all
values of Task parameters. |
|---|---|
| file | The PostedFile that represents our uploaded file. |
| TaskException | If validation fails. |
|---|
Performs a validation of the uploaded file. In this particular instance, it performs two checks:
validateMaxSize(RequestKeys, PostedFile).validateExtension(RequestKeys, PostedFile).| requestKeys | The RequestKeys instance that contains all
values of Task parameters. |
|---|---|
| file | The PostedFile that represents our uploaded file. |
| TaskException | If any validation fails. |
|---|