You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jaroslav Ciml <ci...@centrum.cz> on 2013/09/26 12:43:44 UTC

StreamResponse an EventLink

Hi,

Is returning an StreamResponse instance from EventLink handler a good practice?

I have the following link in the template file.

<t:eventlink event="exportToCsv">
    ${message:exportToCsv}
</t:eventlink>

And the following method handles the event in java file.

@OnEvent("exportToCsv")
StreamResponse exportToCsv()
{
    return new TextStreamResponse("text/plain", "Just a test!");
}

If I click the event link, I get the exception

"Sanity check - neither a stream response nor a redirect response was generated for this action request."

However, this occurs just for a short response. If the response is long enough to be split into at least two chunks, everithing is fine.

Thanks for any help.

Cimlman

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: StreamResponse an EventLink

Posted by Jaroslav Ciml <ci...@centrum.cz>.
Hi,

thanks for these hints.

However, the exception is caused by something different. :(

I am not using GAE.

Setting "tapestry.gzip-compression-enabled" to "false" does not help either.

Cimlman


______________________________________________________________
> Od: Lance Java <la...@googlemail.com>
> Komu: Tapestry users <us...@tapestry.apache.org>
> Datum: 16.10.2013 13:06
> Předmět: Re: StreamResponse an EventLink
>
>Are you using GAE? You might be hitting this:
>http://code.google.com/p/googleappengine/issues/detail?id=8201
>http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/T5-and-AppEngine-1-7-3-dev-server-IllegalStateException-td5717683.html
>
>Fix here:
>https://bitbucket.org/akochnev/tap5-gae-utils/wiki/Home
>
>If not, it might be caused by the GZIP filter. Can you try setting
>"tapestry.gzip-compression-enabled" to false?
>http://tapestry.apache.org/configuration.html#Configuration-tapestry.gzipcompressionenabled
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: StreamResponse an EventLink

Posted by Jaroslav Ciml <ci...@centrum.cz>.
Hi,

good point! That's it.

isCommited() should return true after first flush() on output stream. (according to JavaDoc of javax.servlet.ServletResponse)

Tapestry calls flush() on response output stream in TapestryInternalUtils.copy() to prevent this issue.

However, there is a bug in SpringSecurity response wrapper
org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper

Call to flush() is not delegated to appropriate response stream. (bug in Spring Security 3.1.2)

https://jira.springsource.org/browse/SEC-2055

Fixed in Spring Security 3.1.3.

Thank you very much for your help.

Cheers
Cimlman

______________________________________________________________
> Od: Lance Java <la...@googlemail.com>
> Komu: Tapestry users <us...@tapestry.apache.org>
> Datum: 16.10.2013 19:23
> Předmět: Re: StreamResponse an EventLink
>
>Oops, I meant to print out the HttpServletResponse class.
>
>Once you know the response class, you'll need to put in some breakpoints to
>find out why isComitted() is not true. A response should be committed as
>soon as it's outputstream / writer is first written to or it is redirected.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: StreamResponse an EventLink

Posted by Lance Java <la...@googlemail.com>.
Oops, I meant to print out the HttpServletResponse class.

Once you know the response class, you'll need to put in some breakpoints to
find out why isComitted() is not true. A response should be committed as
soon as it's outputstream / writer is first written to or it is redirected.

Re: StreamResponse an EventLink

Posted by Jaroslav Ciml <ci...@centrum.cz>.
Hi,

inside the troublesome method, RequestGlobals.getHttpServletRequest() returns instance of

org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper

this one wraps

org.springframework.security.web.firewall.RequestWrapper

and this wraps

org.mortbay.jetty.Request

Cimlman

______________________________________________________________
> Od: Lance Java <la...@googlemail.com>
> Komu: Tapestry users <us...@tapestry.apache.org>
> Datum: 16.10.2013 16:03
> Předmět: Re: StreamResponse an EventLink
>
>Can you @Inject RequestGlobals and log
>RequestGlobals.getHttpServletRequest().getClass()?
>
>I'm thinking that one of the spring filters is wrapping the request in an
>faulty implementation. I'm starting to point the finger at
>RequestCacheAwareFilter.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: StreamResponse an EventLink

Posted by Lance Java <la...@googlemail.com>.
Can you @Inject RequestGlobals and log
RequestGlobals.getHttpServletRequest().getClass()?

I'm thinking that one of the spring filters is wrapping the request in an
faulty implementation. I'm starting to point the finger at
RequestCacheAwareFilter.

Re: StreamResponse an EventLink

Posted by Jaroslav Ciml <ci...@centrum.cz>.
Hi,

thanks for another hint. :) It was worth trying.

