Package com.logicaldoc.webservice
Class WebserviceServletUtil
java.lang.Object
com.logicaldoc.webservice.WebserviceServletUtil
Some methods useful in webservice servlets
- Since:
- 8.7
- Author:
- Marco Meschieri - LogicalDOC
- 
Method SummaryModifier and TypeMethodDescriptionstatic voiddownloadFile(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, File file, String fileName) Sends the specified file to the response object; the client will receive it as a download Sends the specified file to the response object; the client will receive it as a downloadstatic voidsetContentDisposition(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String filename) Sets the correct Content-Disposition header into the responsestatic SessionvalidateSession(jakarta.servlet.http.HttpServletRequest request) static SessionvalidateSession(String sid) Throws a runtime exception id the given session is invalid
- 
Method Details- 
setContentDispositionpublic static void setContentDisposition(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String filename) throws UnsupportedEncodingException Sets the correct Content-Disposition header into the response- Parameters:
- request- the HTTP request
- response- the server's response
- filename- name of the file
- Throws:
- UnsupportedEncodingException- error trying to encode the response
 
- 
downloadFilepublic static void downloadFile(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, File file, String fileName) throws IOException Sends the specified file to the response object; the client will receive it as a download Sends the specified file to the response object; the client will receive it as a download- Parameters:
- request- the current request
- response- the file is written to this object
- file- file to serve
- fileName- client file name
- Throws:
- IOException- generic I/O error
 
- 
validateSessionpublic static Session validateSession(jakarta.servlet.http.HttpServletRequest request) throws jakarta.servlet.ServletException - Throws:
- jakarta.servlet.ServletException
 
- 
validateSessionThrows a runtime exception id the given session is invalid- Parameters:
- sid- identifier of the session
- Returns:
- the session
- Throws:
- jakarta.servlet.ServletException- the session does not exist or is expired
 
 
-