loknath
loknath

Reputation: 1372

Execution flow of web application?

Below is the web.xml file of my web application .i need a favor that how my web application gets started what will be step by step flows.

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="
        http://java.sun.com/xml/ns/j2ee
        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
     version="2.4">

<display-name>Tudu Lists</display-name>

<context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>WEB-INF/log4j.xml</param-value>
</context-param>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:META-INF/spring/application-context.xml</param-value>
</context-param>

<!-- Define the basename for a resource bundle for I18N -->
<context-param>
    <param-name>
        javax.servlet.jsp.jstl.fmt.localizationContext
    </param-name>
    <param-value>messages</param-value>
</context-param>

<listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>

<listener>
    <listener-class>net.sf.navigator.menu.MenuContextListener</listener-class>
</listener>

<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>dispatcher</servlet-name>
    <url-pattern>/tudu/*</url-pattern>
</servlet-mapping>

<servlet>
    <servlet-name>dwr</servlet-name>
    <servlet-class>org.directwebremoting.spring.DwrSpringServlet</servlet-class>
    <init-param>
        <param-name>debug</param-name>
        <param-value>true</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>dwr</servlet-name>
    <url-pattern>/ajax/*</url-pattern>
</servlet-mapping>

<servlet>
    <servlet-name>rss</servlet-name>
    <servlet-class>tudu.web.servlet.RssFeedServlet</servlet-class>
    <load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>rss</servlet-name>
    <url-pattern>/servlet/rss</url-pattern>
</servlet-mapping>

<servlet>
    <servlet-name>backup</servlet-name>
    <servlet-class>tudu.web.servlet.BackupServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>backup</servlet-name>
    <url-pattern>/servlet/tudu_lists_backup.xml</url-pattern>
</servlet-mapping>

<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/tudu/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/ajax/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/servlet/*</url-pattern>
</filter-mapping>

<filter>
    <filter-name>Open Session In View Filter</filter-name>
    <filter-class>
        org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
    </filter-class>
</filter>
<filter-mapping>
    <filter-name>Open Session In View Filter</filter-name>
    <url-pattern>/ajax/*</url-pattern>
</filter-mapping>

<filter>
    <filter-name>encodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
    </init-param>
    <init-param>
        <param-name>forceEncoding</param-name>
        <param-value>true</param-value>
    </init-param>
</filter>
<filter-mapping>
    <filter-name>encodingFilter</filter-name>
    <url-pattern>/tudu/*</url-pattern>
</filter-mapping>

<filter>
    <filter-name>GZipFilter</filter-name>
    <filter-class>net.sf.ehcache.constructs.web.filter.GzipFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>GZipFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<filter>
    <filter-name>SimpleCachingHeadersPageCachingFilter</filter-name>
    <filter-class>net.sf.ehcache.constructs.web.filter.SimpleCachingHeadersPageCachingFilter
    </filter-class>
    <init-param>
        <param-name>suppressStackTraces</param-name>
        <param-value>false</param-value>
    </init-param>
    <init-param>
        <param-name>cacheName</param-name>
        <param-value>web-cache</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>SimpleCachingHeadersPageCachingFilter</filter-name>
    <url-pattern>/rss</url-pattern>
</filter-mapping>

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/tudu/500</location>
</error-page>
<error-page>
    <error-code>404</error-code>
    <location>/tudu/404</location>
</error-page>

</web-app>

Upvotes: 1

Views: 5224

Answers (1)

Shishir Kumar
Shishir Kumar

Reputation: 8201

Flow of any web application is mainly based on the order of servlets, listeners defined in web.xml.

To understand the flow of Spring application, have a look at Practical Use of Spring Web Flow

Practical Use of Spring Web Flow

Above image is part of Spring documentation and illustrates the execution of Spring's basic Sellitem example. (Secion 6.3 of http://docs.spring.io/spring-webflow/docs/1.0.x/reference/practical.html)

Also, refer to this answer: https://stackoverflow.com/a/5837354/2867032

Shishir

Upvotes: 5

Related Questions