Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Setting Filter in Embedded Jetty With Spring

Hi,

I want to setup a filter in an embedded Jetty 7 using Spring 3 IoC. I got the server up and running but it can't find the context I have specified i.e. root '/'.

Please advise.

Thanks

<?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:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

  
    <bean id="server" class="org.eclipse.jetty.server.Server"
          init-method="start" destroy-method="stop">

        <property name="connectors">
            <list>
                <bean id="Connector" class="org.eclipse.jetty.server.bio.SocketConnector">
                    <property name="port" value="8080"/>
                    <property name="maxIdleTime" value="3600000"/>
                    <property name="soLingerTime" value="-1"/>              
                </bean>
            </list>
        </property>

        <property name="handler">
            <bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
                <property name="handlers">
                    <list>
                        <bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
                            <property name="handlers">
                                <list>
                                 
                                    <bean class="org.eclipse.jetty.servlet.ServletContextHandler">
                                        <property name="contextPath">
                                            <value>/</value>
                                        </property>

                                        <property name="sessionHandler">
                                            <bean class="org.eclipse.jetty.server.session.SessionHandler" />
                                        </property>

                                        <property name="servletHandler">
                                            <bean class="org.eclipse.jetty.servlet.ServletHandler">

                                                <!-- Filter definition -->
                                                <property name="filters">
                                                    <list>
                                                        <bean class="org.eclipse.jetty.servlet.FilterHolder">
                                                            <property name="name" value="user.management"/>
                                                            <property name="filter">
                                                                <bean class="org.apache.wicket.protocol.http.WicketFilter"/>
                                                            </property>
                                                            <property name="initParameters">
                                                                <map>
                                                                    <entry key="applicationClassName"
                                                                           value="org.thlim.MyWicketApplication"/>
                                                                    <entry key="filterMappingUrlPattern"
                                                                           value="/*"/>
                                                                </map>
                                                            </property>
                                                        </bean>
                                                    </list>
                                                </property>

                                                <property name="filterMappings">
                                                    <list>
                                                        <bean class="org.eclipse.jetty.servlet.FilterMapping">
                                                            <property name="pathSpec">
                                                                <value>/*</value>
                                                            </property>
                                                            <property name="filterName" value="user.management"/>
                                                        </bean>
                                                    </list>
                                                </property>
                                            </bean>
                                        </property>
                                    </bean>                              
                                </list>
                            </property>
                        </bean>
                    </list>
                </property>
            </bean>
        </property>
    </bean>
</beans>


Back to the top