WebServer.java

00001 /*
00002  * OpenMobileIS - a free Java(TM) Framework for mobile applications Java(TM)
00003  * Copyright (C) 2004-2006 Philippe Delrieu
00004  * All rights reserved.
00005  * Contact: pdelrieu@openmobileis.org
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00020  * USA
00021  *
00022  *  Author : Philippe Delrieu
00023  *
00024  *  Modifications :
00025  *  2004 Creation P.Delrieu
00026  *  2004 Modified by Romain Beaugrand
00027  *
00028  */
00029 
00030 package org.openmobileis.embedded.webserver;
00031 
00032 import java.io.DataInputStream;
00033 import java.io.File;
00034 import java.io.FileInputStream;
00035 import java.io.IOException;
00036 import java.io.InputStream;
00037 import java.net.MalformedURLException;
00038 import java.net.ServerSocket;
00039 import java.net.Socket;
00040 import java.net.URL;
00041 import java.util.Enumeration;
00042 import java.util.Hashtable;
00043 import java.util.Properties;
00044 import java.util.StringTokenizer;
00045 import java.util.Vector;
00046 
00047 import javax.servlet.RequestDispatcher;
00048 import javax.servlet.Servlet;
00049 import javax.servlet.ServletContext;
00050 import javax.servlet.ServletException;
00051 import javax.servlet.ServletRequest;
00052 import javax.servlet.ServletResponse;
00053 
00054 import org.openmobileis.common.context.SessionContextManager;
00055 import org.openmobileis.common.util.PropertiesManager;
00056 import org.openmobileis.common.util.file.FileUtilities;
00057 import org.openmobileis.common.util.log.LogManager;
00058 import org.openmobileis.common.util.log.LogServices;
00059 
00060 public class WebServer implements ServletContext, RequestDispatcher {
00061 
00062         private final static int DEFAULT_PORT = 8080;
00063 
00064         private ServerThreadPool connexionPool;
00065 
00066         protected PathTreeDictionary registry;
00067 
00068         // loaded servlets : ClassName -> servlet instance
00069         private Hashtable servlets = new Hashtable();
00070 
00071         private Hashtable attributes;
00072 
00073         boolean running = true;
00074 
00075         private ServerSocket serverSocket;
00076 
00077         protected String hostName;
00078 
00079         protected int port = DEFAULT_PORT;
00080 
00081         private static Properties webserverProps;
00082 
00083         // path for properties
00084         public static String servletFile = "";
00085 
00086         public static String installPath = "";
00087 
00089 
00090         public WebServer() {
00091                 this(System.getProperty("user.dir"));
00092         }
00093 
00094         public WebServer(String pathToConfFile) {
00095                 System.setProperty("user.dir", pathToConfFile);
00096         System.out.println("Webserver const userdir:"+pathToConfFile);
00097                 try {
00098                         if (pathToConfFile != null) {
00099                                 try {
00100                                         //load jar properties
00101                                         webserverProps = PropertiesManager.getManager().getPropertiesFromPath("/WEB-INF/conf/properties/webserver.properties");
00102                                 } catch (Throwable ex) {
00103                                         //not found load from files.
00104                                         webserverProps = PropertiesManager.getManager().getPropertiesFromPath(
00105                                                         pathToConfFile + File.separator + "WEB-INF" + File.separator + "conf" + java.io.File.separator + "properties" + java.io.File.separator
00106                                                                         + "webserver.properties");
00107                                 }
00108                         } else {
00109                                 webserverProps = PropertiesManager.getManager().getPropertiesFromPath("properties" + java.io.File.separator + "webserver.properties");
00110                         }
00111 
00112                 } catch (Exception ex) {
00113                         ex.printStackTrace();
00114                         System.out.println("Unable to find webserver.properties !!\nexit(1)");
00115                         System.exit(1);
00116                 }
00117                 String strPort = webserverProps.getProperty("port");
00118                 if (strPort != null && strPort.length() > 0) {
00119                         try {
00120                                 this.port = Integer.parseInt(strPort);
00121                         } catch (NumberFormatException ex) {
00122                                 this.port = DEFAULT_PORT;
00123                         }
00124                 }
00125 
00126                 WebServer.installPath = webserverProps.getProperty("installPath");
00127                 servletFile = webserverProps.getProperty("servletFile");
00128                 registry = new PathTreeDictionary();
00129                 try {
00130                         connexionPool = new ServerThreadPool();
00131                 } catch (Exception ex) {
00132                         LogManager.traceError(LogServices.WEBSERVICE, "can not initialise server connexion pool");
00133                         LogManager.traceError(0, ex);
00134                 }
00135                 attributes = new Hashtable();
00136 
00137                 //init one session management
00138                 //the webserver can only manage one session.
00139                 SessionContextManager.getManager().createSessionContext("OPENMOBILEISSESSION");
00140                 SessionContextManager.getManager().joinSessionContext("OPENMOBILEISSESSION");
00141         }
00142 
00143         public void stopServer()        {
00144                 try     {
00145                         serverSocket.close();
00146                         connexionPool.freeResources();
00147                         connexionPool = null;
00148                 } catch (Throwable ex)  {
00149                         LogManager.traceError(0, ex);
00150                 }
00151         }
00152 
00154         // pattern, which can contain wildcards, and the class name of the Servlet
00155         // to launch when a matching URL comes in.  Patterns are checked for
00156         // matches in the order they were added, and only the first match is run.
00157         public void addServlet(String urlPat, String className) {
00158                 addServlet(urlPat, className, (Hashtable) null);
00159         }
00160 
00161         public void addServlet(String urlPat, String className, Hashtable initParams) {
00162                 // Check if we're allowed to make one of these.
00163                 SecurityManager security = System.getSecurityManager();
00164                 if (security != null) {
00165                         int i = className.lastIndexOf('.');
00166                         if (i != -1) {
00167                                 security.checkPackageAccess(className.substring(0, i));
00168                                 security.checkPackageDefinition(className.substring(0, i));
00169                         }
00170                 }
00171 
00172                 // Make a new one.
00173                 try {
00174                         addServlet(urlPat, (Servlet) Class.forName(className).newInstance(), initParams);
00175                         return;
00176                 } catch (ClassNotFoundException e) {
00177                         LogManager.traceError(0, e);
00178                         LogManager.traceError(LogServices.WEBSERVICE, "Class not found: " + className);
00179                 } catch (ClassCastException e) {
00180                         LogManager.traceError(0, e);
00181                         LogManager.traceError(LogServices.WEBSERVICE, "Class cast problem: " + e.getMessage());
00182                 } catch (InstantiationException e) {
00183                         LogManager.traceError(0, e);
00184                         LogManager.traceError(LogServices.WEBSERVICE, "Instantiation problem: " + e.getMessage());
00185                 } catch (IllegalAccessException e) {
00186                         LogManager.traceError(0, e);
00187                         LogManager.traceError(LogServices.WEBSERVICE, "Illegal class access: " + e.getMessage());
00188                 } catch (Exception e) {
00189                         LogManager.traceError(0, e);
00190                         LogManager.traceError(LogServices.WEBSERVICE, "Unexpected problem creating servlet: " + e);
00191                         LogManager.traceError(LogServices.WEBSERVICE, e);
00192                 }
00193         }
00194 
00196         // which can contain wildcards, and the Servlet to
00197         // launch when a matching URL comes in.  Patterns are checked for
00198         // matches in the order they were added, and only the first match is run.
00199         public void addServlet(String urlPat, Servlet servlet) {
00200                 addServlet(urlPat, servlet, (Hashtable) null);
00201         }
00202 
00203         public void addServlet(String urlPat, Servlet servlet, Hashtable initParams) {
00204                 try {
00205                         servlet.init(new ServeConfig((ServletContext) this, initParams, urlPat));
00206                         registry.put(urlPat, servlet);
00207                         servlets.put(servlet.getClass().getName(), urlPat);
00208                 } catch (ServletException e) {
00209                         LogManager.traceError(0, e);
00210                         LogManager.traceError(LogServices.WEBSERVICE, "Problem initializing servlet: " + e);
00211                 }
00212         }
00213 
00214         public Object[] getServletByURLorClassName(String name) {
00215                 Object[] servlet = new Object[2];
00216                 servlet = registry.get(name);
00217                 if (servlet[0] == null) {
00218                         String servletUri = (String) servlets.get(name);
00219                         if (servletUri != null && servletUri.trim().length() > 0) {
00220                                 servlet = registry.get(servletUri);
00221                         }
00222                 }
00223                 if (servlet[0] == null) {
00224                         String newName = name;
00225                         int index = newName.lastIndexOf('/');
00226                         while (index != -1) {
00227                                 newName = newName.substring(0, index);
00228                                 servlet = registry.get(newName);
00229                                 if (servlet[0] != null) {
00230                                         break;
00231                                 }
00232                                 index = newName.lastIndexOf('/');
00233                         }
00234                 }
00235                 return servlet;
00236         }
00237 
00238         // Run the server.  Returns only on errors.
00239         public void serve() throws IOException {
00240 
00241                 // First of all, instantiate the LogManager to the console
00242                 if (LogManager.getInstance() == null) {
00243                         LogManager.registerLogManager(null);
00244                 }
00245 
00246                 System.out.println("Webserver server servletFile" + servletFile);
00247                 this.readServlets(servletFile);
00248                 serverSocket = new ServerSocket(port, 1000);
00249         //      hostName = serverSocket.getInetAddress().getHostName();
00250 
00251                 // start Web Browser
00252 /*              try {
00253                         Plateform plateform = ApplicationContextManager.getManager().getApplicationContext().getPlateform();
00254                         if (plateform.getOS().equals(Plateform.POCKETPCOS)) {
00255 
00256                                 if ((PropertiesManager.getManager().getProperty("org.openmobileis.embedded.execprog.browser") != null)
00257                                                 && (PropertiesManager.getManager().getProperty("org.openmobileis.embedded.execprog.browser.args") != null)) {
00258                                         System.loadLibrary("systemAPI");
00259                                         LogManager.traceInfo(0, "Start Pocket IE");
00260                                         SystemAPI.execProgram(PropertiesManager.getManager().getProperty("org.openmobileis.embedded.execprog.browser"), PropertiesManager.getManager()
00261                                                         .getProperty("org.openmobileis.embedded.execprog.browser.args")
00262                                                         + "/" + Long.toString(System.currentTimeMillis())); //add long to avoid IE cache
00263                                 } else {
00264 
00265                                         System.loadLibrary("systemAPI");
00266                                         String path = "\\Windows\\iexplore.exe";
00267                                         if (plateform.getOSVersion().substring(0, 1).equals("4")) { // OK for windows pocketPC 2003
00268                                                 LogManager.traceInfo(0, "Start Pocket IE 2003, OSVersion : " + plateform.getOSVersion());
00269                                                 SystemAPI.execProgram(path, "http://127.0.0.1:9090/services/index" + "/" + Long.toString(System.currentTimeMillis())); //add long to avoid IE cache
00270 
00271                                         } else if (plateform.getOSVersion().substring(0, 1).equals("5")) { // OK for windows CE 2005
00272                                                 LogManager.traceInfo(0, "Start Pocket IE 2005, OSVersion : " + plateform.getOSVersion());
00273                                                 SystemAPI.execProgram(path, "http://localhost:9090/services/index" + "/" + Long.toString(System.currentTimeMillis())); //add long to avoid IE cache
00274                                         } else {
00275                                                 LogManager.traceInfo(0, "Pocket IE not started on PocketPC no properties defined. OS Version : " + plateform.getOSVersion());
00276                                         }
00277 
00278                                 }
00279                         }
00280                 } catch (Throwable e) {
00281                         LogManager.traceError(0, e);
00282                         LogManager.traceError(LogServices.WEBSERVICE, "Can not launch ie with parameters : " + PropertiesManager.getManager().getProperty("execprog.browser")
00283                                         + " args : " + PropertiesManager.getManager().getProperty("execprog.browser.args"));
00284                 } */
00285    boolean firstError = false;
00286                 try { // accept request from clients
00287                         while (true) {
00288                                 try     {
00289                                         Socket socket = serverSocket.accept();
00290                                         firstError = false;
00291                                         connexionPool.runServerConnexion(this, socket);
00292                                 } catch (Throwable e) {
00293                                         //if an error occurs try to restart the connexion one time.
00294                                         LogManager.traceError(0, e);
00295                                         serverSocket.close();
00296                                         if (!firstError) serverSocket = new ServerSocket(port, 1000);
00297                                         else    throw new IOException(); //exit
00298                                         firstError = true;
00299                           }
00300                         } // end while
00301                 } finally {
00302                         try {
00303                                 LogManager.traceError(LogServices.WEBSERVICE, "Web server connexion stopped ");
00304                                 serverSocket.close();
00305                                 System.exit(1);
00306                         } catch (Exception e) {
00307                                 LogManager.traceError(LogServices.WEBSERVICE, e);
00308                         }
00309                 }
00310         }
00311 
00313         public void destroyAllServlets() {
00314                 Enumeration en = registry.elements();
00315                 while (en.hasMoreElements()) {
00316                         Servlet servlet = (Servlet) en.nextElement();
00317                         servlet.destroy();
00318                 }
00319                 registry = new PathTreeDictionary();
00320                 // invalidate all sessions?
00321         }
00322 
00323         /*
00324          * free all resources
00325          */
00326         public void freeResources() throws Exception {
00327                 this.destroyAllServlets();
00328                 connexionPool.freeResources();
00329                 serverSocket.close();
00330                 LogManager.traceInfo(LogServices.WEBSERVICE, "Web server is stopped");
00331                 //System.exit(0);
00332         }
00333 
00334         private void readServlets(String cfgfile) {
00339                 Hashtable servletstbl, parameterstbl;
00340                 servletstbl = new Hashtable();
00341                 parameterstbl = new Hashtable();
00342                 if (cfgfile != null) {
00343                         File file = new File(cfgfile);
00344                         try {
00345                                 DataInputStream in = null;
00346                                 if (file.exists() && file.canRead()) {
00347                                         in = new DataInputStream(new FileInputStream(file));
00348                                 } else {
00349                                         in = new DataInputStream(PropertiesManager.getManager().getRessourceAsStream(cfgfile));
00350                                 }
00354                                 do {
00355                                         String servletdsc = in.readLine();
00356                                         if (servletdsc == null)
00357                                                 break;
00358                                         StringTokenizer dsctokenzr = new StringTokenizer(servletdsc, ".=,", false);
00359                                         if (dsctokenzr.hasMoreTokens()) {
00360                                                 if (!dsctokenzr.nextToken().equalsIgnoreCase("servlet")) {
00361                                                         System.err.println("No leading 'servlet' keyword, the sentence is skipped");
00362                                                         break;
00363                                                 }
00364                                                 if (dsctokenzr.hasMoreTokens()) {
00365                                                         String servletname = dsctokenzr.nextToken();
00366 
00367                                                         if (dsctokenzr.hasMoreTokens()) {
00368                                                                 String lt = dsctokenzr.nextToken();
00369                                                                 if (lt.equalsIgnoreCase("code")) {
00370                                                                         if (dsctokenzr.hasMoreTokens())
00371                                                                                 servletstbl.put(servletname, dsctokenzr.nextToken("="));
00372                                                                 } else if (lt.equalsIgnoreCase("initArgs")) {
00373                                                                         Hashtable initparams = new Hashtable();
00374                                                                         while (dsctokenzr.hasMoreTokens()) {
00375                                                                                 String key = dsctokenzr.nextToken("=,");
00376                                                                                 if (dsctokenzr.hasMoreTokens())
00377                                                                                         initparams.put(key, dsctokenzr.nextToken(",="));
00378                                                                         }
00379                                                                         parameterstbl.put(servletname, initparams);
00380                                                                 } else
00381                                                                         System.err.println("Unrecognized token " + lt + " in " + servletdsc + ", the line's skipped");
00382                                                         }
00383                                                 }
00384                                         }
00385                                 } while (true);
00386                                 Enumeration se = servletstbl.keys();
00387                                 String servletname;
00388                                 while (se.hasMoreElements()) {
00389                                         servletname = (String) se.nextElement();
00390                                         addServlet(servletname, (String) servletstbl.get(servletname), (Hashtable) parameterstbl.get(servletname));
00391                                 }
00392                         } catch (IOException e) {
00393                                 System.err.println("Problem reading cfg file: " + e);
00394                         }
00395 
00396                 }
00397         }
00398 
00399 
00400         // ServletContext METHODS
00401         // ***************************************************************************************************************
00403         // null if the attribute does not exist.  This method allows access to
00404         // additional information about the service, not already provided by
00405         // the other methods in this interface.
00406         public Object getAttribute(String name) {
00407                 // This server does not support attributes.
00408                 return attributes.get(name);
00409         }
00410 
00411         public Enumeration getAttributeNames() {
00412                 return attributes.keys();
00413         }
00414 
00415         public ServletContext getContext(String uripath) {
00416                 return this; // only root context supported
00417         }
00418 
00419         // no way to specify parameters for context
00420         public String getInitParameter(String param) {
00421                 return null;
00422         }
00423 
00424         public Enumeration getInitParameterNames() {
00425                 return null;
00426         }
00427 
00428         public int getMajorVersion() {
00429                 return 2; // support 2.x
00430         }
00431 
00433         // @param file file name whose MIME type is required
00434         public String getMimeType(String file) {
00435                 file = file.toUpperCase();
00436 
00437                 if (file.endsWith(".HTML") || file.endsWith(".HTM"))
00438                         return "text/html";
00439                 if (file.endsWith(".TXT"))
00440                         return "text/plain";
00441                 if (file.endsWith(".XML"))
00442                         return "text/xml";
00443                 if (file.endsWith(".CSS"))
00444                         return "text/css";
00445                 if (file.endsWith(".SGML") || file.endsWith(".SGM"))
00446                         return "text/x-sgml";
00447                 // Image
00448                 if (file.endsWith(".GIF"))
00449                         return "image/gif";
00450                 if (file.endsWith(".JPG") || file.endsWith(".JPEG") || file.endsWith(".JPE"))
00451                         return "image/jpeg";
00452                 if (file.endsWith(".PNG"))
00453                         return "image/png";
00454                 if (file.endsWith(".TIF") || file.endsWith(".TIFF"))
00455                         return "image/tiff";
00456                 if (file.endsWith(".RGB"))
00457                         return "image/x-rgb";
00458                 if (file.endsWith(".XPM"))
00459                         return "image/x-xpixmap";
00460                 if (file.endsWith(".XBM"))
00461                         return "image/x-xbitmap";
00462                 if (file.endsWith(".SVG"))
00463                         return "image/svg-xml ";
00464                 if (file.endsWith(".SVGZ"))
00465                         return "image/svg-xml ";
00466                 // Audio
00467                 if (file.endsWith(".AU") || file.endsWith(".SND"))
00468                         return "audio/basic";
00469                 if (file.endsWith(".MID") || file.endsWith(".MIDI") || file.endsWith(".RMI") || file.endsWith(".KAR"))
00470                         return "audio/mid";
00471                 if (file.endsWith(".MPGA") || file.endsWith(".MP2") || file.endsWith(".MP3"))
00472                         return "audio/mpeg";
00473                 if (file.endsWith(".WAV"))
00474                         return "audio/wav";
00475                 if (file.endsWith(".AIFF") || file.endsWith(".AIFC"))
00476                         return "audio/aiff";
00477                 if (file.endsWith(".AIF"))
00478                         return "audio/x-aiff";
00479                 if (file.endsWith(".RA"))
00480                         return "audio/x-realaudio";
00481                 if (file.endsWith(".RPM"))
00482                         return "audio/x-pn-realaudio-plugin";
00483                 if (file.endsWith(".RAM"))
00484                         return "audio/x-pn-realaudio";
00485                 if (file.endsWith(".SD2"))
00486                         return "audio/x-sd2";
00487                 // Application
00488                 if (file.endsWith(".BIN") || file.endsWith(".DMS") || file.endsWith(".LHA") || file.endsWith(".LZH") || file.endsWith(".EXE") || file.endsWith(".CLASS"))
00489                         return "application/octet-stream";
00490                 if (file.endsWith(".HQX"))
00491                         return "application/mac-binhex40";
00492                 if (file.endsWith(".PS") || file.endsWith(".AI") || file.endsWith(".EPS"))
00493                         return "application/postscript";
00494                 if (file.endsWith(".PDF"))
00495                         return "application/pdf";
00496                 if (file.endsWith(".RTF"))
00497                         return "application/rtf";
00498                 if (file.endsWith(".DOC"))
00499                         return "application/msword";
00500                 if (file.endsWith(".PPT"))
00501                         return "application/powerpoint";
00502                 if (file.endsWith(".FIF"))
00503                         return "application/fractals";
00504                 if (file.endsWith(".P7C"))
00505                         return "application/pkcs7-mime";
00506                 // Application/x
00507                 if (file.endsWith(".JS"))
00508                         return "application/x-javascript";
00509                 if (file.endsWith(".Z"))
00510                         return "application/x-compress";
00511                 if (file.endsWith(".GZ"))
00512                         return "application/x-gzip";
00513                 if (file.endsWith(".TAR"))
00514                         return "application/x-tar";
00515                 if (file.endsWith(".TGZ"))
00516                         return "application/x-compressed";
00517                 if (file.endsWith(".ZIP"))
00518                         return "application/x-zip-compressed";
00519                 if (file.endsWith(".DIR") || file.endsWith(".DCR") || file.endsWith(".DXR"))
00520                         return "application/x-director";
00521                 if (file.endsWith(".DVI"))
00522                         return "application/x-dvi";
00523                 if (file.endsWith(".TEX"))
00524                         return "application/x-tex";
00525                 if (file.endsWith(".LATEX"))
00526                         return "application/x-latex";
00527                 if (file.endsWith(".TCL"))
00528                         return "application/x-tcl";
00529                 if (file.endsWith(".CER") || file.endsWith(".CRT") || file.endsWith(".DER"))
00530                         return "application/x-x509-ca-cert";
00531                 // Video
00532                 if (file.endsWith(".MPG") || file.endsWith(".MPE") || file.endsWith(".MPEG"))
00533                         return "video/mpeg";
00534                 if (file.endsWith(".QT") || file.endsWith(".MOV"))
00535                         return "video/quicktime";
00536                 if (file.endsWith(".AVI"))
00537                         return "video/x-msvideo";
00538                 if (file.endsWith(".MOVIE"))
00539                         return "video/x-sgi-movie";
00540                 // Chemical
00541                 if (file.endsWith(".PDB") || file.endsWith(".XYZ"))
00542                         return "chemical/x-pdb";
00543                 // X-
00544                 if (file.endsWith(".ICE"))
00545                         return "x-conference/x-cooltalk";
00546                 if (file.endsWith(".WRL") || file.endsWith(".VRML"))
00547                         return "x-world/x-vrml";
00548                 if (file.endsWith(".WML"))
00549                         return "text/vnd.wap.wml";
00550                 if (file.endsWith(".WMLC"))
00551                         return "application/vnd.wap.wmlc";
00552                 if (file.endsWith(".WMLS"))
00553                         return "text/vnd.wap.wmlscript";
00554                 if (file.endsWith(".WMLSC"))
00555                         return "application/vnd.wap.wmlscriptc";
00556                 if (file.endsWith(".WBMP"))
00557                         return "image/vnd.wap.wbmp";
00558 
00559                 return null;
00560         }
00561 
00562         public int getMinorVersion() {
00563                 return 3; // support 2.3
00564         }
00565 
00566         public RequestDispatcher getNamedDispatcher(String name) {
00567                 return this;
00568         }
00569 
00570         public String getRealPath(String path) {
00571                 return installPath + FileUtilities.convertFileNameToSystem(path);
00572                 //return htdocs + File.separator + FileUtilities.convertFileNameToSystem(path);
00573         }
00574 
00575         public RequestDispatcher getRequestDispatcher(String path) {
00576                 return this;
00577         }
00578 
00579         // only root relative in this implementation
00580         public URL getResource(String path) throws MalformedURLException {
00581                 return new URL("http", hostName, port, path);
00582         }
00583 
00584         public InputStream getResourceAsStream(String path) {
00585                 return null; // we don't provide resources in this way
00586         }
00587 
00588         public java.util.Set getResourcePaths(java.lang.String path) {
00589                 // TODO: implement
00590                 return null;
00591         }
00592 
00594         // is running.
00595         // Same as the CGI variable SERVER_SOFTWARE.
00596         public String getServerInfo() {
00597                 return Identification.serverName + " " + Identification.serverVersion + " (" + Identification.serverUrl + ")";
00598         }
00599 
00600         public Servlet getServlet(String name) {
00601                 // Deprecated. As of Java Servlet API 2.1, with no direct replacement.
00602                 // This method was originally defined to retrieve a servlet from a ServletContext.
00603                 // In this version, this method always returns null and remains only to preserve binary compatibility.
00604                 // This method will be permanently removed in a future version of the Java Servlet API.
00605 
00606                 // In lieu of this method, servlets can share information using the ServletContext class
00607                 // and can perform shared business logic by invoking methods on common non-servlet classes.
00608                 return null;
00609         }
00610 
00617         public java.lang.String getServletContextName() {
00618                 return null; //"ROOT";
00619         }
00620 
00622         // servlets that are accesible will be returned.  This enumeration always
00623         // includes the servlet itself.
00624         public Enumeration getServletNames() {
00625                 // Deprecated. As of Java Servlet API 2.1, with no replacement.
00626                 // This method was originally defined to return an Enumeration of all the servlet names known to this context.
00627                 // In this version, this method always returns an empty Enumeration and remains only to preserve binary compatibility.
00628                 // This method will be permanently removed in a future version of the Java Servlet API.
00629                 return new Vector().elements();
00630         }
00631 
00632         public Enumeration getServlets() {
00633                 // Deprecated. As of Java Servlet API 2.0, with no replacement.
00634                 // This method was originally defined to return an Enumeration of all the servlets known to this servlet context.
00635                 // In this version, this method always returns an empty enumeration and remains only to preserve binary compatibility.
00636                 // This method will be permanently removed in a future version of the Java Servlet API.
00637                 return new Vector().elements();
00638         }
00639 
00640         public void log(Exception exception, String msg) {
00641                 LogManager.traceWarning(LogServices.WEBSERVICE, msg);
00642                 LogManager.traceWarning(LogServices.WEBSERVICE, exception);
00643         }
00644 
00645         public void log(String msg) {
00646                 LogManager.traceWarning(LogServices.WEBSERVICE, msg);
00647         }
00648 
00649         public void log(String message, Throwable throwable) {
00650                 LogManager.traceWarning(LogServices.WEBSERVICE, message);
00651                 LogManager.traceWarning(LogServices.WEBSERVICE, throwable);
00652         }
00653 
00654         public void removeAttribute(String name) {
00655                 attributes.remove(name);
00656         }
00657 
00658         public void setAttribute(String name, Object object) {
00659                 attributes.put(name, object);
00660         }
00661 
00662         // RequestDispatcher METHODS
00663         // ***************************************************************************************************************
00664 
00665         public void forward(ServletRequest request, ServletResponse response) {
00666         }
00667 
00668         public void include(ServletRequest request, ServletResponse response) {
00669         }
00670 }

Generated on Mon Jan 14 17:29:50 2008 for OpenMobileIS by  doxygen 1.5.4