OpenSAML / Spring security setup so redeploy on Tomcat works - java

We're running a webapp on OpenJDK IcedTea6 1.13.6 using Tomcat 6.0.35. For SSO we're using the Spring security SAML extension, which bases on OpenSAML 2.6.1.
When re-deploying our application (without restarting Tomcat), I get a
NoClassDefFoundError: org/bouncycastle/crypto/paddings/ISO10126d2Padding
which is very nicely described here. From an Eclipse MAT analysis, I gather that either BouncyCastleProvider or JCERSAPublicKey are preventing the WebappClassLoaderfrom being gc'ed.
How do I configure SAML so that all (bouncy castle) instances are properly destroyed? I have a hard time believing that SAML is designed such that a deployment mandates a Tomcat restart.
My current configuration:
...
<bean id="samlLogger" class="org.springframework.security.saml.log.SAMLDefaultLogger">
<property name="logErrors" value="true"/>
<property name="logMessages" value="true"/>
</bean>
<bean id="keyManager" class="org.springframework.security.saml.key.JKSKeyManager">
<constructor-arg value="classpath:security/samlKeystore.jks"/>
<constructor-arg type="java.lang.String" value="mypassword"/>
<constructor-arg>
<map>
<entry key="tenzingfaces" value="keyphrase"/>
</map>
</constructor-arg>
<constructor-arg type="java.lang.String" value="tenzingfaces"/>
</bean>
<bean id="samlEntryPoint" class="org.springframework.security.saml.SAMLEntryPoint">
<property name="defaultProfileOptions">
<bean class="org.springframework.security.saml.websso.WebSSOProfileOptions">
<property name="binding" value="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
<property name="includeScoping" value="false"/>
</bean>
</property>
</bean>
<bean id="metadataDisplayFilter" class="org.springframework.security.saml.metadata.MetadataDisplayFilter"/>
<bean id="samlAuthenticationProvider" class="org.springframework.security.saml.SAMLAuthenticationProvider">
<property name="userDetails" ref="samlUserDetailService" />
<property name="forcePrincipalAsString" value="false" />
</bean>
<bean id="samlUserDetailService" class="ch.umbrella.springframework.security.SamlUserDetailsServiceImpl" />
<bean id="contextProvider" class="org.springframework.security.saml.context.SAMLContextProviderImpl"/>
<bean id="samlSuccessRedirectHandler" class="ch.umbrella.springframework.security.SsoAuthenticationSuccessHandler" >
<property name="defaultTargetUrl" value="/main.html" />
<property name="alwaysUseDefaultTargetUrl" value="false" />
<property name="credentialsExpiredUrl" value="/credentialsexpired.html" />
</bean>
<bean id="samlWebSSOProcessingFilter" class="org.springframework.security.saml.SAMLProcessingFilter">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="authenticationSuccessHandler" ref="samlSuccessRedirectHandler"/>
</bean>
<bean id="processor" class="org.springframework.security.saml.processor.SAMLProcessorImpl">
<constructor-arg>
<list>
<ref bean="redirectBinding"/>
<ref bean="postBinding"/>
</list>
</constructor-arg>
</bean>
<bean id="webSSOprofileConsumer" class="org.springframework.security.saml.websso.WebSSOProfileConsumerImpl"/>
<bean id="hokWebSSOprofileConsumer" class="org.springframework.security.saml.websso.WebSSOProfileConsumerHoKImpl"/>
<bean id="webSSOprofile" class="org.springframework.security.saml.websso.WebSSOProfileImpl"/>
<bean id="hokWebSSOProfile" class="org.springframework.security.saml.websso.WebSSOProfileConsumerHoKImpl"/>
<bean id="postBinding" class="org.springframework.security.saml.processor.HTTPPostBinding">
<constructor-arg ref="parserPool"/>
<constructor-arg ref="velocityEngine"/>
</bean>
<bean id="velocityEngine" class="org.springframework.security.saml.util.VelocityFactory" factory-method="getEngine"/>
<bean id="redirectBinding" class="org.springframework.security.saml.processor.HTTPRedirectDeflateBinding">
<constructor-arg ref="parserPool"/>
</bean>
<bean class="org.springframework.security.saml.SAMLBootstrap"/>
<bean id="parserPool" class="org.opensaml.xml.parse.StaticBasicParserPool" scope="singleton" init-method="initialize"/>
<bean id="parserPoolHolder" class="org.springframework.security.saml.parser.ParserPoolHolder" scope="singleton"/>
...
And, in a staging-specific file:
<bean id="metadata" class="org.springframework.security.saml.metadata.CachingMetadataManager">
<constructor-arg>
<list>
<bean class="org.springframework.security.saml.metadata.ExtendedMetadataDelegate" destroy-method="destroy">
<constructor-arg>
<bean class="org.opensaml.saml2.metadata.provider.ResourceBackedMetadataProvider" destroy-method="destroy">
<constructor-arg ref="timer1" />
<constructor-arg>
<bean class="org.opensaml.util.resource.ClasspathResource">
<constructor-arg value="/security/idp.xml"/>
</bean>
</constructor-arg>
<property name="parserPool" ref="parserPool"/>
</bean>
</constructor-arg>
<constructor-arg>
<bean class="org.springframework.security.saml.metadata.ExtendedMetadata">
</bean>
</constructor-arg>
</bean>
<bean class="org.springframework.security.saml.metadata.ExtendedMetadataDelegate" destroy-method="destroy">
<constructor-arg>
<bean class="org.opensaml.saml2.metadata.provider.ResourceBackedMetadataProvider" destroy-method="destroy">
<constructor-arg ref="timer2" />
<constructor-arg>
<bean class="org.opensaml.util.resource.ClasspathResource">
<constructor-arg value="/security/localhost_sp.xml"/>
</bean>
</constructor-arg>
<property name="parserPool" ref="parserPool"/>
</bean>
</constructor-arg>
<constructor-arg>
<bean class="org.springframework.security.saml.metadata.ExtendedMetadata">
<property name="local" value="true"/>
<property name="securityProfile" value="metaiop"/>
<property name="sslSecurityProfile" value="pkix"/>
<property name="signMetadata" value="true"/>
<property name="signingKey" value="tenzingfaces"/>
<property name="encryptionKey" value="tenzingfaces"/>
<property name="requireArtifactResolveSigned" value="false" />
<property name="requireLogoutRequestSigned" value="false" />
<property name="requireLogoutResponseSigned" value="false" />
<property name="idpDiscoveryEnabled" value="false" />
</bean>
</constructor-arg>
</bean>
</list>
</constructor-arg>
<property name="hostedSPName" value="https://hurricane.umbrellanet.ch/uf-test/saml/metadata" />
</bean>
Thanks
Simon

