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/10/16 12:01:13 UTC
Re: StreamResponse an EventLink
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