Examples of HttpService


Examples of org.osgi.service.http.HttpService

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

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

        HttpURLConnection client = getConnection( DEFAULT_BASE_URL + "/test", "GET" );

        int parameterCount = 16;
        for ( int i = 0; i < parameterCount; ++i )
View Full Code Here

Examples of org.osgi.service.http.HttpService

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

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

Examples of org.osgi.service.http.HttpService

     * @throws NamespaceException
     */
    public void testCannotRegisterSameAliasTwice() throws ServletException, NamespaceException
    {

        HttpService httpService = getHTTPService( registry.getBundleContext() );

        boolean namespaceExceptionThrown = false;
        httpService.registerServlet( "/alias", new BasicTestingServlet(), null, null );

        try
        {
            httpService.registerServlet( "/alias", new BasicTestingServlet(), null, null );
        }
        catch ( NamespaceException e )
        {
            namespaceExceptionThrown = true;
        }
View Full Code Here

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

Examples of org.osgi.service.http.HttpService

     * @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

Examples of org.osgi.service.http.HttpService

    }

    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

Examples of org.osgi.service.http.HttpService

    }

    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

Examples of org.osgi.service.http.HttpService

        }
    }

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

Examples of org.osgi.service.http.HttpService

        }
    }

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

Examples of org.osgi.service.http.HttpService

     * @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
TOP
Copyright © 2018 www.massapi.com. 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.