If you are bundling the bouncycastle jars in your war, then don't do that. Instead put those jars in tomcat/lib . Hopefully, that would fix it.

Related

Apache Ignite backed with my SQL failing to start in client mode when embedded with Spring Boot- Showing configuration mismatch

I started apache ignite server 2.6.0(binary distribution) with a custom configuration and a spring boot application with the similar configuration in client mode. When tried starting the spring boot application, the spring boot application is showing the error message as configuration merge. Below is the message from console
Caused by: org.apache.ignite.spi.IgniteSpiException: Conflicts during configuration merge for cache 'PersonCache' :
PERSON conflict:
keyFieldName is different: local=id, received=null
Can you let me know how to resolve this. This is working as expected when I use Spring boot embedded ignite server and Spring boot embedded client with a similar configuration
Ignite XML Configuration
<bean id="datasource"
class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
<property name="URL"
value="jdbc:mysql://localhost:3307/ignite" />
<property name="user" value="root" />
<property name="password" value="*****" />
</bean>
<bean id="gridCfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="cacheConfiguration">
<list>
<bean
class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="PersonCache" />
<property name="readThrough" value="true" />
<property name="writeThrough" value="true" />
<property name="writeBehindEnabled" value="true" />
<property name="cacheStoreFactory">
<bean
class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
<property name="dataSourceBean" value="datasource" />
<property name="dialect">
<bean
class="org.apache.ignite.cache.store.jdbc.dialect.MySQLDialect">
</bean>
</property>
<property name="types">
<list>
<bean class="org.apache.ignite.cache.store.jdbc.JdbcType">
<property name="cacheName" value="PersonCache" />
<property name="keyType" value="java.lang.Long" />
<property name="valueType"
value="pl.piomin.services.ignite.model.Person" />
<property name="databaseSchema" value="ignite" />
<property name="databaseTable" value="PERSON" />
<property name="keyFields">
<list>
<bean
class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
<constructor-arg>
<util:constant
static-field="java.sql.Types.INTEGER" />
</constructor-arg>
<constructor-arg value="id" />
<constructor-arg value="java.lang.Long" />
<constructor-arg value="id" />
</bean>
</list>
</property>
<property name="valueFields">
<list>
<bean
class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
<constructor-arg>
<util:constant
static-field="java.sql.Types.VARCHAR" />
</constructor-arg>
<constructor-arg value="first_name" />
<constructor-arg value="java.lang.String" />
<constructor-arg value="firstName" />
</bean>
<bean
class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
<constructor-arg>
<util:constant
static-field="java.sql.Types.VARCHAR" />
</constructor-arg>
<constructor-arg value="last_name" />
<constructor-arg value="java.lang.String" />
<constructor-arg value="lastName" />
</bean>
<bean
class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
<constructor-arg>
<util:constant
static-field="java.sql.Types.VARCHAR" />
</constructor-arg>
<constructor-arg value="gender" />
<constructor-arg value="java.lang.String" />
<constructor-arg value="gender" />
</bean>
<bean
class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
<constructor-arg>
<util:constant
static-field="java.sql.Types.VARCHAR" />
</constructor-arg>
<constructor-arg value="country" />
<constructor-arg value="java.lang.String" />
<constructor-arg value="country" />
</bean>
<bean
class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
<constructor-arg>
<util:constant
static-field="java.sql.Types.VARCHAR" />
</constructor-arg>
<constructor-arg value="city" />
<constructor-arg value="java.lang.String" />
<constructor-arg value="city" />
</bean>
<bean
class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
<constructor-arg>
<util:constant
static-field="java.sql.Types.VARCHAR" />
</constructor-arg>
<constructor-arg value="address" />
<constructor-arg value="java.lang.String" />
<constructor-arg value="address" />
</bean>
<bean
class="org.apache.ignite.cache.store.jdbc.JdbcTypeField">
<constructor-arg>
<util:constant
static-field="java.sql.Types.DATE" />
</constructor-arg>
<constructor-arg value="birth_date" />
<constructor-arg value="java.util.Date" />
<constructor-arg value="birthDate" />
</bean>
</list>
</property>
</bean>
</list>
</property>
</bean>
</property>
<property name="queryEntities">
<list>
<bean class="org.apache.ignite.cache.QueryEntity">
<property name="keyType" value="java.lang.Long" />
<property name="valueType"
value="pl.piomin.services.ignite.model.Person" />
<property name="keyFieldName" value="id" />
<property name="keyFields">
<list>
<value>id</value>
</list>
</property>
<property name="fields">
<map>
<entry key="id" value="java.lang.Integer" />
<entry key="firstName" value="java.lang.String" />
<entry key="lastName" value="java.lang.String" />
<entry key="gender" value="java.lang.String" />
<entry key="country" value="java.lang.String" />
<entry key="city" value="java.lang.String" />
<entry key="address" value="java.lang.String" />
<entry key="birthDate" value="java.util.Date" />
</map>
</property>
<property name="indexes">
<list>
<bean class="org.apache.ignite.cache.QueryIndex">
<constructor-arg value="id"/>
</bean>
<bean class="org.apache.ignite.cache.QueryIndex">
<constructor-arg value="firstName"/>
</bean>
<bean class="org.apache.ignite.cache.QueryIndex">
<constructor-arg value="lastName"/>
</bean>
</list>
</property>
</bean>
</list>
</property>
</bean>
</list>
</property>
<property name="peerClassLoadingEnabled" value="true"></property>
</bean>

