KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > web > app > servlet > ModeDetectionFilter


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.web.app.servlet;
18
19 import java.io.IOException JavaDoc;
20
21 import javax.servlet.Filter JavaDoc;
22 import javax.servlet.FilterChain JavaDoc;
23 import javax.servlet.FilterConfig JavaDoc;
24 import javax.servlet.ServletException JavaDoc;
25 import javax.servlet.ServletRequest JavaDoc;
26 import javax.servlet.ServletResponse JavaDoc;
27
28 import org.alfresco.web.app.Application;
29
30
31 /**
32  * Filter that determines whether the application is running inside a portal
33  * server or servlet engine. The fact that this filter gets called means
34  * the application is running inside a servlet engine.
35  *
36  * @author gavinc
37  */

38 public class ModeDetectionFilter implements Filter JavaDoc
39 {
40    /**
41     * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
42     */

43    public void init(FilterConfig JavaDoc config) throws ServletException JavaDoc
44    {
45       // nothing to do
46
}
47
48    /**
49     * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
50     */

51    public void doFilter(ServletRequest JavaDoc req, ServletResponse JavaDoc res, FilterChain JavaDoc chain)
52          throws IOException JavaDoc, ServletException JavaDoc
53    {
54       // as we get here means we are inside a servlet engine as portal servers
55
// do not support the calling of filters yet
56
Application.setInPortalServer(false);
57       
58       // continue filter chaining
59
chain.doFilter(req, res);
60    }
61
62    /**
63     * @see javax.servlet.Filter#destroy()
64     */

65    public void destroy()
66    {
67       // nothing to do
68
}
69 }
70
Popular Tags