However, I am out of luck with this issue. RedirectFixRequestFilter from gaeutils does not help either. :(

Cimlman

______________________________________________________________
> Od: Lance Java <la...@googlemail.com>
> Komu: Tapestry users <us...@tapestry.apache.org>
> Datum: 16.10.2013 15:13
> Předmět: Re: StreamResponse an EventLink
>
>Sorry, I missed your post where you'd isolated the problem to spring
>security. I get the feeling that spring security is somehow introducing the
>exact same bug as GAE.
>
>Can you try adding the filter from the GAE fix to your module? I have a
>hunch that it will fix this your issue too.
>
>http://tinyurl.com/nxka465
>https://bitbucket.org/akochnev/tap5-gae-utils/wiki/Home
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: StreamResponse an EventLink

Posted by Lance Java <la...@googlemail.com>.
Sorry, I missed your post where you'd isolated the problem to spring
security. I get the feeling that spring security is somehow introducing the
exact same bug as GAE.

Can you try adding the filter from the GAE fix to your module? I have a
hunch that it will fix this your issue too.

http://tinyurl.com/nxka465
https://bitbucket.org/akochnev/tap5-gae-utils/wiki/Home

Re: StreamResponse an EventLink

Posted by Jaroslav Ciml <ci...@centrum.cz>.
Hi,

not sure if I understand your idea.

Spring Security is necessary to reproduce this issue. The problem occurs only with Spring Security. The same event handling method works fine on page without Spring Security.

Cimlman

______________________________________________________________
> Od: Lance Java <la...@googlemail.com>
> Komu: Tapestry users <us...@tapestry.apache.org>
> Datum: 16.10.2013 14:35
> Předmět: Re: StreamResponse an EventLink
>
>I notice there's a whole lotta spring security stuff in your stack trace
>before it gets to the TapestryFilter. Can you try removing spring security
>from the mix to try to isolate the problem?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: StreamResponse an EventLink

Posted by Lance Java <la...@googlemail.com>.
I notice there's a whole lotta spring security stuff in your stack trace
before it gets to the TapestryFilter. Can you try removing spring security
from the mix to try to isolate the problem?

Re: StreamResponse an EventLink

Posted by Lance Java <la...@googlemail.com>.
Are you using GAE? You might be hitting this:
http://code.google.com/p/googleappengine/issues/detail?id=8201
http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/T5-and-AppEngine-1-7-3-dev-server-IllegalStateException-td5717683.html

Fix here:
https://bitbucket.org/akochnev/tap5-gae-utils/wiki/Home

If not, it might be caused by the GZIP filter. Can you try setting
"tapestry.gzip-compression-enabled" to false?
http://tapestry.apache.org/configuration.html#Configuration-tapestry.gzipcompressionenabled

Re: StreamResponse an EventLink

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 26 Sep 2013 07:43:44 -0300, Jaroslav Ciml <ci...@centrum.cz> wrote:

> Hi,

Hi!

> Is returning an StreamResponse instance from EventLink handler a good  
> practice?

Yep! Why not? :)

When that StreamResponse is only used inside a page or component, it makes  
sense for its event handler to be there. On the other hand, if that's, for  
example, streaming images from a data store, as these images could be used  
in many places, I prefer to put this inside a dedicated page and return  
the StreamResource on its onActivate() method.