How to clear cache using CacheConfiguration in Apache ignite

Not able to destroy the cache after some duration time using Spring CacheConfiguration in Apache Ignite.After 40 seconds cache should be cleared.
Please see the below Code.
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="myCache" />
<property name="atomicityMode" value="ATOMIC" />
<property name="backups" value="1" />
<property name="cacheMode" value="PARTITIONED"/>
<property name="expiryPolicyFactory"ref="createdExpiryPolicyForDay"/>
</bean>
<bean id="createdExpiryPolicyForDay" class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf" >
<constructor-arg type="javax.cache.expiry.Duration" ref="durationForDay"/>
<constructor-arg type="javax.cache.expiry.Duration" >
<util:constant static-field="javax.cache.expiry.Duration.FIVE_MINUTES"/>
</constructor-arg>
</bean>
<bean name="durationForDay" class="javax.cache.expiry.Duration" >
<constructor-arg name="timeUnit" value="SECONDS" />
<constructor-arg name="durationAmount" value="40"/>
</bean>
Please help us, we are stuck with this issue

Can configure and start embedded Tomcat via Spring? OK with Jetty?

Is there a way to configure and setup Embedded Tomcat in Spring? I can do so easily with Jetty 7 that I created a standalone Java application that will start Jetty as webcontainer and finally JUnit test can call the BO via HTTPInvoker.
To me, it seems I have to write code to do so by using Tomcat?
Spring xml file
<!-- Manually start server after setting parent context. (init-method="start") -->
<bean id="jettyServer"
class="org.eclipse.jetty.server.Server"
init-method="start"
destroy-method="stop">
<property name="threadPool">
<bean id="ThreadPool"
class="org.eclipse.jetty.util.thread.ExecutorThreadPool">
<constructor-arg value="0" />
<!--property name="corePoolSize" value="${jetty.server.thread.pool.core.pool.size}"/>
<property name="maximumPoolSize" value="${jetty.server.thread.pool.max.pool.size}"/-->
</bean>
</property>
<property name="connectors">
<list>
<bean id="Connector"
class="org.eclipse.jetty.server.nio.SelectChannelConnector"
p:port="${jetty.server.port}"
p:maxIdleTime="${jetty.server.max.idle.time}"
p:acceptors="${jetty.server.acceptor.num}"
p:confidentialPort="${jetty.server.ssl.port}" />
</list>
</property>
<property name="handler">
<bean class="org.eclipse.jetty.server.handler.HandlerCollection">
<property name="handlers">
<list>
<bean class="org.eclipse.jetty.servlet.ServletContextHandler">
<property name="contextPath" value="/"/>
<property name="sessionHandler">
<bean class="org.eclipse.jetty.server.session.SessionHandler"/>
</property>
<property name="resourceBase" value="."/>
<property name="servletHandler">
<bean class="org.eclipse.jetty.servlet.ServletHandler">
<property name="servlets"> <!-- servlet definition -->
<list>
<!-- default servlet -->
<bean class="org.eclipse.jetty.servlet.ServletHolder">
<property name="name" value="DefaultServlet"/>
<property name="servlet">
<bean class="org.springframework.web.servlet.DispatcherServlet"/>
</property>
<property name="initParameters">
<map>
<entry key="contextConfigLocation" value="classpath:config/DefaultServlet-servlet.xml" />
</map>
</property>
</bean>
</list>
</property>
<property name="servletMappings">
<list><!-- servlet mapping -->
<bean class="org.eclipse.jetty.servlet.ServletMapping">
<property name="pathSpecs">
<list><value>/</value></list>
</property>
<property name="servletName" value="DefaultServlet"/>
</bean>
</list>
</property>
</bean>
</property>
</bean>
<bean class="org.eclipse.jetty.server.handler.RequestLogHandler">
<property name="requestLog">
<bean class="org.eclipse.jetty.server.NCSARequestLog">
<constructor-arg value="${jetty.server.log.dir}/jetty-yyyy_mm_dd.log"/>
<property name="extended" value="false"/>
</bean>
</property>
</bean>
</list>
</property>
</bean>
</property>
</bean>
DefaultServlet-servlet.xml
<!-- This default handler takes care of each of the services enumerated below -->
<bean id="defaultHandlerMapping"
class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" />
<bean id="helloService" class="com.company.ws.bo.HelloServiceImpl"/>
<!-- SpringHTTP Service Exposure -->
<bean name="/HelloService"
class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter"
lazy-init="true">
<property name="service" ref="helloService" />
<property name="serviceInterface"
value="com.company.ws.bo.IHelloService" />
</bean>
Tomcat 7 can be used as an embedded Server. As far as I know there is no special spring support, but you don't need special spring support to start an tomcat out of an spring application.
#See:
this blog and this (german)

