Package org.osgi.service.http

Examples of org.osgi.service.http.NamespaceException


        if (length > 1 && alias.charAt(length - 1) == '/')
            throw new IllegalArgumentException(
                    "The alias parameter must not end with slash: " + alias);

        if (registrations.get(alias) != null)
            throw new NamespaceException("The alias is already in use: "
                    + alias);

        bundleRegistrations.addElement(alias);
        registrations.put(alias, registration);
View Full Code Here


       
        synchronized (m_servletMap)
        {
            if (m_servletMap.containsKey(alias))
            {
                throw new NamespaceException("Alias " + alias
                    + " has already been registered.");
            }
        }

        if (context == null)
View Full Code Here

    {
        validateAlias(alias);
       
        if (m_servletMap.containsKey(alias))
        {
            throw new NamespaceException("Alias " + alias
                + " has already been registered.");
        }

        if (context == null)
        {
View Full Code Here

     */
    private void validateAlias( String alias ) throws NamespaceException
    {
        if (alias == null)
        {
            throw new NamespaceException( "Alias is null." );
        }
       
        if (alias.trim().length() == 0)
        {
            throw new NamespaceException( "Alias is an empty string." );
        }
       
        if (!alias.startsWith( "/" ))
        {
            throw new NamespaceException( "Alias must begin with '/'." );
        }
    }
View Full Code Here

        {
            // Remove it from the servletmap too
            servletMap.remove(handler.getServlet(), handler);

            handler.destroy();
            throw new NamespaceException("Servlet with alias '" + handler.getAlias() + "' already registered");
        }

        updateServletArray();
    }
View Full Code Here

            throw new ServletException("Servlet instance already registered");
        }

        if (this.aliasMap.containsKey(handler.getAlias()))
        {
            throw new NamespaceException("Servlet with alias already registered");
        }

        handler.init();
        this.servletMap.put(handler.getServlet(), handler);
        this.aliasMap.put(handler.getAlias(), handler.getServlet());
View Full Code Here

        // Make sure that the alias is not already in use.
        Registration registration = (Registration)
                alias2Registration.get(alias);
        if (registration != null) {
            throw new NamespaceException("Alias '" + alias +
                    "' is already in use by '" + registration + "'");
        }

        // Make sure that the servlet has not already been registered
        // under another alias.
View Full Code Here

        // Make sure that the alias is not already in use.
        Registration registration = (Registration)
                alias2Registration.get(alias);
        if (registration != null) {
            throw new NamespaceException("Alias '" + alias +
                    "' is already in use by '" + registration + "'");
        }

        InternalServletContext servletContext =
                getServletContext(httpContext);
View Full Code Here

        ServletRegistration registration;
        ServletContextImpl servletContext;
        synchronized (lock)
        {
            if (registrations.containsKey(alias)) throw new NamespaceException("Alias " + alias + " already registered");

            if (httpContext == null) httpContext = createDefaultHttpContext();

            registration = new ServletRegistration(alias, servlet, httpContext);
            registrations.put(alias, registration);
View Full Code Here

    jerseyContext.addResource( new Object() );
  }
 
  @Test( expected = IllegalStateException.class )
  public void testConvertsNamespaceException() throws ServletException, NamespaceException {
    doThrow( new NamespaceException( "test" ) )
      .when( httpService ).registerServlet( anyString(),
                                            any( Servlet.class ),
                                            any( Dictionary.class ),
                                            any( HttpContext.class ) );
   
View Full Code Here

TOP

Related Classes of org.osgi.service.http.NamespaceException

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.