Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: How to define Filters in Manifest

  1. #1
    Join Date
    May 2009
    Location
    Hyderabad, India
    Posts
    106

    Default 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
    <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>SpringFinanceManager</display-name>
    <description>Spring Finance Manager application</description>

    <!-- Comment out if using JBoss -->
    <listener>
    <listener-class>org.springframework.web.util.Log4jConfigList ener</listener-class>
    </listener>

    <!-- required to enable Spring 3.0 REST support -->
    <filter>
    <filter-name>httpMethodFilter</filter-name>
    <filter-class>org.springframework.web.filter.HiddenHttpMet hodFilter</filter-class>
    </filter>

    <filter-mapping>
    <filter-name>httpMethodFilter</filter-name>
    <url-pattern>/hello/*</url-pattern>
    </filter-mapping>


    <session-config>
    <session-timeout>10</session-timeout>
    </session-config>

    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/WEB-INF/jsp/uncaughtException.jsp</location>
    </error-page>
    </web-app>

    I want to define filters to the manifest file

    <!-- required to enable Spring 3.0 REST support -->
    <filter>
    <filter-name>httpMethodFilter</filter-name>
    <filter-class>org.springframework.web.filter.HiddenHttpMet hodFilter</filter-class>
    </filter>

    <filter-mapping>
    <filter-name>httpMethodFilter</filter-name>
    <url-pattern>/hello/*</url-pattern>
    </filter-mapping>




    Can any one help me in this.


    Thank you

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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?
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    May 2009
    Location
    Hyderabad, India
    Posts
    106

    Default

    Thank you for your suggetion. You can move it.

  4. #4
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    No problem - but where exactly? Web or dm Server? Are you using dm Server (OSGi) or not?
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  5. #5
    Join Date
    May 2009
    Location
    Hyderabad, India
    Posts
    106

    Default

    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.

  6. #6
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    OKay - I'm moving the thread to the dm Server area then.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  7. #7
    Join Date
    Oct 2008
    Posts
    493

    Default

    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.
    Andy Wilkinson
    SpringSource

  8. #8
    Join Date
    May 2009
    Location
    Hyderabad, India
    Posts
    106

    Default

    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 http://java.sun.com/xml/ns/j2ee libraries in my bundle. Even I tried to download the theese libraries when I clicked on dependency section Download option.

  9. #9
    Join Date
    Oct 2008
    Posts
    493

    Default

    As long as you have
    Code:
    Module-Type: Web
    specified 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?
    Andy Wilkinson
    SpringSource

  10. #10
    Join Date
    May 2009
    Location
    Hyderabad, India
    Posts
    106

    Default

    I declred Module-Type as Web only. But at the time of starting server Spring Dm is not able to find the <filter-type> that I have in web.xml is unable to find its correspomding name space(http://java.sun.com/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.springframework.spring;version="[3.0.0.CI-217,3.0.0.CI-217]"
    Web-ContextPath: hello
    Web-DispatcherServletUrlPatterns: *.html
    Web-FilterMappings: httpMethodFilter;url-patterns:="/*"

    and web.xml file looks like
    <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>SpringFinanceManager</display-name>
    <description>Spring Finance Manager application</description>


    <context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>log4j.properties</param-value>
    </context-param>


    <!-- Comment out if using JBoss -->
    <listener>
    <listener-class>org.springframework.web.util.Log4jConfigList ener</listener-class>
    </listener>

    <servlet>
    <servlet-name>HelloWorld</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>HelloWorld</servlet-name>
    <url-pattern>/</url-pattern>
    </servlet-mapping>


    <!-- required to enable Spring 3.0 REST support -->
    <filter>
    <filter-name>httpMethodFilter</filter-name>
    <filter-class>org.springframework.web.filter.HiddenHttpMet hodFilter</filter-class>
    </filter>

    <filter-mapping>
    <filter-name>httpMethodFilter</filter-name>
    <servlet-name>HelloWorld</servlet-name>
    </filter-mapping>


    <session-config>
    <session-timeout>10</session-timeout>
    </session-config>

    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/WEB-INF/jsp/uncaughtException.jsp</location>
    </error-page>
    </web-app>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •