nl.innovationinvestments.docstore.util
Class DocstoreFilter

java.lang.Object
  extended by nl.innovationinvestments.docstore.util.DocstoreFilter
All Implemented Interfaces:
javax.servlet.Filter

public class DocstoreFilter
extends java.lang.Object
implements javax.servlet.Filter

Tee an request to the docstore. Normally a request comes in, is processed and a response is send back. This is also the case when uploading documents; one way or the other a response must be send back after the upload succeeded. But since docstore is an external application, it does not know what to send back. So a redirect url must be provided to tell docstore what to do after the upload is processed.

Another approach is to not to send the request to docstore directly and have it send the response/redirect, but split the request in two parts: one for the upload to docstore and one for the response of the application. This is what DocstoreFilter does: it 'tees' the request:
1. the complete (parameters + files) request is send to the docstore, but the CONTENT of the response is ignored (not the status!)
2. the actual request is stripped of all files and simply pushed up the chain

In real life this means that part of the URL domain of an application is configured in the web.xml to be monitored by the DocstoreFilter. Any request here will result in DocstoreFilter doing its thing and after that the "code behind" application can then gives its reaction.

Version:
$Revision: 1.10 $

Field Summary
static java.lang.String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
DocstoreFilter()
           
 
Method Summary
 void destroy()
           
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
           
 void init(javax.servlet.FilterConfig filterConfig)
           
static boolean isMultipartContent(javax.servlet.http.HttpServletRequest request)
          Utility method that determines whether the request contains multipart content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final java.lang.String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values
Constructor Detail

DocstoreFilter

public DocstoreFilter()
Method Detail

init

public void init(javax.servlet.FilterConfig filterConfig)
          throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Filter
Throws:
javax.servlet.ServletException

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException
Specified by:
doFilter in interface javax.servlet.Filter
Throws:
java.io.IOException
javax.servlet.ServletException

destroy

public void destroy()
Specified by:
destroy in interface javax.servlet.Filter

isMultipartContent

public static final boolean isMultipartContent(javax.servlet.http.HttpServletRequest request)
Utility method that determines whether the request contains multipart content.

Parameters:
request - The servlet request to be evaluated. Must be non-null.
Returns:
true if the request is multipart; false otherwise.


Copyright © 2010. All Rights Reserved.