com.logicaldoc.web.util
Class ServletDocUtil

java.lang.Object
  extended by com.logicaldoc.web.util.ServletDocUtil

public class ServletDocUtil
extends java.lang.Object

Some helper utilities to download/upload a document and its resources. The downloaded document is also added to the recent files of the user.

Author:
Sebastian Stein

Constructor Summary
ServletDocUtil()
           
 
Method Summary
static void addToRecentFiles(long userId, long docId)
          Adds the given document to the recent files entry of the user
static void downloadDocument(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, long docId, java.lang.String fileVersion, java.lang.String suffix, com.logicaldoc.core.security.User user)
          Sends the specified document to the response object; the client will receive it as a download
static void downloadDocument(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String docId, java.lang.String fileVersion, com.logicaldoc.core.security.User user)
          sends the specified document to the response object; the client will receive it as a download
static void downloadDocumentText(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, long docId)
          Sends the specified document's indexed text to the response object; the client will receive it as a download
static void uploadDocumentResource(javax.servlet.http.HttpServletRequest request, java.lang.String docId, java.lang.String suffix, java.lang.String fileVersion, java.lang.String docVersion)
          Uploads a document's related resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServletDocUtil

public ServletDocUtil()
Method Detail

addToRecentFiles

public static void addToRecentFiles(long userId,
                                    long docId)
Adds the given document to the recent files entry of the user

Parameters:
userId - the id of the user accessing the file
docId - id of the document the user accessed

downloadDocument

public static void downloadDocument(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response,
                                    long docId,
                                    java.lang.String fileVersion,
                                    java.lang.String suffix,
                                    com.logicaldoc.core.security.User user)
                             throws java.io.FileNotFoundException,
                                    java.io.IOException
Sends the specified document to the response object; the client will receive it as a download

Parameters:
request - the current request
response - the document is written to this object
docId - Id of the document
fileVersion - name of the file version; if null the latest version will be returned
Throws:
java.io.FileNotFoundException
java.io.IOException

downloadDocumentText

public static void downloadDocumentText(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response,
                                        long docId)
                                 throws java.io.FileNotFoundException,
                                        java.io.IOException
Sends the specified document's indexed text to the response object; the client will receive it as a download

Parameters:
request - the current request
response - the document is written to this object
docId - Id of the document
version - name of the version; if null the latest version will returned
Throws:
java.io.FileNotFoundException
java.io.IOException

downloadDocument

public static void downloadDocument(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response,
                                    java.lang.String docId,
                                    java.lang.String fileVersion,
                                    com.logicaldoc.core.security.User user)
                             throws java.io.FileNotFoundException,
                                    java.io.IOException
sends the specified document to the response object; the client will receive it as a download

Parameters:
request - the current request
response - the document is written to this object
docId - Id of the document
fileVersion - name of the file version; if null the latest version will be returned
Throws:
java.io.FileNotFoundException
java.io.IOException

uploadDocumentResource

public static void uploadDocumentResource(javax.servlet.http.HttpServletRequest request,
                                          java.lang.String docId,
                                          java.lang.String suffix,
                                          java.lang.String fileVersion,
                                          java.lang.String docVersion)
                                   throws java.lang.Exception
Uploads a document's related resource. The resource will be stored in the folder where the document's files reside using the following pattern: fileVersion-suffix If no version is specified, the current one is used instead

Parameters:
request - the current request
docId - Id of the document
suffix - Suffix of the document
fileVersion - id of the file version; if null the latest version will returned
docVersion - id of the doc version; if null the latest version will returned
Throws:
java.lang.Exception


Copyright © 2008-2010 Logical Objects. All Rights Reserved.