> I have the following link in the template file.
>
> <t:eventlink event="exportToCsv">
>     ${message:exportToCsv}
> </t:eventlink>
>
> And the following method handles the event in java file.
>
> @OnEvent("exportToCsv")
> StreamResponse exportToCsv()
> {
>     return new TextStreamResponse("text/plain", "Just a test!");
> }
>
> If I click the event link, I get the exception
>
> "Sanity check - neither a stream response nor a redirect response was  
> generated for this action request."

Weird. Which Tapestry version? I'll try to reproduce it here.

> However, this occurs just for a short response. If the response is long  
> enough to be split into at least two chunks, everithing is fine.

Define "chunk", please. :)

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: StreamResponse an EventLink

Posted by Jaroslav Ciml <ci...@centrum.cz>.
Hi,

I have two projects now. One with working StreamResponse returned from event handler and another project which throws that weird exception.

There is Tapestry version 5.3.6 in both projects.

It does not seem to be an issue of a particular servlet container.
It's Jetty 6.1.26 in both cases.
Moreover, I reproduced the exception with Tomcat 6.0.36.

I have tried to move all relevant differences in web.xml from the working project to the broken one.
It does not help either.

I am not sure if it's worth to create a JIRA issue as it is probably not a bug in Tapestry.
It's rather a bad configuration of my project.
To be honest, I have no idea what to try next.
(I have already made some workaround. However, I am instrested in the purpose anyway.)

Cimlman

______________________________________________________________
> Od: Thiago H de Paula Figueiredo <th...@gmail.com>
> Komu: Tapestry users <us...@tapestry.apache.org>
> Datum: 26.09.2013 18:43
> Předmět: Re: StreamResponse an EventLink
>
>On Thu, 26 Sep 2013 11:35:57 -0300, Jaroslav Ciml <ci...@centrum.cz> wrote:
>
>> Hi,
>
>Hi!
>
>> I am using Tapestry version 5.3.6.
>
>I tested it on 5.4-alpha-22.
>
>> This exception is thrown if I return a StreamResponse instance from an  
>> event link handler (i.e. the request URL contains something like  
>> :eventname). Everything is OK if I return the same StreamResponse  
>> instance from onActivate method.
>>
>> It also occurs only for "short" responses. The response is sent with  
>> Content-Encoding: chunked.
>> The chunks have 0x6000 bytes. If the total byte count returned by  
>> StreamResponse.getStream() is less than 0x6000, this exception occurs.
>> No exception is thrown for 0x6000 bytes or more.
>>
>> In ImmediateActionRenderResponseFilter.handle, the call  
>> response.isCommitted() returns true for "long" response but it returns  
>> false for "short" response.
>
>Weird. JIRA please? :)
>
>> Well, I tried to paste the event handler to completely different project  
>> with the same Tapestry version ...and it works.
>
>Weird. Which other version?
>
>> It can be some configuration issue.
>
>Yeah, that's what I was thinking. Different servlet container?
>
>-- 
>Thiago H. de Paula Figueiredo
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: StreamResponse an EventLink

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 26 Sep 2013 11:35:57 -0300, Jaroslav Ciml <ci...@centrum.cz> wrote:

> Hi,

Hi!

> I am using Tapestry version 5.3.6.

I tested it on 5.4-alpha-22.

> This exception is thrown if I return a StreamResponse instance from an  
> event link handler (i.e. the request URL contains something like  
> :eventname). Everything is OK if I return the same StreamResponse  
> instance from onActivate method.
>
> It also occurs only for "short" responses. The response is sent with  
> Content-Encoding: chunked.
> The chunks have 0x6000 bytes. If the total byte count returned by  
> StreamResponse.getStream() is less than 0x6000, this exception occurs.
> No exception is thrown for 0x6000 bytes or more.
>
> In ImmediateActionRenderResponseFilter.handle, the call  
> response.isCommitted() returns true for "long" response but it returns  
> false for "short" response.

Weird. JIRA please? :)

> Well, I tried to paste the event handler to completely different project  
> with the same Tapestry version ...and it works.

Weird. Which other version?

> It can be some configuration issue.

Yeah, that's what I was thinking. Different servlet container?

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: StreamResponse an EventLink

