package filters;

import java.io.*;
import java.sql.*;
import java.util.*;

import javax.servlet.*;


/**
 * Example filter that dumps interesting state information about a request
 * to the associated servlet context log file, before allowing the servlet
 * to process the request in the usual way.  This can be installed as needed
 * to assist in debugging problems.
 *
 * @author Craig McClanahan
 * @version $Revision: 500674 $ $Date: 2007-01-28 00:15:00 +0100 (Sun, 28 Jan 
2007) $
 */

public final class RequestDumperFilter implements javax.servlet.Filter{
<snip>
    public void doFilter(ServletRequest request, ServletResponse 
response,FilterChain chain) throws IOException, ServletException 

    {

<snip>
 // Render the HTTP servlet request properties
 if (request instanceof HttpServletRequest) 

{
     HttpServletRequest hrequest = (HttpServletRequest) request;
     HttpSession session=hrequest.getSession(true);   //obtain the session

 }


 // Pass control on to the next filter
        chain.doFilter(request, response);

    }

?
Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und 
Vertraulichkeitanmerkung/Note de déni et de confidentialité


 
Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy 
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése 
nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi 
alkalmazhatósága sincs.  Mivel az electronikus üzenetek könnyen 
megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet 
tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.



 

> Date: Thu, 27 May 2010 08:31:53 -0700
> Subject: Clustering, De-Serialization and Order of Operations
> From: hls...@gmail.com
> To: users@tomcat.apache.org
> 
> I have a question, on behalf of a client, concerning Tomcat clustering
> and deserialization, in the context of a Tapestry 5 application.
> 
> Here's the short form: some of the objects that a Tapestry
> application may put into the HttpSession will only deserialize
> correctly
> if the Tapestry application (in the form of a Servlet Filter) has
> initialized first ... but it appears that when starting up a Tomcat
> instance,
> the HttpSession data is deserialized from disk *before* the filter is
> initialized.
> 
> 
> Here's the stack trace:
> 
> ERROR ( ManagerBase:412 ) - IOException while loading
> persisted sessions: java.io.InvalidObjectException: Service token for
> service 'ProductConfig' can not be converted back into a proxy because
> no proxy provider has been registered. This may indicate that an IoC
> Registry has not been started yet.
> java.io.InvalidObjectException: Service token for service
> 'ProductConfig' can not be converted back into a proxy because no
> proxy provider has been registered. This may indicate that an IoC
> Registry has not been started yet.
> at 
> org.apache.tapestry5.ioc.internal.ServiceProxyToken.readResolve(ServiceProxyToken.java:41)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1061)
> at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1762)
> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
> at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
> at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
> at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
> at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
> at 
> org.apache.catalina.session.StandardSession.readObject(StandardSession.java:1407)
> at 
> org.apache.catalina.session.StandardSession.readObjectData(StandardSession.java:931)
> at 
> org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:394)
> at org.apache.catalina.session.StandardManager.load(StandardManager.java:321)
> at org.apache.catalina.session.StandardManager.start(StandardManager.java:637)
> at org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:432)
> at org.apache.catalina.core.StandardContext.start(StandardContext.java:4160)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
> at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
> at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
> at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
> at org.apache.catalina.core.StandardService.start(StandardService.java:448)
> at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
> at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
> Caused by: java.lang.RuntimeException: Service token for service
> 'ProductConfig' can not be converted back into a proxy because no
> proxy provider has been registered. This may indicate that an IoC
> Registry has not been started yet.
> at 
> org.apache.tapestry5.ioc.internal.SerializationSupport.readResolve(SerializationSupport.java:72)
> at 
> org.apache.tapestry5.ioc.internal.ServiceProxyToken.readResolve(ServiceProxyToken.java:37)
> 
> 
> The failure occurs inside this code:
> 
> class ServiceProxyToken implements Serializable
> {
> private final String serviceId;
> 
> ServiceProxyToken(String serviceId)
> {
> this.serviceId = serviceId;
> }
> 
> Object readResolve() throws ObjectStreamException
> {
> try
> {
> return SerializationSupport.readResolve(serviceId);
> }
> catch (Exception ex)
> {
> ObjectStreamException ose = new
> InvalidObjectException(ex.getMessage());
> ose.initCause(ex);
> 
> throw ose;
> }
> }
> 
> }
> 
> This occurs because the Tapestry IoC container has not been
> initialized by the Tapestry Filter yet.
> SerializationSupport.readResolve() requires that the Filter be
> initialized.
> 
> In case you are curious: these ServiceProxyToken objects are
> placeholder for Tapestry IoC services. In Tapestry IoC, every service
> implements an interface, and is exposed to user code as an instance of
> a proxy. The proxy hides the lifecycle of the service (i.e., to
> support just-in-time instantiation), and the proxy is Serializable
> where the actual service implementation class is not.
> 
> Sometimes an HttpSession object will hold a reference to a Tapestry
> service. When serialized, the proxy serializes a ServiceProxyToken.
> When that's deserialized, we get back an equivalent service in the new
> server.
> 
> So ... is there a configuration option somewhere to defer loading of
> the HttpSession until after the filters are instantiated? Is there
> some other mechanism that will support what I want to do?
> 
> Alternately, I'd appreciate some pointers on what code would need to
> be modified to support this scenario. It makes a big difference to
> Tapestry 5 users who use Tomcat clustering!
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> 
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
> 
> (971) 678-5210
> http://howardlewisship.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
                                          
_________________________________________________________________
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5

Reply via email to