Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

More Java Pitfalls Share Reactor - Daconta M,C.

Daconta M,C. More Java Pitfalls Share Reactor - Wiley publishing, 2003. - 476 p.
ISBN: 0-471-23751-5
Download (direct link): morejavapitfallssharereactor2003.pdf
Previous << 1 .. 106 107 108 109 110 111 < 112 > 113 114 115 116 117 118 .. 166 >> Next

011
012 <!--
013 Filters are new to the Servlet 2.3 Specification.
014
015 This declares the clickstreamFilter, which is an instance of the 2
com opensymphone.clickstream.ClickstreamFilter class.
016 This class should be located in the CLASSPATH, but the most common 2
place to put it is in the WEB-INF/classes or WEB-INF/lib
017 directories.
018
019 Clickstream tracks all accesses to the site. See 2
http://opensymphony.com for more details.
021 -- >
022
023 <filter>
024 <filter-name>clickstreamFilter</filter-name>
025 <filter- 2
class>com.opensymphony.clickstream.ClickstreamFilter</filter-class>
026 </filter>
027
028 <!--
030 The filter-mapping applies the filter to all requests that match 2
the url-pattern.
032 -->
033
034 <filter-mapping>
035 <filter-name>clickstreamFilter</filter-name>
036 <url-pattern>*.jsp</url-pattern>
Listing 35.6 Web Application Deployment Descriptor (web.xml)
Reading Files from Servlets 309
037 </filter-mapping>
038
039 <filter-mapping>
040 <filter-name>clickstreamFilter</filter-name>
041 <url-pattern>*.html</url-pattern>
042 </filter-mapping>
043
044 <!--
046 The servlet listener is new to Servlet 2.3 also. It also is up 2
to the developer to define a listener to monitor lifecycle events
047
048 In this case, the ClickstreamListener waits for an HTTPSession to
terminate, and then logs the HTTP Session information.
050 -- >
051
052 <listener>
053 <listener- 2
class>com.opensymphony.clickstream.ClickstreamListener</listener- class>
054 </listener>
055
056
057 <!--
059 This declares the XYZServlet, which is in a class by the same name 2
By convention, it usually is in the WEB-INF/classes
060 directory or in a jar in the WEB-INF/lib directory
062 -- >
063
064
065 <servlet>
066 <servlet-name>XYZServlet</servlet-name>
067 <servlet-class>XYZServlet</servlet-class>
068 </servlet>
069
070
071 <!--
073 This servlet mapping dictates that all urls that end in *.xyz will 2
be handled by the XYZServlet.
075 -- >
076
077 <servlet-mapping>
078 <servlet-name>
079 XYZServlet
080 </servlet-name>
081 <url-pattern>
082 /*.xyz
083 </url-pattern>
084 </servlet-mapping>
085
086 <!--
Listing 35.6 (continued)
310 Item 35
088 These files are the files that are loaded (in the listed order) if ^
they exist when the webapp is
089 called without a file specified (e.g. /examples/ )
091 -- >
092
093 <welcome-file-list>
094 <welcome-file>home.jsp</welcome-file>
095 <welcome-file>index.jsp</welcome-file>
096 <welcome-file>index.html</welcome-file>
097 </welcome-file-list>
098
099 <!--
101 These are the tag library definitions. The taglib-uri gives a ^
unique identifier.
102 The taglib-location gives the location of the taglib's tag library ^
definition.
103
104 These taglibs are the Jakarta IO, XTags, and DBTags all very good ^
libraries from
105 http://jakarta.apache.org/taglibs.
106
107 The last one is from opensymphony.com, the oscache tag library, ^
which is an outstanding
108 tag library for caching web documents.
110 -->
111
112
113 <taglib>
114 <taglib-uri>http://jakarta.apache.org/taglibs/io- ^
1.0</taglib-uri>
115 <taglib-location>/WEB-INF/taglibdefs/io.tld</taglib-location>
116 </taglib>
117
118 <taglib>
119 <taglib-uri>http://jakarta.apache.org/taglibs/xtags- ^
1.0</taglib-uri>
120 <taglib-location>/WEB-INF/lib/xtags.tld</taglib-location>
121 </taglib>
122
123 <taglib>
124 <taglib- ^
uri>http://jakarta.apache.org/taglibs/dbtags</taglib-uri>
125 <taglib-location>/WEB-INF/lib/dbtags.tld</taglib-location>
126 </taglib>
127
128 <taglib>
129 <taglib-uri>oscache</taglib-uri>
130 <taglib-location>/WEB-INF/lib/oscache.tld</taglib-^
location>
Listing 35.6 (continued)
Reading Files from Servlets 311
131 </taglib>
132
133 <!--
135 This defines a resource reference that is available to the web 2
application.
136
137 It should be noted that it doesn't make the resource, just 2
declares the reference.
138
139 In Tomcat, you would still need to declare the resource factory in 2
the server.xml.
141 -- >
142
143 <resource-ref>
144
145 <description>
147 Resource reference to a javax.sql.DataSource
149 </description>
151 <res-ref-name>
153 jdbc/myDB
155 </res-ref-name>
157 <res-type>
159 j avax.sql.DataSource
161 </res-type>
163 <res-auth>
165 Container
167 </res-auth>
169 </resource-ref>
172 <!--
174 This declares a security constraint on the web application. First 2
there is definition of the collection,
175 in this case the JSP that flushes the cache, and the auth- 2
constraint defines the user and/or roles that
176 this constraint applies to. In this case, the role "hero" is able 2
to access this source.
177
Previous << 1 .. 106 107 108 109 110 111 < 112 > 113 114 115 116 117 118 .. 166 >> Next