How to define Filters in Manifest
Hi All,
I am trying to migrate web appplication to a Web Bundle in web application I am using Spring 3.0 Rest.
My Web.xml file looks like
lt;?xml version=quot;1.0quot; encoding=quot;ISO-8859-1quot; standalone=quot;noquot;?gt;
lt;web-app xmlns=quot;xml/ns/j2eequot; xmlns:xsi=quot;2001/XMLSchema-instancequot; version=quot;2.4quot; xsi:schemaLocation=quot;xml/ns/j2ee xml/ns/j2ee/web-app_2_4.xsdquot;gt;
lt;display-namegt;SpringFinanceManagerlt;/display-namegt;
lt;descriptiongt;Spring Finance Manager applicationlt;/descriptiongt;
lt;!-- Comment out if using JBoss --gt;
lt;listenergt;
lt;listener-classgt;org..web.util.Log4jConfigList enerlt;/listener-classgt;
lt;/listenergt;
lt;!-- required to enable Spring 3.0 REST support --gt;
lt;filtergt;
lt;filter-namegt;fromMethodFilterlt;/filter-namegt;
lt;filter-classgt;org..web.filter.HiddenfromMet hodFilterlt;/filter-classgt;
lt;/filtergt;
lt;filter-mappinggt;
lt;filter-namegt;fromMethodFilterlt;/filter-namegt;
lt;ucl-patterngt;/hello/*lt;/ucl-patterngt;
lt;/filter-mappinggt;lt;session-configgt;
lt;session-timeoutgt;10lt;/session-timeoutgt;
lt;/session-configgt;
lt;welcome-file-listgt;
lt;welcome-filegt;index.jsplt;/welcome-filegt;
lt;/welcome-file-listgt;
lt;error-pagegt;
lt;exception-typegt;java.lang.Exceptionlt;/exception-typegt;
lt;locationgt;/WEB-INF/jsp/uncaughtException.jsplt;/locationgt;
lt;/error-pagegt;
lt;/web-appgt;
I want to define filters to the manifest file
lt;!-- required to enable Spring 3.0 REST support --gt;
lt;filtergt;
lt;filter-namegt;fromMethodFilterlt;/filter-namegt;
lt;filter-classgt;org..web.filter.HiddenfromMet hodFilterlt;/filter-classgt;
lt;/filtergt;
lt;filter-mappinggt;
lt;filter-namegt;fromMethodFilterlt;/filter-namegt;
lt;ucl-patterngt;/hello/*lt;/ucl-patterngt;
lt;/filter-mappinggt;
Can any one help me in this.Thank you
I think you've posted into the wrong place (this is Spring DM forum). Do you want me to move your post to dm Server General or Web forum?
Thank you for your suggetion. You can move it.
No problem - but where exactly? Web or dm Server? Are you using dm Server (OSGi) or not?
My Requirements are,
I am working on Spring dmServer(OSGI), to develop a Bundle which should expose a RESTfull service using SpringFramework 3.0. for this I want to define some filters (as we did did in web.xml for web application) in Manifest.mf/module-context.xml.
OKay - I'm moving the thread to the dm Server area then.
We've actually come to realise that the Web-* manifest headers aren't as useful as we hoped they would be, especially as they only allow you to configure a subset of what can be configured in web.xml. Filters are one of the things that can't be configured in the manifest.
Our recommended approach it so use web.xml for configuration in preference to the manifest headers, so just define your filters in your web.xml as you would in a standard WAR file.
Hi Andy Wilkinson,
Even I tried to use the web.xml as it is ,that I used in standard web, but my application is unable to reading web.xml. because I dont have imported xml/ns/j2ee libraries in my bundle. Even I tried to download the theese libraries when I clicked on dependency section Download option.
As long as you have
Code:
Module-Type: Webspecified in your manifest, and your web.xml file in MODULE-INF/WEB-INF, this should just work.
Can you post some more information about your failure?
I declred Module-Type as Web only. But at the time of starting server Spring Dm is not able to find the lt;filter-typegt; that I have in web.xml is unable to find its correspomding name space(xml/ns/j2ee). Even I am unable to download this using Download/Add in dependecy section of Manifest
any way my Manifest file looks
Manifest-Version: 1.0
Bundle-Version: 1.0.0
Bundle-Name: RestBundle Bundle
Bundle-ManifestVersion: 2
Bundle-SymbolicName: RestBundle
Module-Type: Web
Import-Library: org..spring;version=quot;[3.0.0.CI-217,3.0.0.CI-217]quot;
Web-ContextPath: hello
Web-DispatcherServletuclPatterns: *.html
Web-FilterMappings: fromMethodFilter;ucl-patterns:=quot;/*quot;
and web.xml file looks like
lt;?xml version=quot;1.0quot; encoding=quot;ISO-8859-1quot; standalone=quot;noquot;?gt;
lt;web-app xmlns=quot;xml/ns/j2eequot; xmlns:xsi=quot;2001/XMLSchema-instancequot; version=quot;2.4quot; xsi:schemaLocation=quot;xml/ns/j2ee xml/ns/j2ee/web-app_2_4.xsdquot;gt;
lt;display-namegt;SpringFinanceManagerlt;/display-namegt;
lt;descriptiongt;Spring Finance Manager applicationlt;/descriptiongt;lt;context-paramgt;
lt;param-namegt;log4jConfigLocationlt;/param-namegt;
lt;param-valuegt;log4j.propertieslt;/param-valuegt;
lt;/context-paramgt;lt;!-- Comment out if using JBoss --gt;
lt;listenergt;
lt;listener-classgt;org..web.util.Log4jConfigList enerlt;/listener-classgt;
lt;/listenergt;
lt;servletgt;
lt;servlet-namegt;HelloWorldlt;/servlet-namegt;
lt;servlet-classgt;org..web.servlet.DispatcherSe rvletlt;/servlet-classgt;
lt;load-on-startupgt;2lt;/load-on-startupgt;
lt;/servletgt;
lt;servlet-mappinggt;
lt;servlet-namegt;HelloWorldlt;/servlet-namegt;
lt;ucl-patterngt;/lt;/ucl-patterngt;
lt;/servlet-mappinggt;lt;!-- required to enable Spring 3.0 REST support --gt;
lt;filtergt;
lt;filter-namegt;fromMethodFilterlt;/filter-namegt;
lt;filter-classgt;org..web.filter.HiddenfromMet hodFilterlt;/filter-classgt;
lt;/filtergt;
lt;filter-mappinggt;
lt;filter-namegt;fromMethodFilterlt;/filter-namegt;
lt;servlet-namegt;HelloWorldlt;/servlet-namegt;
lt;/filter-mappinggt;
lt;session-configgt;
lt;session-timeoutgt;10lt;/session-timeoutgt;
lt;/session-configgt;
lt;welcome-file-listgt;
lt;welcome-filegt;index.jsplt;/welcome-filegt;
lt;/welcome-file-listgt;
lt;error-pagegt;
lt;exception-typegt;java.lang.Exceptionlt;/exception-typegt;
lt;locationgt;/WEB-INF/jsp/uncaughtException.jsplt;/locationgt;
lt;/error-pagegt;
lt;/web-appgt; |