Source Code Cross Referenced for XINSServletContext.java in  » Web-Services » xins » org » xins » common » servlet » container » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Services » xins » org.xins.common.servlet.container 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: XINSServletContext.java,v 1.23 2007/09/18 08:45:09 agoubard Exp $
003:         *
004:         * Copyright 2003-2007 Orange Nederland Breedband B.V.
005:         * See the COPYRIGHT file for redistribution and use restrictions.
006:         */
007:        package org.xins.common.servlet.container;
008:
009:        import java.io.IOException;
010:        import java.io.InputStream;
011:        import java.net.MalformedURLException;
012:        import java.net.URL;
013:        import java.util.Enumeration;
014:        import java.util.Set;
015:        import java.util.jar.JarEntry;
016:        import java.util.jar.JarFile;
017:        import javax.servlet.RequestDispatcher;
018:        import javax.servlet.Servlet;
019:        import javax.servlet.ServletContext;
020:
021:        import org.xins.common.Log;
022:        import org.xins.common.Utils;
023:
024:        /**
025:         * This class is an implementation of the ServletContext that can be
026:         * called locally.
027:         *
028:         * @version $Revision: 1.23 $ $Date: 2007/09/18 08:45:09 $
029:         * @author <a href="mailto:anthony.goubard@japplis.com">Anthony Goubard</a>
030:         */
031:        public class XINSServletContext implements  ServletContext {
032:
033:            /**
034:             * The configuration of the servlet.
035:             */
036:            private LocalServletConfig _config;
037:
038:            /**
039:             * The root URL for the servlet.
040:             */
041:            private String _rootURL;
042:
043:            /**
044:             * Creates a new <code>XINSServletContext</code> instance.
045:             */
046:            public XINSServletContext() {
047:                // empty
048:            }
049:
050:            /**
051:             * Creates a new <code>XINSServletContext</code> with the specified
052:             * configuration.
053:             *
054:             * @param config
055:             *    the config of the servlet, can be <code>null</code>.
056:             */
057:            XINSServletContext(LocalServletConfig config) {
058:                _config = config;
059:                if (Utils.getJavaVersion() < 1.4) {
060:                    try {
061:                        _rootURL = "jar:"
062:                                + config.getWarFile().toURL().toString() + "!";
063:                    } catch (MalformedURLException muex) {
064:                        Log.log_1513(config.getWarFile().toString());
065:                    }
066:                } else {
067:                    _rootURL = "jar:" + config.getWarFile().toURI().toString()
068:                            + "!";
069:                }
070:            }
071:
072:            public void removeAttribute(String str) {
073:                throw new UnsupportedOperationException();
074:            }
075:
076:            public Servlet getServlet(String str) {
077:                throw new UnsupportedOperationException();
078:            }
079:
080:            public Set getResourcePaths(String str) {
081:                throw new UnsupportedOperationException();
082:            }
083:
084:            public Object getAttribute(String str) {
085:                throw new UnsupportedOperationException();
086:            }
087:
088:            public ServletContext getContext(String str) {
089:                throw new UnsupportedOperationException();
090:            }
091:
092:            public String getInitParameter(String str) {
093:                throw new UnsupportedOperationException();
094:            }
095:
096:            public String getMimeType(String str) {
097:                throw new UnsupportedOperationException();
098:            }
099:
100:            public RequestDispatcher getNamedDispatcher(String str) {
101:                throw new UnsupportedOperationException();
102:            }
103:
104:            public String getRealPath(String str) {
105:
106:                // The WAR file is not unpacked
107:                return null;
108:            }
109:
110:            public RequestDispatcher getRequestDispatcher(String str) {
111:                throw new UnsupportedOperationException();
112:            }
113:
114:            public URL getResource(String str) {
115:                if (!str.startsWith("/")) {
116:                    str = "/" + str;
117:                }
118:                try {
119:                    return new URL(_rootURL + str);
120:                } catch (MalformedURLException muex) {
121:                    Log.log_1513(_rootURL + str);
122:                    return null;
123:                }
124:            }
125:
126:            public InputStream getResourceAsStream(String str) {
127:                try {
128:                    JarFile warFile = new JarFile(_config.getWarFile());
129:                    JarEntry entry = warFile.getJarEntry(str);
130:                    if (entry == null) {
131:                        Log.log_1514(str, "No entry.");
132:                        return null;
133:                    } else {
134:                        return warFile.getInputStream(entry);
135:                    }
136:                } catch (IOException ioe) {
137:                    Log.log_1514(str, ioe.getMessage());
138:                    return null;
139:                }
140:            }
141:
142:            public void log(Exception exception, String msg) {
143:                log(msg, exception);
144:            }
145:
146:            public void log(String msg) {
147:                Log.log_1510(msg);
148:            }
149:
150:            public void log(String msg, Throwable throwable) {
151:                Log.log_1511(throwable, msg);
152:            }
153:
154:            public void setAttribute(String str, Object obj) {
155:                throw new UnsupportedOperationException();
156:            }
157:
158:            public Enumeration getServlets() {
159:                throw new UnsupportedOperationException();
160:            }
161:
162:            public Enumeration getServletNames() {
163:                throw new UnsupportedOperationException();
164:            }
165:
166:            public String getServletContextName() {
167:                throw new UnsupportedOperationException();
168:            }
169:
170:            public String getServerInfo() {
171:                String osName = System.getProperty("os.name");
172:                String osVersion = System.getProperty("os.version");
173:                String osArch = System.getProperty("os.arch");
174:                String os = osName + " " + osVersion + "/" + osArch;
175:                return "XINS Servlet Test Container (" + os + ')';
176:            }
177:
178:            public Enumeration getAttributeNames() {
179:                throw new UnsupportedOperationException();
180:            }
181:
182:            public Enumeration getInitParameterNames() {
183:                throw new UnsupportedOperationException();
184:            }
185:
186:            public int getMajorVersion() {
187:                return 2;
188:            }
189:
190:            public int getMinorVersion() {
191:                return 3;
192:            }
193:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.