Package org.mortbay.jetty.servlet

Examples of org.mortbay.jetty.servlet.ServletHttpContext


   public void deploy(String servletClassName, JMXServiceURL url, Map environment) throws IOException
   {
      try
      {
         String urlPattern = resolveServletMapping(url);
         ServletHttpContext context = (ServletHttpContext)getServer().getContext("/");
         context.addServlet(urlPattern, servletClassName);
         // TODO: be sure an undeployed url is not restarted !
         if (!context.isStarted()) context.start();
      }
      catch (Exception x)
      {
         throw new IOException(x.toString());
      }
View Full Code Here


   }

   public void undeploy(String servletName, JMXServiceURL url, Map environment)
   {
      String urlPattern = resolveServletMapping(url);
      ServletHttpContext context = (ServletHttpContext)getServer().getContext("/");
      ServletHandler handler = context.getServletHandler();
      handler.getServletMap().remove(urlPattern);
   }
View Full Code Here

  private int port;
  private Http http = new Http();

  protected void setUp() throws Exception {

    ServletHttpContext context = new ServletHttpContext();
    context.setContextPath("/");
    context.setResourceBase(RES_DIR);
    context.addServlet("JSP", "*.jsp", "org.apache.jasper.servlet.JspServlet");
    context.addHandler(new ResourceHandler());

    server = new Server();
    server.addContext(context);

    conf = new Configuration();
View Full Code Here

   public void deploy(String servletClassName, JMXServiceURL url, Map environment) throws IOException
   {
      try
      {
         String urlPattern = resolveServletMapping(url);
         ServletHttpContext context = (ServletHttpContext)getServer().getContext("/");
         context.addServlet(urlPattern, servletClassName);
         // TODO: be sure an undeployed url is not restarted !
         if (!context.isStarted()) context.start();
      }
      catch (Exception x)
      {
         throw new IOException(x.toString());
      }
View Full Code Here

   }

   public void undeploy(String servletName, JMXServiceURL url, Map environment)
   {
      String urlPattern = resolveServletMapping(url);
      ServletHttpContext context = (ServletHttpContext)getServer().getContext("/");
      ServletHandler handler = context.getServletHandler();
      handler.getServletMap().remove(urlPattern);
   }
View Full Code Here

                while ( itcontext.hasNext() )
                {
                    Context wdc = (Context) itcontext.next();

                    ServletHttpContext context = (ServletHttpContext) server.getContext( wdc.getId() );

                    initContext( wdc, context );
                }
            }
            catch ( Exception e )
View Full Code Here

  public void addServlet(String name, String pathSpec, String classname,
     String contextPath)
throws ClassNotFoundException, InstantiationException, IllegalAccessException {
    String tmpContextPath = contextPath;
    if (tmpContextPath == null) tmpContextPath = "/";
    ServletHttpContext context =
                    (ServletHttpContext)webServer.getContext(tmpContextPath);
    if (name == null)
      context.addServlet(pathSpec, classname);
    else
      context.addServlet(name, pathSpec, classname);
  }
View Full Code Here

     *
     * @param aRepository DAVRepository to be served by this server.
     */
    public void addRepository(DAVRepository aRepository) {
        // Gets the context associated to this repository.
        ServletHttpContext servletContext =
            (ServletHttpContext) server.getContext(aRepository.getHost(),
                aRepository.getContext());
       
        // Defines the servlet context attributes.
        Map attributes = aRepository.getServletContextAttr();
        for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
            Map.Entry attribute = (Map.Entry) iter.next();
            servletContext.setAttribute((String) attribute.getKey(),
                attribute.getValue());
        }

        ServletHolder holder = null;
        try {
            // Defines the WebDAV servlet.
            holder = servletContext.addServlet("DAVRepository", "/*", aRepository.getHandlingServlet().getName());

            // Defines the servlet init parameters.
            attributes = aRepository.getServletInitParam();
            for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
                Map.Entry attribute = (Map.Entry) iter.next();
                holder.setInitParameter((String) attribute.getKey(), (String) attribute.getValue());
            }
            servletContext.start();
        } catch (Exception e) {
            log.error(e);
            throw new RuntimeException(e);
        }
        synchronized (repToServletHolder) {
View Full Code Here

     *
     * @param aRepository DAVRepository to be served by this server.
     */
    public void addRepository(DAVRepository aRepository) {
        // Gets the context associated to this repository.
        ServletHttpContext servletContext =
            (ServletHttpContext) server.getContext(aRepository.getHost(),
                aRepository.getContext());
       
        // Defines the servlet context attributes.
        Map attributes = aRepository.getServletContextAttr();
        for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
            Map.Entry attribute = (Map.Entry) iter.next();
            servletContext.setAttribute((String) attribute.getKey(),
                attribute.getValue());
        }

        ServletHolder holder = null;
        try {
            // Defines the WebDAV servlet.
            holder = servletContext.addServlet("DAVRepository", "/*", aRepository.getHandlingServlet().getName());

            // Defines the servlet init parameters.
            attributes = aRepository.getServletInitParam();
            for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
                Map.Entry attribute = (Map.Entry) iter.next();
                holder.setInitParameter((String) attribute.getKey(), (String) attribute.getValue());
            }
            servletContext.start();
        } catch (Exception e) {
            log.error(e);
            throw new RuntimeException(e);
        }
        synchronized (repToServletHolder) {
View Full Code Here

     *
     * @param aRepository DAVRepository to be served by this server.
     */
    public void addRepository(DAVRepository aRepository) {
        // Gets the context associated to this repository.
        ServletHttpContext servletContext =
            (ServletHttpContext) server.getContext(aRepository.getHost(),
                aRepository.getContext());
       
        // Defines the servlet context attributes.
        Map attributes = aRepository.getServletContextAttr();
        for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
            Map.Entry attribute = (Map.Entry) iter.next();
            servletContext.setAttribute((String) attribute.getKey(),
                attribute.getValue());
        }

        ServletHolder holder = null;
        try {
            // Defines the WebDAV servlet.
            holder = servletContext.addServlet("DAVRepository", "/*", aRepository.getHandlingServlet().getName());

            // Defines the servlet init parameters.
            attributes = aRepository.getServletInitParam();
            for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
                Map.Entry attribute = (Map.Entry) iter.next();
                holder.setInitParameter((String) attribute.getKey(), (String) attribute.getValue());
            }
            servletContext.start();
        } catch (Exception e) {
            log.error(e);
            throw new RuntimeException(e);
        }
        synchronized (repToServletHolder) {
View Full Code Here

TOP

Related Classes of org.mortbay.jetty.servlet.ServletHttpContext

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.