Posted by Jaroslav Ciml <ci...@centrum.cz>.
Hi,

after some time, I've encountered another instance of this exception. This time, I am a little bit further in my investigation.

The exception occurs only with Spring Security.
Spring Security 3.1.2
Tapestry 5.3.6

Returning StreamResponse from onActivate is always fine.

public class MySecurePage
{
    @OnEvent(EventConstants.ACTIVATE)
    StreamResponse activate()
    {
        // this is OK with or without Spring Security
        return new TextStreamResponse("text/plain", "activating...");
    }
}

Returning StreamResponse from handler of other event causes the issue.

public class MySecurePage
{
    @OnEvent("exportSomething")
    StreamResponse exportSomething()
    {
        // this will throw java.lang.IllegalStateException: Sanity check - neither a stream response nor a redirect response was generated for this action request.
        // but it will work if the URL is excluded from Spring Security in configuration XML using <http pattern="/MySecurePage*/**" security="none"/> 
        return new TextStreamResponse("text/plain", "exporting...");
    }
}

My security configuration is very simple.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
       xmlns:security="http://www.springframework.org/schema/security"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/security
        http://www.springframework.org/schema/security/spring-security.xsd">

    <!-- some beans -->

    <security:http auto-config="true" use-expressions="true">
        <security:intercept-url pattern="/loginPage" access="permitAll"/>
        <security:intercept-url pattern="/*" access="hasRole('ROLE_ADMIN')"/>
        <security:form-login login-page="/loginPage"/>
    </security:http>

    <beans profile="local">
        <security:authentication-manager alias="authenticationManager">
            <security:authentication-provider>
                <security:user-service>
                    <security:user name="admin" authorities="ROLE_ADMIN" password="a"/>
                </security:user-service>
            </security:authentication-provider>
        </security:authentication-manager>
    </beans>

    <!-- another profile with real authetication for production -->
    <!-- however, the issue occurs with the profile "local" -->

</beans>



Cheers
Cimlman

