Package javax.servlet

Examples of javax.servlet.Servlet


  public Servlet unloadServlet(Servlet servlet) {
    PathTreeDictionary registry = (PathTreeDictionary) currentRegistry
        .get();
    if (registry == null)
      registry = defaultRegistry;
    Servlet result = null;
    synchronized (registry) {
      result = (Servlet) registry.remove(servlet)[0];
    }
    return result;
  }
View Full Code Here


           
            // If no instance, class load, then call init()
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            Thread.currentThread().setContextClassLoader(this.webAppConfig.getLoader());
           
            Servlet newInstance = null;
            Throwable otherError = null;
            try {
                Class servletClass = Class.forName(classFile, true, this.webAppConfig.getLoader());
                newInstance = (Servlet) servletClass.newInstance();
                this.isSingleThreadModel = Class.forName("javax.servlet.SingleThreadModel").isInstance(newInstance);
               
                // Initialise with the correct classloader
                Logger.log(Logger.DEBUG, Launcher.RESOURCES, "ServletConfiguration.init", this.servletName);
                newInstance.init(this);
                this.instance = newInstance;
            } catch (ClassNotFoundException err) {
                Logger.log(Logger.WARNING, Launcher.RESOURCES,
                        "ServletConfiguration.ClassLoadError", this.classFile, err);
                setUnavailable(newInstance);
View Full Code Here

      }
   }

   public Servlet unloadServlet(Servlet servlet)
   {
      Servlet result = null;
      synchronized (registry)
      {
         result = (Servlet) registry.remove(servlet)[0];
      }
      return result;
View Full Code Here

      return result;
   }

   public synchronized void unloadServlet(String urlPat)
   {
      Servlet servlet = (Servlet) registry.remove(urlPat)[0];
      if (servlet != null)
         servlet.destroy(); // sessions associated with it have to be invalidated to free up any the servlet specific object
      // TODO decide if UnavailableException should be thrown at access
   }
View Full Code Here

        return dispatcher;
    }

    public void destroy()
    {
        final Servlet servlet = dispatcher.getServlet();
        final ServletConfig cfg = servlet.getServletConfig();
        final ServletContext context = cfg != null ? cfg.getServletContext() : null;
        servlet.destroy();
        if (context != null) {
          contextManager.ungetServletContext(context);
        }
        registrations.removeServlet(servlet);
    }
View Full Code Here

               IOException
    {
        if (_class==null)
            throw new UnavailableException("Servlet Not Initialized");
       
        Servlet servlet = getServletInstance();
        synchronized(this)
        {
            if (!isAvailable() || !isSetInitOrder())
                servlet=getServlet();
            if (servlet==null)
                throw new UnavailableException("Could not instantiate "+_class);
        }
       
        // Service the request
        boolean servlet_error=true;
       
        try
        {           
            servlet.service(request,response);
            servlet_error=false;
        }
        catch(UnavailableException e)
        {
            makeUnavailable(e);
View Full Code Here

      if (_protocolFactory == null)
        throw new IllegalStateException(L.l("unknown protocol factory for '{0}'",
                                            this));

      Servlet servlet
        = _protocolFactory.createServlet(getServletClass(), service);

      servlet.init(this);

      return servlet;
    } catch (RuntimeException e) {
      throw e;
    } catch (ServletException e) {
View Full Code Here

      if (servlet instanceof Page) {
        // server/102i
        // page already configured
      }
      else if (servlet instanceof Servlet) {
        Servlet servletObj = (Servlet) servlet;

        servletObj.init(this);
      }
    } catch (UnavailableException e) {
      setInitException(e);
      throw e;
    }
View Full Code Here

   */
  public void doFilter(ServletRequest request,
                       ServletResponse response)
    throws ServletException, IOException
  {
    Servlet servlet = null;

    synchronized (this) {
      servlet = _servlet;
      _servlet = null;
    }
   
    if (servlet == null) {
      try {
        servlet = (Servlet) _config.createServlet(true);
      } catch (ServletException e) {
        throw e;
      } catch (Exception e) {
        throw new ServletException(e);
      }
    }
   
    try {
      servlet.service(request, response);
    } catch (UnavailableException e) {
      _config.setInitException(e);
      // application.killServlet(servlet, config);

      throw e;
    }

    synchronized (this) {
      if (_servlet == null) {
        _servlet = servlet;
        servlet = null;
      }
    }

    if (servlet != null)
      servlet.destroy();
  }
View Full Code Here

    /**
     * hook to register that we need to scan for security annotations.
     * @param wrapper   The wrapper for the Servlet that was added
     */
    public ServletRegistration.Dynamic dynamicServletAdded(Wrapper wrapper) {
        Servlet s = wrapper.getServlet();
        if (s != null && createdServlets.contains(s)) {
            // Mark the wrapper to indicate annotations need to be scanned
            wrapper.setServletSecurityAnnotationScanRequired(true);
        }
        return new ApplicationServletRegistration(wrapper, this);
View Full Code Here

TOP

Related Classes of javax.servlet.Servlet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.