You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Ritesh.S" <ri...@avibha.com> on 2007/12/04 11:18:32 UTC

T5: problem in web.xml

Hello everybody,

I am new to tapestry and I am using Tapestry core 5.0.5.
I integrated Tapestry 5 with spring and hibernate.

I configured my application's web.xml as below -

<-spring-app configuration is here->

<!-- Tapestry 5 context and filters -->
        <context-param>
                <param-name>tapestry.app-package</param-name>
                <param-value>com.myproject</param-value>
        </context-param>
       
<- some other filters here ->
       
        <filter>
            <filter-name>tapestryFilter</filter-name>
           
<filter-class>org.apache.tapestry.spring.TapestrySpringFilter</filter-class>
        </filter>

        <filter-mapping>
                        <filter-name>tapestryFilter</filter-name>
                        <url-pattern>/*</url-pattern>
        </filter-mapping>

        <listener>
               
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>

<- hibernate listener->

This works perfect with all Tapestry related pages.
At certain operation in my application when a file is uploaded from jsp page
by using
servlet it generates output with .htm which fires a Tapestry Page not found
exception.
I doesn't understand why?

I tried to change <url-pattern> to - /package/* , this solves my problem of
uploading and
all tapestry action requests are successfully handled but all Tapestry pages
are displayed
with   -  [Error] - like icons in front of every Tapestry component on that
page.
I doesn't understand why?

Can anybody tell me why this is happening. I am trying solution for this
from last 2-3 days.
Any help is appreciated. :)

Thanks in advance. ;)

From,
Ritesh S. 
-- 
View this message in context: http://www.nabble.com/T5%3A-%3Curl-pattern%3E-problem-in-web.xml-tf4942242.html#a14147967
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: problem in web.xml

Posted by Chris Lewis <ch...@bellsouth.net>.
Post a link to the JIRA if you create one. I think it's a good idea to 
allow the container to handle requests not handled by T5, but should be 
configurable and probably NOT the default. Perhaps web.xml would be the 
appropriate place to toggle this behavior.

Ritesh.S wrote:
> Hello Davor,
>
> Thanks for your help. I will try to implement the custom filter you
> suggested. 
>
> Also I will post a JIRA if necessary.
>
> Thanks once again...
>
> From,
> Ritesh S.
>
>
>
> Davor Hrg wrote:
>   
>> this is just a workaround,
>>
>> you should post a JIRA about this problem,
>> there's been some talk about tapestry letting container deal with paths
>> that tapestry can not resolve ... so this may be fixed in current trunk...
>>
>>
>> here's something that might work, and
>> save you headaches before an official solution
>>
>> add this to your pom
>>
>>        <dependency>
>>           <groupId>javax.servlet</groupId>
>>           <artifactId>servlet-api</artifactId>
>>           <version>2.4</version>
>>           <scope>provided</scope>
>>         </dependency>
>>
>>
>> change web.xml
>>
>>               <filter-class>mypackage.CustomFilter</filter-class>
>>               <!--filter-class>org.apache.tapestry.TapestryFilter
>> </filter-class-->
>>
>>
>> make this simple class that delegates most requests to tapestry filters
>>
>>
>> package mypackage;
>>
>> import java.io.IOException;
>> import java.util.Enumeration;
>>
>> import javax.servlet.Filter;
>> import javax.servlet.FilterChain;
>> import javax.servlet.FilterConfig;
>> import javax.servlet.ServletException;
>> import javax.servlet.ServletRequest;
>> import javax.servlet.ServletResponse;
>> import javax.servlet.http.HttpServletRequest;
>>
>> import org.apache.tapestry.TapestryFilter;
>>
>> public class CustomFilter implements Filter{
>>     TapestryFilter _delegate=new TapestryFilter();
>>
>>     public void destroy() {
>>         _delegate.destroy();
>>     }
>>
>>     public void doFilter(ServletRequest request, ServletResponse response,
>> FilterChain chain) throws IOException, ServletException {
>>         HttpServletRequest req = (HttpServletRequest) request;
>>         String uri = req.getRequestURI();
>>         String contextPath = req.getContextPath();
>>         //dont know if this is needed
>>         //if(uri.startsWith(contextPath))
>>             uri = uri.substring(contextPath.length());
>>         if(uri.startsWith("/myignorepath")) chain.doFilter(request,
>> response);
>>         else
>>             _delegate.doFilter(request, response, chain);
>>     }
>>
>>     public void init(FilterConfig filterConfig) throws ServletException {
>>         _delegate.init(filterConfig);
>>     }
>>
>> }
>>
>> modify the doFilter method to skip problematic paths
>>
>>
>>
>> Davor Hrg
>>
>>
>>     
>
>   


Re: T5: problem in web.xml

Posted by "Ritesh.S" <ri...@avibha.com>.
Hello Davor,

Thanks for your help. I will try to implement the custom filter you
suggested. 

Also I will post a JIRA if necessary.

Thanks once again...

From,
Ritesh S.



Davor Hrg wrote:
> 
> this is just a workaround,
> 
> you should post a JIRA about this problem,
> there's been some talk about tapestry letting container deal with paths
> that tapestry can not resolve ... so this may be fixed in current trunk...
> 
> 
> here's something that might work, and
> save you headaches before an official solution
> 
> add this to your pom
> 
>        <dependency>
>           <groupId>javax.servlet</groupId>
>           <artifactId>servlet-api</artifactId>
>           <version>2.4</version>
>           <scope>provided</scope>
>         </dependency>
> 
> 
> change web.xml
> 
>               <filter-class>mypackage.CustomFilter</filter-class>
>               <!--filter-class>org.apache.tapestry.TapestryFilter
> </filter-class-->
> 
> 
> make this simple class that delegates most requests to tapestry filters
> 
> 
> package mypackage;
> 
> import java.io.IOException;
> import java.util.Enumeration;
> 
> import javax.servlet.Filter;
> import javax.servlet.FilterChain;
> import javax.servlet.FilterConfig;
> import javax.servlet.ServletException;
> import javax.servlet.ServletRequest;
> import javax.servlet.ServletResponse;
> import javax.servlet.http.HttpServletRequest;
> 
> import org.apache.tapestry.TapestryFilter;
> 
> public class CustomFilter implements Filter{
>     TapestryFilter _delegate=new TapestryFilter();
> 
>     public void destroy() {
>         _delegate.destroy();
>     }
> 
>     public void doFilter(ServletRequest request, ServletResponse response,
> FilterChain chain) throws IOException, ServletException {
>         HttpServletRequest req = (HttpServletRequest) request;
>         String uri = req.getRequestURI();
>         String contextPath = req.getContextPath();
>         //dont know if this is needed
>         //if(uri.startsWith(contextPath))
>             uri = uri.substring(contextPath.length());
>         if(uri.startsWith("/myignorepath")) chain.doFilter(request,
> response);
>         else
>             _delegate.doFilter(request, response, chain);
>     }
> 
>     public void init(FilterConfig filterConfig) throws ServletException {
>         _delegate.init(filterConfig);
>     }
> 
> }
> 
> modify the doFilter method to skip problematic paths
> 
> 
> 
> Davor Hrg
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-%3Curl-pattern%3E-problem-in-web.xml-tf4942242.html#a14150834
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: problem in web.xml

Posted by Davor Hrg <hr...@gmail.com>.
this is just a workaround,

you should post a JIRA about this problem,
there's been some talk about tapestry letting container deal with paths
that tapestry can not resolve ... so this may be fixed in current trunk...


here's something that might work, and
save you headaches before an official solution

add this to your pom

       <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
          <version>2.4</version>
          <scope>provided</scope>
        </dependency>


change web.xml

              <filter-class>mypackage.CustomFilter</filter-class>
              <!--filter-class>org.apache.tapestry.TapestryFilter
</filter-class-->


make this simple class that delegates most requests to tapestry filters


package mypackage;

import java.io.IOException;
import java.util.Enumeration;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import org.apache.tapestry.TapestryFilter;

public class CustomFilter implements Filter{
    TapestryFilter _delegate=new TapestryFilter();

    public void destroy() {
        _delegate.destroy();
    }

    public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
        HttpServletRequest req = (HttpServletRequest) request;
        String uri = req.getRequestURI();
        String contextPath = req.getContextPath();
        //dont know if this is needed
        //if(uri.startsWith(contextPath))
            uri = uri.substring(contextPath.length());
        if(uri.startsWith("/myignorepath")) chain.doFilter(request,
response);
        else
            _delegate.doFilter(request, response, chain);
    }

    public void init(FilterConfig filterConfig) throws ServletException {
        _delegate.init(filterConfig);
    }

}

modify the doFilter method to skip problematic paths



Davor Hrg

On Dec 4, 2007 12:44 PM, Ritesh.S <ri...@avibha.com> wrote:

>
>
> Hello Davor,
> Thanks for your reply. I am giving stack trace below and problematic url.
>
> Following is the stack trace I get when I try to upload a file through the
> servlet
> which produces the .htm file and shows in url.
>
> This occures when use <url-pattern>/*<url-pattern>
>
> An unexpected application exception has occurred.
>
>    * java.lang.IllegalArgumentException
>      Unable to resolve page 'document/DocumentUpload' to a known page
> name.
> Available page names: core/ExceptionReport, core/PropertyDisplayBlocks,
> core/PropertyEditBlocks, resource/AssignmentSummary, resource/Business,
> resource/Dashboard, resource/GenericSelectModel,
> resource/ManageResourcesList, resource/Personal, resource/Projects,
> resource/Remaining, resource/Select, resource/SelectResource_V8_5,
> resource/TaskAssignmentDetail, resource/ViewDetails,
> resource/ViewDetails_V8_5, resource/ViewSummary.
>
>      Stack trace
>              o
> org.apache.tapestry.internal.services.ComponentClassResolverImpl$8.invoke(
> ComponentClassResolverImpl.java:393)
>              o
> org.apache.tapestry.internal.services.ComponentClassResolverImpl$8.invoke(
> ComponentClassResolverImpl.java:388)
>              o
> org.apache.tapestry.ioc.internal.util.ConcurrentBarrier.withRead(
> ConcurrentBarrier.java:77)
>              o
>
> org.apache.tapestry.internal.services.ComponentClassResolverImpl.canonicalizePageName
> (ComponentClassResolverImpl.java:386)
>              o
> org.apache.tapestry.internal.services.PagePoolImpl.checkout(
> PagePoolImpl.java:59)
>              o
> org.apache.tapestry.internal.services.RequestPageCacheImpl.get(
> RequestPageCacheImpl.java:44)
>              o
>
> org.apache.tapestry.internal.services.RequestEncodingInitializerImpl.initializeRequestEncoding
> (RequestEncodingInitializerImpl.java:42)
>              o
> org.apache.tapestry.internal.services.InternalModule$11.handle(
> InternalModule.java:539)
>              o
> org.apache.tapestry.internal.services.ComponentActionDispatcher.dispatch(
> ComponentActionDispatcher.java:116)
>              o
> org.apache.tapestry.services.TapestryModule$12.service(TapestryModule.java
> :1066)
>              o
> org.apache.tapestry.internal.services.LocalizationFilter.service(
> LocalizationFilter.java:43)
>              o
> org.apache.tapestry.services.TapestryModule$2.service(TapestryModule.java
> :657)
>              o
> org.apache.tapestry.internal.services.StaticFilesFilter.service(
> StaticFilesFilter.java:63)
>              o
> org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(
> CheckForUpdatesFilter.java:97)
>              o
> org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(
> CheckForUpdatesFilter.java:88)
>              o
> org.apache.tapestry.ioc.internal.util.ConcurrentBarrier.withRead(
> ConcurrentBarrier.java:77)
>              o
> org.apache.tapestry.internal.services.CheckForUpdatesFilter.service(
> CheckForUpdatesFilter.java:110)
>              o
> org.apache.tapestry.services.TapestryModule$11.service(TapestryModule.java
> :1044)
>              o
> org.apache.tapestry.TapestryFilter.doFilter(TapestryFilter.java:135)
>              o
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:215)
>              o
> org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:188)
>              o
> net.project.security.SessionAccessFilter.doFilter(SessionAccessFilter.java
> :79)
>              o
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:215)
>              o
> org.apache.catalina.core.ApplicationFilterChain.doFilter(
> ApplicationFilterChain.java:188)
>              o
> org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java:210)
>              o
> org.apache.catalina.core.StandardContextValve.invoke(
> StandardContextValve.java:174)
>              o
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :127)
>              o
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :117)
>              o
> org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:108)
>              o
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
> :151)
>              o
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
>              o
>
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
> (Http11BaseProtocol.java:665)
>              o
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
> PoolTcpEndpoint.java:528)
>              o
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
> LeaderFollowerWorkerThread.java:81)
>              o
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:685)
>              o java.lang.Thread.run(Unknown Source)
>
> But when I use <url-pattern>/package/*</url-pattern> the file uploading
> dont
> show any exception
> and Tapestry pages also executes well but with -[Error]- in front of every
> tapestry component
> Actually -[Error]- is alt text for error image of tapestry which gets
> displayed on validation error.
> But I don't know why it gets activated in this situation.
>
> If anyone can tell why this is happening it will be very helpful to me. :>
>
> Thanks in advance.. :)
>
> Davor Hrg wrote:
> >
> > could you post stack trace,
> > and problematic url ?
> >
> > Davor Hrg
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-%3Curl-pattern%3E-problem-in-web.xml-tf4942242.html#a14149099
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5: problem in web.xml

Posted by "Ritesh.S" <ri...@avibha.com>.

Hello Davor,
Thanks for your reply. I am giving stack trace below and problematic url.

Following is the stack trace I get when I try to upload a file through the
servlet
which produces the .htm file and shows in url.

This occures when use <url-pattern>/*<url-pattern>

An unexpected application exception has occurred.

    * java.lang.IllegalArgumentException
      Unable to resolve page 'document/DocumentUpload' to a known page name.
Available page names: core/ExceptionReport, core/PropertyDisplayBlocks,
core/PropertyEditBlocks, resource/AssignmentSummary, resource/Business,
resource/Dashboard, resource/GenericSelectModel,
resource/ManageResourcesList, resource/Personal, resource/Projects,
resource/Remaining, resource/Select, resource/SelectResource_V8_5,
resource/TaskAssignmentDetail, resource/ViewDetails,
resource/ViewDetails_V8_5, resource/ViewSummary.

      Stack trace
              o
org.apache.tapestry.internal.services.ComponentClassResolverImpl$8.invoke(ComponentClassResolverImpl.java:393)
              o
org.apache.tapestry.internal.services.ComponentClassResolverImpl$8.invoke(ComponentClassResolverImpl.java:388)
              o
org.apache.tapestry.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:77)
              o
org.apache.tapestry.internal.services.ComponentClassResolverImpl.canonicalizePageName(ComponentClassResolverImpl.java:386)
              o
org.apache.tapestry.internal.services.PagePoolImpl.checkout(PagePoolImpl.java:59)
              o
org.apache.tapestry.internal.services.RequestPageCacheImpl.get(RequestPageCacheImpl.java:44)
              o
org.apache.tapestry.internal.services.RequestEncodingInitializerImpl.initializeRequestEncoding(RequestEncodingInitializerImpl.java:42)
              o
org.apache.tapestry.internal.services.InternalModule$11.handle(InternalModule.java:539)
              o
org.apache.tapestry.internal.services.ComponentActionDispatcher.dispatch(ComponentActionDispatcher.java:116)
              o
org.apache.tapestry.services.TapestryModule$12.service(TapestryModule.java:1066)
              o
org.apache.tapestry.internal.services.LocalizationFilter.service(LocalizationFilter.java:43)
              o
org.apache.tapestry.services.TapestryModule$2.service(TapestryModule.java:657)
              o
org.apache.tapestry.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:63)
              o
org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:97)
              o
org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:88)
              o
org.apache.tapestry.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:77)
              o
org.apache.tapestry.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:110)
              o
org.apache.tapestry.services.TapestryModule$11.service(TapestryModule.java:1044)
              o
org.apache.tapestry.TapestryFilter.doFilter(TapestryFilter.java:135)
              o
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
              o
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
              o
net.project.security.SessionAccessFilter.doFilter(SessionAccessFilter.java:79)
              o
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
              o
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
              o
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
              o
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
              o
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              o
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
              o
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
              o
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
              o
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
              o
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
              o
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
              o
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
              o
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
              o java.lang.Thread.run(Unknown Source)

But when I use <url-pattern>/package/*</url-pattern> the file uploading dont
show any exception
and Tapestry pages also executes well but with -[Error]- in front of every
tapestry component
Actually -[Error]- is alt text for error image of tapestry which gets
displayed on validation error.
But I don't know why it gets activated in this situation.

If anyone can tell why this is happening it will be very helpful to me. :>

Thanks in advance.. :)

Davor Hrg wrote:
> 
> could you post stack trace,
> and problematic url ?
> 
> Davor Hrg
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-%3Curl-pattern%3E-problem-in-web.xml-tf4942242.html#a14149099
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: problem in web.xml

Posted by Davor Hrg <hr...@gmail.com>.
could you post stack trace,
and problematic url ?

Davor Hrg

On Dec 4, 2007 11:18 AM, Ritesh.S <ri...@avibha.com> wrote:

>
> Hello everybody,
>
> I am new to tapestry and I am using Tapestry core 5.0.5.
> I integrated Tapestry 5 with spring and hibernate.
>
> I configured my application's web.xml as below -
>
> <-spring-app configuration is here->
>
> <!-- Tapestry 5 context and filters -->
>        <context-param>
>                <param-name>tapestry.app-package</param-name>
>                <param-value>com.myproject</param-value>
>        </context-param>
>
> <- some other filters here ->
>
>        <filter>
>            <filter-name>tapestryFilter</filter-name>
>
> <filter-class>org.apache.tapestry.spring.TapestrySpringFilter
> </filter-class>
>        </filter>
>
>        <filter-mapping>
>                        <filter-name>tapestryFilter</filter-name>
>                        <url-pattern>/*</url-pattern>
>        </filter-mapping>
>
>        <listener>
>
> <listener-class>org.springframework.web.context.ContextLoaderListener
> </listener-class>
>        </listener>
>
> <- hibernate listener->
>
> This works perfect with all Tapestry related pages.
> At certain operation in my application when a file is uploaded from jsp
> page
> by using
> servlet it generates output with .htm which fires a Tapestry Page not
> found
> exception.
> I doesn't understand why?
>
> I tried to change <url-pattern> to - /package/* , this solves my problem
> of
> uploading and
> all tapestry action requests are successfully handled but all Tapestry
> pages
> are displayed
> with   -  [Error] - like icons in front of every Tapestry component on
> that
> page.
> I doesn't understand why?
>
> Can anybody tell me why this is happening. I am trying solution for this
> from last 2-3 days.
> Any help is appreciated. :)
>
> Thanks in advance. ;)
>
> From,
> Ritesh S.
> --
> View this message in context:
> http://www.nabble.com/T5%3A-%3Curl-pattern%3E-problem-in-web.xml-tf4942242.html#a14147967
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>