______________________________________________________________
> Od: Jaroslav Ciml <ci...@centrum.cz>
> Komu: Tapestry users <us...@tapestry.apache.org>
> Datum: 26.09.2013 16:36
> Předmět: Re: StreamResponse an EventLink
>
>Hi,
>
>I am using Tapestry version 5.3.6.
>
>This exception is thrown if I return a StreamResponse instance from an event link handler (i.e. the request URL contains something like :eventname).
>Everything is OK if I return the same StreamResponse instance from onActivate method.
>
>It also occurs only for "short" responses. The response is sent with Content-Encoding: chunked.
>The chunks have 0x6000 bytes. If the total byte count returned by StreamResponse.getStream() is less than 0x6000, this exception occurs.
>No exception is thrown for 0x6000 bytes or more.
>
>In ImmediateActionRenderResponseFilter.handle, the call response.isCommitted() returns true for "long" response but it returns false for "short" response.
>
>Well, I tried to paste the event handler to completely different project with the same Tapestry version ...and it works.
>It can be some configuration issue.
>
>Cimlman
>
>java.lang.IllegalStateException: Sanity check - neither a stream response nor a redirect response was generated for this action request.
>	at org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:63)
>	at $ComponentEventRequestHandler_132778db911c35e2.handle(Unknown Source)
>	at org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
>	at $ComponentEventRequestHandler_132778db911c35e2.handle(Unknown Source)
>	at org.apache.tapestry5.services.TapestryModule$41.handle(TapestryModule.java:2476)
>	at $ComponentEventRequestHandler_132778db911c35e2.handle(Unknown Source)
>	at $ComponentEventRequestHandler_132778db911c349a.handle(Unknown Source)
>	at org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)
>	at org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39)
>	at $ComponentRequestHandler_132778db911c349c.handleComponentEvent(Unknown Source)
>	at $ComponentRequestHandler_132778db911c346a.handleComponentEvent(Unknown Source)
>	at org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46)
>	at $Dispatcher_132778db911c346d.dispatch(Unknown Source)
>	at $Dispatcher_132778db911c3467.dispatch(Unknown Source)
>	at org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:302)
>	at org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
>	at $RequestHandler_132778db911c3468.service(Unknown Source)
>	at org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902)
>	at $RequestHandler_132778db911c3468.service(Unknown Source)
>	at org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892)
>	at $RequestHandler_132778db911c3468.service(Unknown Source)
>	at org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
>	at $RequestHandler_132778db911c3468.service(Unknown Source)
>	at cz.ftm.fitsoftware.services.AppModule$1.service(AppModule.java:106)
>	at $RequestFilter_132778db911c3462.service(Unknown Source)
>	at $RequestHandler_132778db911c3468.service(Unknown Source)
>	at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)
>	at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)
>	at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
>	at org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)
>	at $RequestHandler_132778db911c3468.service(Unknown Source)
>	at $RequestHandler_132778db911c345b.service(Unknown Source)
>	at org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:253)
>	at org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
>	at $HttpServletRequestHandler_132778db911c345d.service(Unknown Source)
>	at org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
>	at $HttpServletRequestFilter_132778db911c3459.service(Unknown Source)
>	at $HttpServletRequestHandler_132778db911c345d.service(Unknown Source)
>	at org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852)
>	at $HttpServletRequestHandler_132778db911c345d.service(Unknown Source)
>	at $HttpServletRequestHandler_132778db911c3458.service(Unknown Source)
>	at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171)
>	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
>	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
>	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
>	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
>	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
>	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
>	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
>	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
>	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
>	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
>	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
>	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
>	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
>	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
>	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
>	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
>	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
>	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
>	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
>	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
>	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
>	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
>	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
>	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
>	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
>	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
>	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
>	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
>	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
>	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
>	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
>	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
>	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
>	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>	at org.mortbay.jetty.Server.handle(Server.java:326)
>	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
>	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
>	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
>	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
>	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
>
>______________________________________________________________
>> Od: Thiago H de Paula Figueiredo <th...@gmail.com>
>> Komu: Tapestry users <us...@tapestry.apache.org>
>> Datum: 26.09.2013 14:42
>> Předmět: Re: StreamResponse an EventLink
>>
>>On Thu, 26 Sep 2013 07:43:44 -0300, Jaroslav Ciml <ci...@centrum.cz> wrote:
>>
>>> Hi,
>>
>>Hi!
>>
>>> <t:eventlink event="exportToCsv">
>>>     ${message:exportToCsv}
>>> </t:eventlink>
>>>
>>> @OnEvent("exportToCsv")
>>> StreamResponse exportToCsv()
>>> {
>>>     return new TextStreamResponse("text/plain", "Just a test!");
>>> }
>>
>>It works for me.
>>
>>> If I click the event link, I get the exception
>>>
>>> "Sanity check - neither a stream response nor a redirect response was  
>>> generated for this action request."
>>
>>Full stack trace or error message please.
>>
>>-- 
>>Thiago H. de Paula Figueiredo
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: StreamResponse an EventLink

Posted by Jaroslav Ciml <ci...@centrum.cz>.
Hi,

I am using Tapestry version 5.3.6.

This exception is thrown if I return a StreamResponse instance from an event link handler (i.e. the request URL contains something like :eventname).
Everything is OK if I return the same StreamResponse instance from onActivate method.

It also occurs only for "short" responses. The response is sent with Content-Encoding: chunked.
The chunks have 0x6000 bytes. If the total byte count returned by StreamResponse.getStream() is less than 0x6000, this exception occurs.
No exception is thrown for 0x6000 bytes or more.

In ImmediateActionRenderResponseFilter.handle, the call response.isCommitted() returns true for "long" response but it returns false for "short" response.

Well, I tried to paste the event handler to completely different project with the same Tapestry version ...and it works.
It can be some configuration issue.

Cimlman

