-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Konstantin,

On 4/22/2010 5:53 PM, Konstantin Kolinko wrote:
> 2010/4/23 Christopher Schultz <ch...@christopherschultz.net>:
>> I'd love to see the code that enforces this.
> 
> Search for "applicationDispatcher.specViolation.request" and
> "applicationDispatcher.specViolation.response" or for "SRV.8.2" in the
> code.

In o.a.c.c.ApplicationDispatcher.doForward, there's this:

        if (Globals.STRICT_SERVLET_COMPLIANCE) {
            // Check SRV.8.2 / SRV.14.2.5.1 compliance
            checkSameObjects(request, response);
        }

and then

    private void checkSameObjects(ServletRequest appRequest,
            ServletResponse appResponse) throws ServletException {
        ServletRequest originalRequest =
            ApplicationFilterChain.getLastServicedRequest();
        ServletResponse originalResponse =
            ApplicationFilterChain.getLastServicedResponse();

NB: ApplicationFilterChain uses a ThreadLocal to store the "last
serviced request".

        // Some forwards, eg from valves will not set original values
        if (originalRequest == null || originalResponse == null) {
            return;
        }

        boolean same = false;
        ServletRequest dispatchedRequest = appRequest;

        //find the request that was passed into the service method
        while (originalRequest instanceof ServletRequestWrapper &&
                ((ServletRequestWrapper)
originalRequest).getRequest()!=null ) {
            originalRequest =
                ((ServletRequestWrapper) originalRequest).getRequest();
        }
        //compare with the dispatched request
        while (!same) {
            if (originalRequest.equals(dispatchedRequest)) {
                same = true;
            }
            if (!same && dispatchedRequest instanceof
ServletRequestWrapper) {
                dispatchedRequest =
                    ((ServletRequestWrapper)
dispatchedRequest).getRequest();
            } else {
                break;
            }
        }
        if (!same) {
            throw new ServletException(sm.getString(
                    "applicationDispatcher.specViolation.request"));
        }

(The remainder of the code checks the response in a similar way).

That certainly looks like it should be balking at my Proxy-based
wrapper. I'll have to check a few things, because it looks like this
isn't working as expected.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvTNZcACgkQ9CaO5/Lv0PCCuQCeLcOQFVouu0Xj6svjckN302Kx
OR0Ani5LCMLhQmkfDMAYSIKajOsWffBD
=stbu
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to