Package org.osgi.service.http

Examples of org.osgi.service.http.HttpService


     * @throws ServletException
     * @throws NamespaceException
     */
    public void testCannotRegisterInvalidAlias() throws ServletException, NamespaceException
    {
        HttpService httpService = getHTTPService( registry.getBundleContext() );
        String[] badAliases =
            { "noslash" };

        for ( int i = 0; i < badAliases.length; ++i )
        {
            boolean namespaceExceptionThrown = false;
            try
            {
                httpService.registerServlet( badAliases[i], new BasicTestingServlet(), null, null );
            }
            catch ( NamespaceException e )
            {
                namespaceExceptionThrown = true;
            }
View Full Code Here


     * @throws ServletException
     * @throws NamespaceException
     */
    public void testCanReregisterAlias() throws ServletException, NamespaceException
    {
        HttpService httpService = getHTTPService( registry.getBundleContext() );

        httpService.registerServlet( "/alias", new BasicTestingServlet(), null, null );

        httpService.unregister( "/alias" );

        httpService.registerServlet( "/alias", new BasicTestingServlet(), null, null );
    }
View Full Code Here

    }

    public synchronized void unregisterAll()
    {
      AbstractMapping[] mappings = null;
      HttpService service;
      synchronized (this) {
      service = this.httpService;
      if (service != null) {
          Collection<AbstractMapping> values = this.mapping.values();
          mappings = values.toArray(new AbstractMapping[values.size()]);
View Full Code Here

    }

    private synchronized void registerAll()
    {
      AbstractMapping[] mappings = null;
      HttpService service;
      synchronized (this) {
      service = this.httpService;
      if (service != null) {
          Collection<AbstractMapping> values = this.mapping.values();
          mappings = values.toArray(new AbstractMapping[values.size()]);
View Full Code Here

        }
    }

    private void registerMapping(AbstractMapping mapping)
    {
        HttpService httpService = this.httpService;
        if (httpService != null)
        {
            mapping.register(httpService);
        }
    }
View Full Code Here

        }
    }

    private void unregisterMapping(AbstractMapping mapping)
    {
        HttpService httpService = this.httpService;
        if (httpService != null)
        {
            mapping.unregister(httpService);
        }
    }
View Full Code Here

     * @throws NamespaceException
     * @throws IOException
     */
    public void testNoCookiesSentByDefault() throws ServletException, NamespaceException, IOException
    {
        HttpService httpService = getHTTPService( registry.getBundleContext() );
        CookieServlet servlet = new CookieServlet( MODE_NONE_SET );
        httpService.registerServlet( "/test", servlet, null, null );

        //Test that no cookies are currently set.
        HttpURLConnection client = getConnection( DEFAULT_BASE_URL + "/test", "GET" );

        client.connect();
View Full Code Here

     * @throws NamespaceException
     * @throws IOException
     */
    public void testSimpleCookie() throws ServletException, NamespaceException, IOException
    {
        HttpService httpService = getHTTPService( registry.getBundleContext() );
        CookieServlet servlet = new CookieServlet( MODE_SIMPLE );
        httpService.registerServlet( "/test", servlet, null, null );

        //Test that no cookies are currently set.
        HttpURLConnection client = getConnection( DEFAULT_BASE_URL + "/test", "GET" );

        //Set the cookie in the response
View Full Code Here

     * @throws NamespaceException
     * @throws IOException
     */
    public void testMultipleCookies() throws ServletException, NamespaceException, IOException
    {
        HttpService httpService = getHTTPService( registry.getBundleContext() );
        CookieServlet servlet = new CookieServlet( MODE_MULTI );
        httpService.registerServlet( "/test", servlet, null, null );

        //Test that no cookies are currently set.
        HttpURLConnection client = getConnection( DEFAULT_BASE_URL + "/test", "GET" );

        //Set the cookie in the response
View Full Code Here

     * @throws NamespaceException
     * @throws IOException
     */
    public void testQueryString() throws ServletException, NamespaceException, IOException
    {
        HttpService httpService = getHTTPService( registry.getBundleContext() );

        BasicTestingServlet testServlet = new BasicTestingServlet();
        httpService.registerServlet( "/test", testServlet, null, null );

        StringBuffer qs = new StringBuffer( "?" );
        int parameterCount = 16;
        for ( int i = 0; i < parameterCount; ++i )
        {
View Full Code Here

TOP

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

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.