Spring 2.5 login not responding even with the correct username/password

I developed a login mechanism for one of my projects with Spring 2.5 , asegi security 1.0.7 and I used Tomcat 6 as my development server.When I was developing the project everything worked fine and I could successfully log-in.The problem begun when I deployed my application on the production server.From the moment I deployed the application on the production tomcat 6 I could not log-in even with the correct username and password and the most weird of all is that no exception is thrown.I just can't log -in!
here is the application-context.xml of the application:
<bean id="authedicationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
<property name="userDetailsService" ref="userDetailService"/>
</bean>
<bean id="authenticationEntryPoint" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
<property name="loginFormUrl" value="/login.htm" />
</bean>
<bean id="filterChainProxy"
class="org.acegisecurity.util.FilterChainProxy">
<property name="filterInvocationDefinitionSource">
<value>
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT
/**=authenticationProcessingFilter,exceptionTranslationFilter
</value>
</property>
</bean>
<bean id="authenticationProcessingFilter"
class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="authenticationFailureUrl" value="/error.htm" />
<property name="defaultTargetUrl" value="/admin_menu.htm" />
<property name="filterProcessesUrl" value="/j_acegi_security_check" />
</bean>
<bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter"/>
<bean id="accessDecisionManager" class="org.acegisecurity.vote.UnanimousBased">
<property name="decisionVoters">
<list>
<ref bean="roleVoter"/>
</list>
</property>
<property name="allowIfAllAbstainDecisions" value="true"/>
</bean>
<bean id="filterSecurityInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="accessDecisionManager" ref="accessDecisionManager"/>
<property name="objectDefinitionSource">
<value>
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT
/add_article.htm=ROLE_ADMIN
/add_publication.htm=ROLE_ADMIN
/admin_menu.htm=ROLE_ADMIN
</value>
</bean>
</property>
</bean>
<bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager">
<property name="providers">
<list>
<ref bean="authedicationProvider"/>
</list>
</property>
</bean>
<bean id="userDetailService" class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl">
<property name="dataSource" ref="datasource"/>
<property name="usersByUsernameQuery">
<value>
SELECT username,password,'true' AS enabled FROM Users where username=?
</value>
</property>
<property name="authoritiesByUsernameQuery">
<value>
SELECT username,role_name FROM Roles r,Users u WHERE r.user=u.id AND u.username=?
</value>
</property>
</bean>
Am I missing somthing?Any help would be really appreciated!Thank you in advance
Is this what you have <bean id="authe**d**icationProvider" in your first line of application file ?

is possible to combine: jersey + jetty + spring

I'm trying to create a webserver embedding jetty (rather than Java EE) , and map my servlets RESTfully, using jersey.
I'm using spring for dependency injection, and mapping the servlets as beans
However, when I try to make an HTTP req to the mapped servlets, i get error 500- server error, or 404, page not found.
I'm not sure if i'm doing this the right way, and I should probably be using the jetty.xml rather than this. (wondering if there's a shorcut using jetty.xml)
<bean id="contexts"
class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
</bean>
<bean id="server" class="org.mortbay.jetty.spring.Server"
init-method="start" destroy-method="stop">
<property name="threadPool">
<bean id="ThreadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<property name="minThreads" value="10" />
<property name="maxThreads" value="50" />
</bean>
</property>
<property name="connectors">
<list>
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="8080" />
</bean>
</list>
</property>
<property name="handler">
<bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<property name="handlers">
<list>
<ref bean="contexts" />
<bean class="org.eclipse.jetty.server.handler.ResourceHandler">
<property name="directoriesListed" value="true" />
<property name="welcomeFiles">
<list>
<value>index.jsp</value>
</list>
</property>
<property name="resourceBase" value="./WebContent" />
</bean>
<bean id="myServletHandler" class="org.eclipse.jetty.servlet.ServletHandler">
<property name="servlets">
<list>
<bean id="jerseyServletContainer" class="org.eclipse.jetty.servlet.ServletHolder">
<property name="name" value="jersey" />
<property name="servlet">
<bean class="com.sun.jersey.spi.container.servlet.ServletContainer" />
</property>
<property name="initParameters">
<map>
<entry key="com.sun.jersey.config.property.resourceConfigClass"
value="com.sun.jersey.api.core.PackagesResourceConfig" />
<entry key="com.sun.jersey.config.property.packages"
value="servlets" />
</map>
</property>
</bean>
</list>
</property>
<property name="servletMappings">
<list>
<bean id="jerseyMapping" class="org.eclipse.jetty.servlet.ServletMapping">
<property name="servletName" value="jersey" />
<property name="pathSpec" value="/*" />
</bean>
</list>
</property>
</bean>
</list>
</property>
</bean>
</property>
<property name="beans">
<list>
<bean id="ContextDeployer" class="org.eclipse.jetty.deploy.ContextDeployer">
<property name="contexts" ref="contexts" />
<property name="directory" value="contexts" />
<property name="scanInterval" value="5" />
</bean>
</list>
</property>
</bean>
I have one class in the servlets package: DoNothing.java
package servlets;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
#Path("/nothing")
public class doNothing
{
#GET
#Produces("text/plain")
public String returnNothing()
{
return ("test");
}
}
what in the world am I doing wrong? or should I ask what in the world am I doing right?
Thanks
I was looking for a way to use Jersey+Spring+Embedded Jetty and found this question. I tried your method and it actually works.
If you want to actually use Spring beans in your resources you can use jersey-spring:
<bean id="server" class="org.mortbay.jetty.Server" destroy-method="stop">
<property name="connectors">
<list>
<bean id="Connector" class="org.mortbay.jetty.nio.SelectChannelConnector">
<property name="port" value="8080"/>
</bean>
</list>
</property>
<property name="handlers">
<list>
<bean class="org.mortbay.jetty.servlet.Context">
<property name="contextPath" value="/"/>
<property name="sessionHandler">
<bean class="org.mortbay.jetty.servlet.SessionHandler" />
</property>
<property name="servletHandler">
<bean class="org.mortbay.jetty.servlet.ServletHandler">
<property name="servlets">
<list>
<bean class="org.mortbay.jetty.servlet.ServletHolder">
<property name="name" value="jersey" />
<property name="servlet">
<bean class="com.sun.jersey.spi.spring.container.servlet.SpringServlet" />
</property>
<property name="initParameters">
<map>
<entry key="com.sun.jersey.spi.container.ContainerRequestFilters"
value="com.sun.jersey.api.container.filter.LoggingFilter" />
<entry key="com.sun.jersey.spi.container.ContainerResponseFilters"
value="com.sun.jersey.api.container.filter.LoggingFilter" />
</map>
</property>
</bean>
</list>
</property>
<property name="servletMappings">
<list>
<bean class="org.mortbay.jetty.servlet.ServletMapping">
<property name="servletName" value="jersey"/>
<property name="pathSpecs">
<list>
<value>/*</value>
</list>
</property>
</bean>
</list>
</property>
</bean>
</property>
<property name="eventListeners">
<list>
<bean id="requestContextListener" class="org.springframework.web.context.request.RequestContextListener"/>
<bean id="contextLoaderListener" class="org.springframework.web.context.ContextLoaderListener"/>
</list>
</property>
<property name="initParams">
<map>
<entry key="contextConfigLocation" value="classpath:META-INF/AdditionalBeansContext.xml"/>
</map>
</property>
</bean><!--
--></list>
</property>
</bean>
In file AdditionalBeansContext.xml:
Then define your Resources with: #Component annotation, injected beans with #Autowired

Categories

Resources