KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > server > servlet > ServletContextLoader


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.server.servlet;
10
11 import org.jboss.portal.common.util.Loader;
12
13 import javax.servlet.ServletContext JavaDoc;
14 import java.io.InputStream JavaDoc;
15
16 /**
17  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
18  * @version $Revision: 1.1 $
19  */

20 public class ServletContextLoader implements Loader
21 {
22
23    private final ServletContext JavaDoc ctx;
24
25    public ServletContextLoader(ServletContext JavaDoc ctx)
26    {
27       if (ctx == null)
28       {
29          throw new IllegalArgumentException JavaDoc("ServletContext cannot be null");
30       }
31       this.ctx = ctx;
32    }
33
34    public InputStream JavaDoc load(String JavaDoc name)
35    {
36       return ctx.getResourceAsStream(name);
37    }
38 }
39
Popular Tags