java.lang.IllegalStateException: Sanity check - neither a stream response nor a redirect response was generated for this action request.
	at org.apache.tapestry5.internal.services.ImmediateActionRenderResponseFilter.handle(ImmediateActionRenderResponseFilter.java:63)
	at $ComponentEventRequestHandler_132778db911c35e2.handle(Unknown Source)
	at org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
	at $ComponentEventRequestHandler_132778db911c35e2.handle(Unknown Source)
	at org.apache.tapestry5.services.TapestryModule$41.handle(TapestryModule.java:2476)
	at $ComponentEventRequestHandler_132778db911c35e2.handle(Unknown Source)
	at $ComponentEventRequestHandler_132778db911c349a.handle(Unknown Source)
	at org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handleComponentEvent(ComponentRequestHandlerTerminator.java:43)
	at org.apache.tapestry5.services.InitializeActivePageName.handleComponentEvent(InitializeActivePageName.java:39)
	at $ComponentRequestHandler_132778db911c349c.handleComponentEvent(Unknown Source)
	at $ComponentRequestHandler_132778db911c346a.handleComponentEvent(Unknown Source)
	at org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:46)
	at $Dispatcher_132778db911c346d.dispatch(Unknown Source)
	at $Dispatcher_132778db911c3467.dispatch(Unknown Source)
	at org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:302)
	at org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
	at $RequestHandler_132778db911c3468.service(Unknown Source)
	at org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:902)
	at $RequestHandler_132778db911c3468.service(Unknown Source)
	at org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:892)
	at $RequestHandler_132778db911c3468.service(Unknown Source)
	at org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
	at $RequestHandler_132778db911c3468.service(Unknown Source)
	at cz.ftm.fitsoftware.services.AppModule$1.service(AppModule.java:106)
	at $RequestFilter_132778db911c3462.service(Unknown Source)
	at $RequestHandler_132778db911c3468.service(Unknown Source)
	at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105)
	at org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95)
	at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
	at org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119)
	at $RequestHandler_132778db911c3468.service(Unknown Source)
	at $RequestHandler_132778db911c345b.service(Unknown Source)
	at org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:253)
	at org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
	at $HttpServletRequestHandler_132778db911c345d.service(Unknown Source)
	at org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
	at $HttpServletRequestFilter_132778db911c3459.service(Unknown Source)
	at $HttpServletRequestHandler_132778db911c345d.service(Unknown Source)
	at org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:852)
	at $HttpServletRequestHandler_132778db911c345d.service(Unknown Source)
	at $HttpServletRequestHandler_132778db911c3458.service(Unknown Source)
	at org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:171)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:326)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

______________________________________________________________
> Od: Thiago H de Paula Figueiredo <th...@gmail.com>
> Komu: Tapestry users <us...@tapestry.apache.org>
> Datum: 26.09.2013 14:42
> Předmět: Re: StreamResponse an EventLink
>
>On Thu, 26 Sep 2013 07:43:44 -0300, Jaroslav Ciml <ci...@centrum.cz> wrote:
>
>> Hi,
>
>Hi!
>
>> <t:eventlink event="exportToCsv">
>>     ${message:exportToCsv}
>> </t:eventlink>
>>
>> @OnEvent("exportToCsv")
>> StreamResponse exportToCsv()
>> {
>>     return new TextStreamResponse("text/plain", "Just a test!");
>> }
>
>It works for me.
>
>> If I click the event link, I get the exception
>>
>> "Sanity check - neither a stream response nor a redirect response was  
>> generated for this action request."
>
>Full stack trace or error message please.
>
>-- 
>Thiago H. de Paula Figueiredo
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: StreamResponse an EventLink

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 26 Sep 2013 07:43:44 -0300, Jaroslav Ciml <ci...@centrum.cz> wrote:

> Hi,

Hi!

> <t:eventlink event="exportToCsv">
>     ${message:exportToCsv}
> </t:eventlink>
>
> @OnEvent("exportToCsv")
> StreamResponse exportToCsv()
> {
>     return new TextStreamResponse("text/plain", "Just a test!");
> }

It works for me.

> If I click the event link, I get the exception
>
> "Sanity check - neither a stream response nor a redirect response was  
> generated for this action request."

Full stack trace or error message please.

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org