Sun GlassFish Enterprise Server v3 Prelude Administration Guide

Administering HTTP Listeners

An HTTP listener is a listen socket that has an Internet Protocol (IP) address, a port number, a server name, and a default virtual server. Each virtual server provides connections between the server and clients through one or more HTTP listeners. Each HTTP listener must have a unique combination of port number and IP address. For example, an HTTP listener can listen on all configured IP addresses on a given port for a host by specifying the IP address 0.0.0.0. Alternatively, the HTTP listener can specify a unique IP address for each listener while using the same port.

Because an HTTP listener is a combination of IP address and port number, you can have multiple HTTP listeners with the same IP address and different port numbers, or with different IP addresses and the same port number (if your host was configured to respond to these addresses). The host running the Enterprise Server typically has access to only one IP address. HTTP listeners typically use the 0.0.0.0 IP address and different port numbers, with each port number serving a different purpose. However, if the host does have access to more than one IP address, each address can serve a different purpose.

By default, when Enterprise Server starts, the following HTTP listeners are started automatically:

To access a web application deployed on the Enterprise Server, use the URL http://localhost:8080/ (or https://localhost:8181/ for a secure application), along with the context root specified for the web application.

To access the Administration Console, use the URL https://localhost:4848/ or http://localhost:4848/asadmin/ (console default context root).

The following table describes the Enterprise Server default ports for the listeners that use ports.

Table 8–1 Default Ports for Listeners

Listener 

Default Port  

Description 

Administrative server 

4848 

A domain’s administrative server is accessed by the Administration Console and the asadmin utility. For the Administration Console, specify the port number in the URL of the browser. When running an asadmin command remotely, specify the port number by using the --port option.

HTTP 

8080 

The web server listens for HTTP requests on a port. To access deployed web applications and services, clients connect to this port. 

HTTPS 

8181 

Web applications configured for secure communications listen on a separate port. 

The following tasks are used to administer HTTP listeners:

ProcedureTo Create an HTTP Listener

The remote create-http-listener command enables you to create an HTTP listener.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Create an HTTP listener by using the create-http-listener(1) command.

  3. To apply your changes, restart Enterprise Server.

    1. Stop Enterprise Server.

      For instructions, see To Stop a Domain (or Server).

    2. Start Enterprise Server.

      For instructions, see To Start a Domain (or Server).


Example 8–1 Creating an HTTP Listener

The following example command creates an HTTP listener named sampleListener that uses a non-default number of acceptor threads. Security is not enabled at runtime.


asadmin create-http-listener --listeneraddress 0.0.0.0 
--listenerport 7272 --defaultvs server --servername host1.sun.com 
--acceptorthreads 100 --securityenabled=false 
--enabled=false sampleListener

Information similar to the following is displayed:


Command create-http-listener executed successfully.

See Also

To see the full syntax and options of the command, type asadmin help create-http-listener at the command line.

ProcedureTo List HTTP Listeners

The remote list-http-listeners command enables you to list the existing HTTP listeners.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. List HTTP listeners by using the list-http-listeners(1) command.


Example 8–2 Listing HTTP Listeners

The following example command lists the HTTP listeners on localhost:


asadmin list-http-listeners

Information similar to the following is displayed:


sampleListener
admin-listener
http-listener-2
http-listener-1
Command list-http-listeners executed successfully.

See Also

To see the full syntax and options of the command, type asadmin list-http-listeners -help at the command line.

ProcedureTo Delete an HTTP Listener

The remote delete-http-listener command enables you to delete an existing HTTP listener. This disables secure communications for the listener.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Obtain the exact name of the HTTP listener that you are deleting.

    To list the existing HTTP listeners:


    asadmin list-http-listeners
    
  3. If necessary, notify users that the HTTP listener is being deleted.

  4. Delete an HTTP listener by using the delete-http-listener(1) command.

  5. To apply your changes, restart Enterprise Server.

    1. Stop Enterprise Server.

      For instructions, see To Stop a Domain (or Server).

    2. Start Enterprise Server.

      For instructions, see To Start a Domain (or Server).


Example 8–3 Deleting an HTTP Listener

The following example command deletes the HTTP listener named sampleListener from localhost:


delete-http-listener sampleListener

Information similar to the following is displayed:


Command delete-http-listener executed successfully.

See Also

To see the full syntax and options of the command, type asadmin delete-http-listener -help at the command line.

ProcedureTo Configure an HTTP Listener for SSL

The remote create-ssl command enables you to create and configure an SSL element in the specified listener. This enables secure communication for the listener.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Configure an HTTP listener by using the create-ssl(1) command.

  3. To apply your changes, restart Enterprise Server.

    1. Stop Enterprise Server.

      For instructions, see To Stop a Domain (or Server).

    2. Start Enterprise Server.

      For instructions, see To Start a Domain (or Server).


Example 8–4 Configuring an HTTP Listener for SSL

The following example command enables the HTTP listener named http-listener-1 for SSL:


asadmin create-ssl --type http-listener --certname sampleCert http-listener-1

Information similar to the following is displayed:


Command create-ssl executed successfully.

See Also

To see the full syntax and options of the command, type asadmin create-ssl --help at the command line.

ProcedureTo Delete SSL From an HTTP Listener

The remote delete-ssl command enables you to delete the SSL element in the specified listener. This disables secure communications for the listener.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Delete SSL from an HTTP listener by using the delete-ssl(1) command.

  3. To apply your changes, restart Enterprise Server.

    1. Stop Enterprise Server.

      For instructions, see To Stop a Domain (or Server).

    2. Start Enterprise Server.

      For instructions, see To Start a Domain (or Server).


Example 8–5 Deleting SSL From an HTTP Listener

The following example command disables SSL for the HTTP listener named http-listener-1:


asadmin delete-ssl --type http-listener http-listener-1

Information similar to the following is displayed:


Command delete-http-listener executed successfully.

See Also

To see the full syntax and options of the command, type asadmin delete-ssl --help at the command line.