|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.acesoft.aceoffix.FileRequest
public class FileRequest
FileRequest class is used to receive and save the document submitted by AceoffixCtrl.
FileRequest class is used to receive and save the document submitted by AceoffixCtrl. The FileRequest object must be created and used in the server page specified by AceoffixCtrl.setSaveFilePage.
Field Summary | |
---|---|
java.lang.String |
fileExtName
|
java.lang.String |
fileName
|
int |
fileSize
|
Constructor Summary | |
---|---|
FileRequest(HttpServletRequest request,
HttpServletResponse response)
Initializes a new instance of the FileRequest class. |
Method Summary | |
---|---|
void |
close()
Returns a success message to AceoffixCtrl. |
java.lang.String |
getDocumentText()
Gets the plain text of the document without format. |
byte[] |
getFileBytes()
Returns an array of the bytes in the file submitted by AceoffixCtrl. |
java.lang.String |
getFileExtName()
Gets the file name extension of the file. |
java.lang.String |
getFileName()
Gets the file name of the file submitted by AceoffixCtrl. |
int |
getFileSize()
Gets the size of the file, in bytes. |
java.io.FileInputStream |
getFileStream()
Returns an FileInputStream object which contains the file content submitted by AceoffixCtrl. |
java.lang.String |
getFormField(java.lang.String name)
Gets the value with the specified name in the form fields of the page with AceoffixCtrl. |
boolean |
saveToFile(java.lang.String filePath)
Saves the contents of the document to a disk file. |
void |
showPage(int width,
int height)
Prompt a custom dialog box to show the saving result. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.lang.String fileName
public java.lang.String fileExtName
public int fileSize
Constructor Detail |
---|
public FileRequest(HttpServletRequest request, HttpServletResponse response) throws java.lang.Exception, java.io.IOException
java.lang.Exception
java.io.IOException
Method Detail |
---|
public java.lang.String getFileName()
If the document which is going to be opened is a binary stream outputted by server page, the file name will be "aceoffix" with the correct file name extension.
public java.lang.String getFileExtName()
public int getFileSize()
public void close() throws java.io.IOException, java.lang.Exception
If the code for saving document executes successfully, you should call this method to return a success message to AceoffixCtrl. Typically, the close method should be called at the end of code in SaveDataPage.
java.io.IOException
java.lang.Exception
public boolean saveToFile(java.lang.String filePath) throws ServletException, java.io.IOException, java.lang.Exception
Saves the document to disk with a new location and file name. If you want to save the document to database, please call the getFileBytes or getFileStream method.
The following code example demonstrates how to save the document that are uploaded by AceoffixCtrl to the specified folder on the Web server's local disk. In order to display all the possible exception messages when you debug your code, do not use try...catch statements in SaveFilePage. When an exception is thrown, AceoffixCtrl will show the exception dialog box.
FileRequest freq = new FileRequest(request, response); freq.saveToFile(request.getSession().getServletContext().getRealPath("jsp/doc/") + "\\" + freq.getFileName()); freq.close();
filePath
- The fully qualified path of the file to which you want to save the document.
ServletException
java.io.IOException
java.lang.Exception
public void showPage(int width, int height) throws java.io.IOException
After save document, if you want to prompt a custom dialog box to show the saving result, you can call this method. The message page shown in the dialog box is the current SaveFilePage. By default, the SaveFilePage will display nothing. You can add friendly messages in the SaveFilePage.
width
- The width of custom dialog, in pixels.height
- The height of custom dialog, in pixels.
java.io.IOException
public byte[] getFileBytes() throws ServletException, java.io.IOException, java.lang.Exception
If you want to save the file to the data field of a database, you should call this method. If you want to save the file to disk, you only need to call saveToFile.
ServletException
java.io.IOException
java.lang.Exception
public java.io.FileInputStream getFileStream() throws ServletException, java.io.IOException, java.lang.Exception
ServletException
java.io.IOException
java.lang.Exception
public java.lang.String getDocumentText() throws java.io.IOException, java.lang.Exception
Get the text-only content and save it to database. So we can have the full-text search function in Word documents. This property only applies to Word currently.
java.io.IOException
java.lang.Exception
public java.lang.String getFormField(java.lang.String name) throws java.io.IOException, java.lang.Exception
When AceoffixCtrl is saving document, you can call this method to get the values of form fields posted from the page with AceoffixCtrl. To be able to capture the value, the form field must have a name attribute.
This form field does not support the form collection with the same name. This form field only supports the HTML INPUT tags currently.
name
- The name of form field in the page.
java.io.IOException
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |