0

JBoss AS 7.1 +Spring+ZK+DHtmlLayoutServlet

asked 2013-10-22 15:19:47 +0800

moyacuba gravatar image moyacuba
6

Hi

I'm trying to run my webapp that uses spring+zk in JBoss AS 7.1, previously I did succeed to run the application in Tomcat, but in JBoss AS 7.1 it is behaving differently.

In this web app, I did extend the DHtmlLayoutServlet to add some features, hooking the request , etc.

public class DHtmlLayoutServletWrapper extends DHtmlLayoutServlet {
...
    @Override
    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        super.doGet(new HttpServletRequestWrapper(request), response);
    }
...
}

then my web.xml file reference the extended class for the zkLoader servlet:

...
  <servlet>
    <description>El cargador de paginas ZUML</description>
    <servlet-name>zkLoader</servlet-name>
    <servlet-class>foopckg.DHtmlLayoutServletWrapper</servlet-class>
    <init-param>
      <param-name>update-uri</param-name>
      <param-value>/zkau</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
...

this works pretty well in Tomcat, the filter chain loads the Wrapper class for zul files, but in JBoss AS 7.1, the parent class is the one loaded, it is evidenced in the stacktrace:

at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:215) [zk-6.5.3.jar:6.5.3]
at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:136) [zk-6.5.3.jar:6.5.3]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-3.1.4.RELEASE.jar:3.1.4.RELEASE]

My questions...

1- Where should I change the servlet configuration so the WebAppContext loads my servlet wrapper instead the default DHtmlLayoutServlet for zul files?

2- If my definition is to load the DHtmlLayoutServletWrapper class... how is it possible that DHtmlLayoutServlet is being called instead?

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-10-24 02:12:40 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2013-10-24 02:21:13 +0800

Hi,

in case you are using the Servlet 3.0 specification the ZK servlets are loaded from the zk.jar/META-INF/web-fragment.xml in there the servlet is defined like this

<servlet>
    <servlet-name>DHtmlLayoutServlet</servlet-name>
    <servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>
    <init-param>
        <param-name>update-uri</param-name>
        <param-value>/zkau</param-value>
    </init-param>

    <load-on-startup>1</load-on-startup>
</servlet>

in order to override this servlet you need to use the name "DHtmlLayoutServlet"

This is just a guess... but could be an explanation of what is happening in your case.

Robert

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-10-22 15:19:47 +0800

Seen: 24 times

Last updated: Oct 24 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More