Skip Headers
NetBeans Developing Applications with NetBeans IDE
Release 8.0

E50452-06
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

22 Working with Web and Application Servers

This chapter describes how to use the NetBeans IDE with Glassfish, Oracle WebLogic Server, JBoss, and Tomcat application servers. It describes how to configure web browsers, and covers developing Java web applications on Oracle Cloud and Amazon Elastic Beanstalk. It also explains how to use the HTTP Server-Side Monitor to diagnose problems.

This chapter contains the following sections:

22.1 About Working with Web and Application Servers

The NetBeans IDE can be configured to use either the integral web browser, or an alternative web browser. It can pass arguments so that you can fully test your applications.

The IDE supports working with Glassfish, Oracle WebLogic, JBoss, and Tomcat application servers, and it support deployment to Oracle Cloud and Amazon Elastic Beanstalk.

You can diagnose problems using the HTTP Server-Side Monitor.

22.1.1 Web Browsers

The IDE uses a web browser to display web pages and run web applications. By default, it uses the default system browser but you can change this to use another browser. You can also configure the web browser to pass arguments to the executable when the browser is run.

For more information, see Section 22.2, "Working with Web Browsers."

22.1.2 Application Servers

A server is a computer that serves up applications. Any computer can be turned into a server if you install server software and connect the computer to the Internet.

A Java EE application server, also known as a Java EE container, is any server that is fully compliant with the J2EE or Java EE platforms. Unlike a regular web server, an application server can run full enterprise applications, EJB modules, and web services. It can also manage transactions of persistent entity objects and communicate with databases.

The IDE supports the following Java EE application servers:

  • GlassFish Server. The IDE provides the fullest support for the GlassFish application server. You can stop and start the server, deploy applications to it, and view the deployed modules directly in the Services window. There is a visual editor for server-specific deployment descriptors and the IDE updates the descriptors automatically as you write your code. The IDE also automatically configures server resources like connection pools and JavaMail resources for this application server.

  • JBoss Application Server, Oracle WebLogic Server and IBM WebSphere Application Server. The IDE provides basic support for these application servers. You can start, stop, and debug the servers and deploy applications to them.

The IDE also supports the Tomcat Web Server and its libraries for the following activities:

  • Deploying web applications, JSP pages, and servlets.

  • Deploying web services and web service clients.

    Tip:

    The Tomcat Web Server is not a Java EE container. Therefore, you cannot deploy a web service client that uses JSR-109 stubs to this server. When you create the web service client make sure that you select IDE-generated static stub in the Client Type drop-down. For more information about JAX-WS Web service clients, see Section 18.5, "Creating JAX-WS Web Service Clients."

Before you can deploy an enterprise application, web application, JSP, servlet, or EJB module, the server to which you are going to deploy needs to be registered with the IDE. For more information, see the appropriate section for your server:

When a server is registered with the IDE, its libraries are available for production, or deployment, or both. Servers that are installed during the IDE installation process are automatically registered in the IDE. You must register all other servers yourself.

Tip:

You need to register a Java EE application server before you can begin developing enterprise applications.

When a server is registered with the IDE, you can see its node in the Services window under the Servers node. When you create a project in the New Project wizard, you can select the server to which you want to deploy your application. After you create the application, you can change the server by right-clicking the project, choosing Properties, clicking Run, and selecting a different server.

22.1.3 Understanding Connection Pools

To store, organize, and retrieve data, most applications use relational databases. Java EE applications access relational databases through the JDBC API.

When accessing a database, the application calls on the following resources:

  • JDBC resource. A JDBC resource (data source) provides applications with a means of connecting to a database. Typically, the administrator creates a JDBC resource for each database accessed by the applications deployed in a domain. (However, more than one JDBC resource can be created for a database.) Each JDBC resource has a unique JNDI name.

  • JDBC Connection pool. A JDBC connection pool is a group of reusable connections that the application server maintains for a particular database. When an application closes a connection, the connection is returned to the pool. Connection pooling reduces the transaction time of connecting to a database by means of sharing connection objects providing access to a database source, thus avoiding a new physical connection being created every time a connection is requested.

At runtime, this is what happens when an application connects to a database:

  1. Lookup JNDI name of JDBC resource. To connect to a database, the application looks up the JNDI name of the JDBC resource (data source) associated with the database. The JNDI API enables the application to locate the JDBC resource.

  2. Locate JDBC connection pool. The JDBC resource specifies which connection pool to use. The pool defines connection attributes such as the database name (URL), user name, and password.

  3. Retrieve connection from connection pool. The application server retrieves a physical connection from the connection pool that corresponds to the database. Now that the application is connected to the database, the application can read, modify, and add data to the database. Applications access the database by making calls to the JDBC API. The JDBC driver translates the application's JDBC calls into the protocol of the database server.

  4. Close connection. When it is finished accessing the database, the application closes the connection. The application server returns the connection to the connection pool. Once it is back in the pool, the connection is available for the next application.

Tip:

Each resource has a unique JNDI name which specifies its name and location. Because all resource JNDI names are in the java:comp/env subcontext, the JNDI name of a JDBC resource is expected in the java:comp/env/jdbc subcontext. For example, for a database name MyDatabase, specify jdbc/MyDatabase.

For information about using a connection pool, see Section 15.3.6, "How to Access a Connection Pool from a Java Class."

22.1.4 Common Application Server Tasks

This section contains information about tasks that are common to all application servers.

22.1.4.1 Setting Context Paths

When you execute a web application, the server uses a context path setting to derive the path to the web application. For example, if the context path is /directives, then you can access a file named index.html under the web application's document base (root directory) using the URL http://host:port/directives/index.html.

You should set a context path for a web application if you plan to execute different web applications on the same server. Otherwise, files with the same name will overwrite files from other web applications. When you create a web application from the New Project wizard, the default context path is derived from the name of the project.

To set a web application's context path:

  1. In the Projects window, right-click the project node and choose Properties from the pop-up menu.

  2. In the Project Properties dialog box, click Run and enter the Context Path. The path must begin with a forward slash (/), such as /directives.

Tip:

When you change the Context Path in the Project Properties dialog box, the IDE updates the Tomcat Web Server's context descriptor (META-INF/context.xml) or the GlassFish application server's deployment descriptor (WEB-INF/glassfish-web.xml) to match.

When the server receives the HTTP request, the server selects the web application to be processed by matching the longest possible prefix of the Request URI against all of the defined context paths. A host can have an unlimited number of unique context paths.

22.1.4.2 Starting and Stopping Servers

You can start and stop a local server from the pop-up menu for the server in the Services window. Alternately, the server tab in the Output window has the buttons for controlling the server, shown in Table 22-1.

Table 22-1 Buttons Used to Control a Server

Icon Description

Start the server

Start the server

Start in debug mode

Start the server in Debug Mode

Restart the server

Restart the server

Stop the server

Stop the server

Refresh the server

Refresh the server status


Tip:

You cannot start and stop a remote installation of a server from within the IDE.

To start or stop a local server from the Services window:

  1. Open the Services window by choosing Window > Services (Ctrl+5) from the main menu.

  2. Expand the Servers node to display the registered server instances.

  3. Right-click the server name and choose an action from the pop-up menu.

When you start a server, start up information is displayed in the server tab in the Output window.

To start or stop a local server from the Output window:

  1. Choose Window > Output (Ctrl+4) from the main menu to open the Output window.

  2. In the Output window, click the tab for the server.

  3. Use the buttons in the left of the server tab to Start, Start in Debug Mode, Restart, or Stop.

If the Output window does not contain a tab for your server, you can start the server from the Services window. The server tab appears when the server is started.

22.1.4.3 Removing Applications from Servers

When you no longer need to run an application that was added to the server using the IDE, you can remove the application's context from the server in the Services window.

By default, applications and modules are automatically registered, deployed and made available on the server when you run a project, and are automatically redeployed when they have been modified in the IDE. Once deployed, applications remain on the server until they are removed.

Deployed applications are visible in the Services window in the server instance node under a node for applications. When you undeploy an application, the archive file (ear, war, jar) is removed from the server and is no longer visible in the Services window.

To remove an application from a server:

  1. Open the Services window by choosing Window > Services (Ctrl+5) from the main menu.

  2. Expand the Servers node and ensure the server is running.

    If the server is not running, start the server by right-clicking the server node in the Services window and choosing Start. Alternately, click the Start Server button ( Start server ) in the server tab in the Output window.

  3. Expand the node of the server instance. If the server is not running, no subnodes are visible.

  4. Expand the node containing the application you want to remove.

  5. Right-click the application's context node and choose Undeploy.

22.1.5 Developing on the Cloud

You can develop Java web applications locally on the IDE and deploy the final application to the cloud. The IDE supports deployment to:

  • Oracle Cloud (requires Oracle Cloud plugin)

  • Amazon Elastic Beanstalk

For more information, see Section 22.7, "Working with Web Applications on the Cloud."

22.1.6 HTTP Server-Side Monitor

The IDE provides the HTTP Server-Side Monitor to help diagnose problems with data flow from JSP page and servlet execution on the web server. The HTTP Server-Side Monitor gathers data about HTTP requests that are processed by the servlet engine.

For more information, see Section 22.8, "Working with the HTTP Server-Side Monitor."

22.2 Working with Web Browsers

The IDE uses a web browser to display web pages and run web applications. By default, it uses the default system browser but you can change this to use another browser. You can also configure the web browser to pass arguments to the executable when the browser is run.

22.2.1 How to Configure a Web Browser

You can:

  • Change the browser which runs from the IDE.

  • Add or remove browser instances from the list of those available in the IDE.

  • Specify arguments to be passed to the executable when the browser is invoked.

Configuring a web browser:

  1. Choose Tools > Options from the main menu.

  2. Click the General category in the Options window.

  3. Click Edit next to the Web Browser dropdown list to open the Web Browsers Manager.

  4. Select the browser that you want to configure.

  5. Enter the full path to the browser executable in the Process field. You can also click Browse to locate the executable on the local system.

  6. Enter any arguments in the Arguments field.

  7. Click Close.

22.2.2 How to Change the Default Web Browser

The IDE uses the specified default web browser to display web pages and run web applications. In the Options window you can choose any one of the supported browsers, such as the supported versions of Firefox and Internet Explorer. In addition, you can also configure the IDE to use other browser types.

To change the web browser:

  1. Choose Tools > Options from the main menu and click the General category in the Options window.

  2. Select a browser from the Web Browser dropdown list.

The default browser opens when you choose Window > Web > Web Browser in the main menu.

Tip:

If you select a web browser and the web browser fails to open, confirm that the correct path to the browser executable is set. To modify the path to the executable or to add a browser to the Web Browser dropdown list, click the Edit button that is next to the dropdown list.

Troubleshooting

When you set the IDE to use a proxy, your Internet browser may attempt to route all files through the proxy, including local files. This results in a File Not Found error when you try to open an HTML file or applet in the IDE's external browser. To resolve this problem, add localhost and your machine name to the list of bypassed hosts in your browser's proxy settings.

Tip:

If the browser does not reflect changes in a JSP file or HTML file, this might be due to the way the browser caches pages. Check the browser's settings to ensure that the browser is set to reload pages each time you access them.

22.2.3 How to Open a Web Browser from the IDE

By default, the IDE opens your system's default web browser. If necessary, you can specify a different browser in the Options window. For more information, see Section 2.2, "Working with the Options Window."

To launch the web browser:

  • Choose Window > Web > Web Browser from the main menu.

Troubleshooting

If the IDE cannot find the operating system's default web browser, choose a different web browser. For more information, see Section 22.2.2, "How to Change the Default Web Browser."

22.2.4 How to Set a Proxy

If you want to use the Update Center or access the Internet through the IDE, but your system is behind a firewall or you use a proxy server, you need to configure the IDE with your proxy settings.

To use an HTTP proxy:

  1. From the main menu, choose Tools > Options from the main menu and click General in the left pane of the Options window.

  2. Select HTTP Proxy as the proxy type.

  3. Type the proxy host name and the proxy port number.

  4. Click OK.

To use a SOCKS proxy:

To run the IDE using a SOCKS proxy, you must pass the SOCKS proxy host and proxy port parameters to the JVM software when you start the IDE. On Microsoft Windows machines, use the IDE-HOME/etc/netbeans.conf file to pass the parameters. On UNIX and Linux machines, you can write a wrapper shell script.

On a Microsoft Windows machine:

  1. In the IDE's installation directory, expand the etc directory.

  2. If an netbeans.conf file is not there, create one.

  3. Open netbeans.conf in a text editor and type:

    -J-DsocksProxyHost=SOCKS-SERVER -J-DsocksProxyPort=1080
    

    For SOCKS-SERVER, use the host name of your SOCKS proxy.

  4. Save netbeans.conf and close it.

  5. Restart the IDE.

On a UNIX or Linux machine:

  1. Change directory to your IDE-installation/bin directory.

  2. Create a new shell script file.

  3. Open the new shell file in a text editor and type:

    runide.sh -J-DsocksProxyHost=SOCKS-SERVER -J-DsocksProxyPort=1080
    

    For SOCKS-SERVER, use the host name of your SOCKS proxy.

  4. Save the shell script and close it

  5. Restart the IDE with the new shell script.

22.3 Working with Glassfish Application Servers

The GlassFish application server is a Java EE compatible application server that supports JavaServer Pages (JSP), Java Servlet, and Enterprise JavaBeans (EJB) component-based applications.

Use this server and its libraries for the following activities:

Libraries included with the GlassFish application server can be used to compile web services and clients, verify that your application implements the Java EE specification correctly, create a new web application with JavaServer Faces (JSF) support, or add JSF support to an existing web application.

Tip:

To develop applications on the Java EE platform, you need to register an instance of the GlassFish Server.

After the GlassFish application server is registered with the IDE, the server instance is visible in the Servers node in the Services window. When the server is running, you can expand the server instance node to see the deployed applications and modules and modify the properties of resources on the server from within the IDE.

You can do the following directly through the server instance node:

When the GlassFish application server is running, you can expand the server instance node in the Services window to see the server resources and applications deployed to the server instance. For more information, see Section 22.3.2, "How to View the Server in the IDE.".

How to work with the GlassFish Server:

Task 1   Start the server
  1. Register the GlassFish application server with the IDE. For more information, see Section 22.3.1, "How to Register a Server Instance."

  2. In the Services window, right-click the server instance and select Start.

Task 2   Create and deploy enterprise applications
  1. Create the project for the enterprise application. For more information, see Section 13.1, "About Developing Enterprise Applications."

  2. Create the projects for any EJB modules. For more information, see Section 15.2, "Creating an EJB Module Project."

  3. Create the projects for any web modules. For more information, see Section 11.2, "Creating Web Application Projects."

  4. Add the modules to the enterprise application. For more information, see Section 14.2.3, "How to add a module to an enterprise application."

  5. Deploy the enterprise application. For more information, see Section 11.11, "Deploying a Web Application."

  6. Remove the application from the GlassFish application server. For more information, see Section 22.1.4.3, "Removing Applications from Servers."

Task 3   Configure the server
  1. Add your database drivers. For more information, see Section 23.3.1, "How to Add a JDBC Driver."

  2. Create a connection to a database. For more information, see Section 23.3, "Setting up a Database Connection."

  3. Set up a connection pool for the database. For more information, see Section 22.3.7, "How to Set up a Connection Pool."

  4. Register the connection pool. For more information, see Section 22.3.11, "How to Register and Delete Resources."

  5. Create a JDBC resource for the connection pool. For more information, see Section 22.3.8, "How to Set up a JDBC Resource."

  6. Register the JDBC resource. For more information, see Section 22.3.11, "How to Register and Delete Resources."

22.3.1 How to Register a Server Instance

To begin developing enterprise applications you must first register an instance of the GlassFish Server with the IDE.

If you deploy your applications to a remote instance of the application server, those libraries are available at runtime. However, during development, to compile your project you need a local instance of this server and libraries.

You can register multiple domain instances and Domain Administration Server (DAS) instances of the GlassFish application server with the IDE, but you must first specify the local folder that contains the local installation of the server. You only need to specify the location of the local installation once.

To register an instance of the GlassFish Server:

  1. Choose Tools > Servers, and in the Servers manager, click Add Server to open the Add Server wizard.

    Alternatively, right-click the Servers node in the Services window and choose Add Server.

    The Add Server wizard starts.

  2. In the Choose Server pane:

    • Select your application server from the list.

    • Enter a name for the server instance. This name is used to identify the server in the IDE.

    • Click Next.

  3. In the Server Location pane, use Browse to navigate to and select the installation directory of your application server.

    Next is only enabled when you have selected the correct installation directory.

  4. Select the type of domain you are registering. If you are registering the local default domain, the available domains are listed in the drop-down list. If you are registering a remote domain, you need to specify the host and port used to communicate with the remote domain.

    To define a local server instance:

    • From the Local instances drop-down menu, select a server instance. When you select a server instance, the IDE updates Domain path, Host, and Port.

    • Enter the Username and Password. If you are registering an instance of the server that was installed with the IDE, the default username is admin. There is no password.

  5. Click Finish to complete the Add Server Instance wizard.

  6. If you started the Add Server Instance wizard from the Server Manager, click Close in the Server Manager dialog box. The IDE displays a server node for your application server in the Services window under the Servers node.

After a server instance is registered with the IDE, a node for the server instance is visible in the Services window under the Servers node. You can perform the following tasks by right-clicking the server instance node and choosing a task from the pop-up menu:

  • Start and stop a server instance

  • Remove an instance of the server

  • Open the server's admin console in a browser

  • View the server log file

  • View the properties of the server

  • Contact the GlassFish Update Center to check for available software and server updates

To remove an instance of the server:

  1. Choose Tools > Servers.

  2. In the Servers manager, select the server name in the left pane.

  3. Click Remove.

  4. Click Close.

Tip:

Alternatively, in the Services window right-click the server instance you want to remove and choose Remove from the pop-up menu.

22.3.2 How to View the Server in the IDE

In the Services window, each registered instance of the GlassFish application server is represented by a node under the Servers node in the Services window. The subnodes of the GlassFish instance node represent the resources and applications that have been deployed to the server.

Table 22-2 shows you how to use the nodes in the Services window to explore and work with the server instance. To delete a resource, locate and right-click the resource under the appropriate node and choose Delete Resource.

Table 22-2 Nodes in the Services Window

Icon Description

Glassfish application server

GlassFish Application Server

This node is visible under the Servers node ( servers node ) in the Services window and represents an instance of the GlassFish application server.

There is a corresponding server instance node for each instance registered with the IDE. For more information, see Section 22.3.1, "How to Register a Server Instance."

If the server instance is running ( Glassfish server instance ), you can expand this node to see the resources for the server instance. You can right-click the server instance node to stop, start and restart the server or remove the server instance. For more information, see Section 22.1.4.2, "Starting and Stopping Servers."

Application contexts deployed to the server

Applications

Expand this node to see the modules and application contexts deployed to the server. You can disable, enable and remove an application context by locating and right-clicking the context in the Applications node.

Resources registered with the server

Resources

Expand this node to see the resources registered with the server.

JDBC resources and connection pools

JDBC resources

Expand this node to see the JDBC resources and Connection Pools registered with the server.

Javamail session

JavaMail Session

Expand this node to see the JavaMail Session resources registered with the server.

Connector resources

Connectors

Expand this node to see the Connector resources registered with the server.


22.3.3 How to Start and Stop the Server

You can quickly start or stop the server. For more information, see Section 22.1.4.2, "Starting and Stopping Servers."

To start and stop the server:

  • In the Services window, right-click the GlassFish application server node and choose Start / Stop Server.

    Alternatively, click the Start the Server button in the server log tab in the Output window.

22.3.4 How to View the Server Log File

You can view the log files of a registered instance of the GlassFish application server directly in the IDE. Log files describe the events that occur on the server and can be helpful when troubleshooting your application.

To view the log file:

  1. Expand the Servers node in the Services window of the IDE.

  2. Right-click the server instance node and choose View Server Log.

When you choose View Server Log, the server log is displayed in the Output window of the IDE.

22.3.5 How to Access the Server Admin Console

The instance node for the GlassFish application server in the IDE Services window provides a subset of the functions found in the GlassFish Admin Console. You can manage server resources through the instance node in the IDE or by using the GlassFish Admin Console.

To access the GlassFish Admin Console:

  1. Make sure the GlassFish application server is running. (Denoted by the running overlay icon ( Running overlay icon ) next to the server's node in the Services window.)

  2. Right-click the server instance node and choose View Admin Console.

The login screen for the Admin Console launches in your browser. After you log in, you can see that the options on the left are similar to those in the Services window in the IDE.

Tip:

If you are prompted for a username and password, the default username is admin and there is no password.

When you manage resources directly through the Admin Console, the resources are not directly associated with your project.

22.3.6 How to Modify Server Properties

You can set and modify some of the properties of the GlassFish Server by modifying the properties panel for the server in the Servers manager. You can open the properties panel from the Services window.

To modify the server properties:

  1. Ensure that the GlassFish instance is running.

  2. In the Services window, right-click the GlassFish instance under the Servers node and choose Properties to open the Servers manager.

    The GlassFish panel in the Servers manager contains a Common tab and a Java tab. In the Common tab you can modify properties related to the domain, username and deployment options.

  3. Click the Java tab to edit the Java platform and debug settings for the server.

    You can start the server in debug mode from the Services window.

  4. Specify the JDK platform that the server runs on.

  5. Select one of the following debug settings.

    • Socket (default). Select this to use the default transport. When selected the address value refers to the Java Platform Debugger Architecture (JPDA) port number. The default address setting is 9009. You can modify the address value to change the JPDA port.

      Shared Memory: On Windows, you can select this setting to use shared memory transport and then modifying the address property as necessary.

      For more on JPDA connection settings, see http://docs.oracle.com/javase/6/docs/technotes/guides/jpda/conninv.html.

  6. Enable or disable the use of IDE proxy settings. This setting is enabled by default. Click Close.

For more about Java Platform Debugger Architecture (JPDA), see http://www.oracle.com/technetwork/java/javase/overview/index.html.

22.3.7 How to Set up a Connection Pool

A JDBC connection pool is a group of reusable connections that the application server maintains for a particular database. Applications requesting a connection to a database obtain that connection from the pool. When an application closes a connection, the connection is returned to the pool.

Connection pooling reduces the transaction time of connecting to a database because connection objects providing access to a database source are shared, thus avoiding the creation of a new physical connection every time a connection is requested.

A connection pool is required if you want to create a JDBC resource. You can create connection pools for a project using the New File wizard.

To create a connection pool for your project:

  1. Choose File > New (Ctrl+N).

  2. Choose a project from the combo box.

    Tip:

    Though the resource can be saved in either the EJB module or the Web module, Java EE patterns recommend saving the resource in the EJB module to allow greater flexibility and reusability.

  3. Select GlassFish in the Categories pane, JDBC Connection Pool in the File Types pane, and click Next.

  4. (required) Give the connection pool a name.

  5. Select to either use an existing database connection or create a new connection by choosing a configuration from the list.

  6. Select the XA checkbox if the connection is an XA transaction.

  7. Click Next.

  8. The Datasource classname is determined by the connection you selected.

  9. Enter a description for the pool.

  10. Enter any properties for the connection. You may need to enter the URL for the database and user name and password to connect.

  11. Click Next if you want to modify the default properties for the connection. You can change these properties later by editing the glassfish-resources.xml file.

  12. Click Finish.

Once you have created a connection pool in your project, the resource needs to be registered with the server to make it available to all applications and resources. The resource is automatically registered when the project is deployed.

22.3.8 How to Set up a JDBC Resource

A JDBC resource (data source) provides applications with a means of connecting to a database through a connection pool. Typically, there is at least one JDBC resource for each database accessed by an application deployed in a domain. It is possible to have more than one JDBC resource for a database.

Tip:

A JDBC resource connects to a JDBC connection pool. If you have not already created the JDBC connection pool, you can create it in the wizard while you are creating the resource.

When you use Enterprise Resources > Use Database to generate lookup code for a database, the JDBC data sources are generated automatically.

To create a JDBC resource:

  1. Ensure the GlassFish application server is running.

  2. Go to File > New (Ctrl+N).

  3. In the Project drop-down list, choose either your EJB module or Web module.

  4. Select GlassFish in the Categories pane, JDBC Resource in the File Types pane, and click Next.

  5. Select an existing connection pool or create a new one.

  6. (required) Enter a JNDI name for the resource.

  7. Enable or disable the resource by choosing True or False.

  8. Enter a description and click Next.

  9. Enter any properties for the resource.

  10. Click Finish.

To prepare to use a data source:

  1. Ensure the GlassFish application server is running.

  2. Create a web application and select the GlassFish Application Server as the target server.

  3. Access the data source in, for example, a JSP page.

The resource is automatically registered when the project is deployed. When you register the resource, the resource is available to all applications and resources.

22.3.9 How to Set up a JMS Resource

The JMS API allows loosely coupled, reliable, asynchronous interactions among Java EE components and legacy systems capable of messaging. You can add new behavior to a Java EE application that has existing business events by adding a new message-driven bean to operate on specific business events. Java EE components that use the JMS API within EJB or web containers must have no more than one JMS session per JMS connection. For more information, see Section 15.3.4, "How to Send JMS Messages."

The JMS API uses two kinds of administered resource objects:

  • Connection Factories (Connector Resource). These objects are used to create a connection to the JMS messaging system, and encapsulate connection parameters.

  • Destination Resources (Admin Object Resource). These objects are specified as the targets and sources of messages. When creating a destination resource, you create two objects:

    • A physical destination

    • A destination resource that refers to the physical destination using the JNDI name

A JMS application normally uses at least one connection factory and at least one destination. The order in which the resources are created does not matter.

To create a JMS resource:

  1. Go to File > New (Ctrl+N).

  2. In the Project drop-down list, choose either your EJB module or Web module.

  3. Select GlassFish in the Categories pane, JMS Resource in the File Types pane, and click Next.

  4. (required) Enter a JNDI name for the resource. JMS administered objects are usually placed within the jms naming subcontext (for example, jms/MyMessageSource).

  5. Enable or disable the resource by choosing true or false.

  6. Enter a description.

  7. To create a destination resource, choose one of the following admin object resource types:

    • javax.jms.Queue - used for point-to-point communication

    • javax.jms.Topic - used for publish-subscribe communication

    To create a connection factory, choose one of the following connector resource types:

    • javax.jms.QueueConnectionFactory - used for point-to-point communication

    • javax.jms.TopicConnectionFactory - used for publish-subscribe communication

    • javax.jms.ConnectionFactory - used for point-to-point communication

    Tip:

    With the introduction of the JMS 1.1 specification, it is recommended that you use javax.jms.ConnectionFactory if you do not need to support existing code.

  8. Click Next.

  9. Enter properties for the resource, if any.

  10. Click Finish.

22.3.10 How to Set Up a JavaMail Session

The JavaMail API is a set of abstract APIs that model a mail system. The API provides a platform-independent and protocol-independent framework to build mail and messaging applications. The JavaMail API provides facilities for reading and sending email. Service providers implement particular protocols.

The JavaMail API is implemented as a Java platform optional package and is also available as part of the Java EE platform.

To create a JavaMail Session resource:

  1. Go to File > New (Ctrl+N).

  2. In the Project combo box, choose either your EJBModule or WebModule.

  3. Select GlassFish in the Categories pane, JavaMail Session in the File Types pane, and click Next.

  4. (required) Enter a JNDI name for the resource.

  5. (required) In the mail host field, enter the DNS name of the default mail server.

  6. (required) In the default user field, enter the user name to use when connecting to the mail server.

  7. (required) In the Default Return Address field, enter the email address of the default user, in the form username@host.domain.

  8. Enable or disable the resource by choosing true or false.

  9. Enter a description.

  10. In the Advanced area, change the field values only if the server's mail provider has been reconfigured to use a nondefault store or transport protocol. Select True for Debug Enabled for extra debugging output.

  11. Click Next.

  12. Enter any properties for the resource.

  13. Click Finish.

22.3.11 How to Register and Delete Resources

Once you have created a resource object, the resource needs to be registered with the server. Once registered, the object is available to all the applications and resources.

Resources are automatically registered with the server when the project is deployed.

When you create a resource object for a project with the New File wizard, the resource name and properties are added to the file glassfish-resources.xml. You can edit glassfish-resources.xml in the Source Editor to modify resource properties.

To open glassfish-resource.xml in the Source Editor, double-click the file in one of the following places:

  • In the Projects window, under the Server Resources node

  • In the Files window, in the setup directory

Note:

Alternatively, you can create resources in the Admin Console of the server. After you create a resource on the server, the resource will appear in the Services window.

After the object is registered with the server it is visible in the Services window under the Servers node under the node corresponding to the type of resource. You can modify some of the properties of the resource object by opening the properties window for the object.

To delete a resource from the server:

  1. Locate the object you wish to delete in the Services window.

  2. Right-click on the object and select Delete Resource.

When you delete a resource from the server it is no longer visible in the Services window.

Notes:

  • If you create a resource in your project, removing the resource from the server does not delete it from your project. The resource is still defined in glassfish-resources.xml until you modify the file and remove it. If you do not remove the resource definition in glassfish-resources.xml, the resource will be created again when you deploy your project.

  • The JNDI name for a resource must be unique. To change the JNDI name, open glassfish-resources.xml in the Source Editor and modify the name.

22.3.12 How to Manage Users

You use the Admin Console of the GlassFish application server to add and delete users, change passwords and perform other user and group management tasks. You can access the Admin Console from the Services window. For more, see Section 22.3.5, "How to Access the Server Admin Console."

To add a user:

  1. Open the Admin Console of the GlassFish application server.

  2. In the tree in the left pane of the Admin Console, select Configuration > Security > Realms > admin-realm.

  3. In the Edit Realm page, click Manage Users.

    Current user IDs are displayed in a table.

  4. Click New and enter the new User ID and Password in the respective fields. Confirm the password by entering the same password again in Confirm Password.

  5. Click OK to create the new user. If you made an error entering the password, a prompt appears telling you to reenter the password.

  6. To continue managing users, click Close to return to the File Users page.

To delete a user:

  1. Open the Admin Console of the GlassFish application server.

  2. In the tree in the left pane of the Admin Console, select Configuration > Security > Realms > admin-realm.

  3. In the Edit Realm page of the Admin Console, click Manage Users to display a table showing the Current user IDs.

  4. In the User ID column, select the checkbox of the user you want to delete and click Delete.

    The user immediately disappears from the table of User IDs.

  5. To continue managing users, click Close to return to the File Users page.

To change a user's password:

  1. Open the Admin Console of the GlassFish application server.

  2. In the tree in the left pane of the Admin Console, select Configuration > Security > Realms > admin-realm.

  3. In the Edit Realm page of the Admin Console, click Manage Users to display a table showing the Current user IDs.

  4. In the User ID column, select a user name, such as admin.

    The File Users page opens.

  5. Enter the new password in Password. Confirm it by entering the password again in Confirm Password.

  6. Click Save to have your password entries checked and saved. If you made an error, a prompt appears telling you to enter the password again.

  7. To continue managing users, click Close to return to the File Users page.

22.3.13 How to Configure Security Roles

If you want to create secure areas of a web application, you need to configure the security roles by modifying the project's deployment descriptors. When configuring the security roles for your web application, you define your security roles in web.xml.

To add a role:

  1. In the Security Roles section, click Add.

  2. In the Add Security Role dialog box, enter the name and a description for the role and click OK.

To edit a role:

  1. In the Security Roles section, select the role you want to edit and click Edit.

  2. In the Edit Security Role dialog box, make your changes and click OK.

To remove a role:

  • In the Security Roles section, select the role you want to delete and click Remove.

If the target server for your application is the GlassFish server, you need to edit glassfish-web.xml to map the security roles to the users and groups defined on the server. You map security roles by adding a principal or group to a security role. A security role can have more than one principal or group. You can use the IDE to help you edit glassfish-web.xml to map security roles.

To map security roles:

  1. In the Projects window of the IDE, double-click glassfish-web.xml located in the Configuration Files directory of your web application project.

  2. Click the Security tab in the visual editor.

  3. Click Add Security Role Mapping to create a new security role.

    Tip:

    The security roles are determined by the security roles defined in web.xml. If web.xml already defines a security role, the role is listed in glassfish-web.xml. For more on defining security roles in web.xml, see Section 11.10.2, "How to Edit Deployment Descriptors."

  4. Expand the security role node to view the properties of the security role.

  5. Click Add Principal or Add Group to open the Add Principal or Add Group dialog box.

  6. In the dialog box, enter the name of the principal or group to add to the selected security role. The name of the principal or group must match a name specified on the GlassFish server.

For more details, see the following GlassFish Server documentation: "Managing Administrative Security".

22.3.14 How to Download and Install Server Updates

You can download and install add-ons and updates to the GlassFish server. You can also inspect installed components from the GlassFish Update Tool.

To install server updates:

  1. In the Services window, right-click the GlassFish application server node and choose View Domain Update Center.

  2. If the GlassFish Server 4.0 Update Center is not already installed you are prompted to install it. You can follow the installation process in the Output window.

  3. In the GlassFish Update Tool, select the desired update from the available software and server updates.

  4. Click Install.

22.4 Working with Oracle WebLogic Application Servers

Oracle WebLogic Server is a scalable, enterprise-ready Java Platform, Enterprise Edition (Java EE) application server. The Oracle WebLogic Server infrastructure supports the deployment of many types of distributed applications and is an ideal foundation for building applications.

22.4.1 How to Register a Server Instance

Before you can start developing and deploying applications to an application server, you must register your application server with the IDE.

To register an instance of an Oracle WebLogic Server:

  1. Choose Tools > Servers, and in the Server Manager, click Add Server.

    Alternatively, right-click the Servers node in the Services window and choose Add Server from the pop-up menu.

    The Add Server Instance wizard starts.

  2. In the Choose Server pane, do the following:

    1. Select your application server from the list.

    2. In Name, type a name for the server instance. This name is used to identify the server in the IDE.

    3. Click Next.

  3. In the Server Location pane, use Browse to navigate to and select the installation directory of your application server.

    Next is only enabled when you have selected the correct installation directory.

  4. Click Next.

  5. To define a local server instance, do the following:

    1. From the Local instances drop-down menu, select a server instance. When you select a server instance, the IDE updates Domain path, Host, and Port.

    2. Fill in Username and Password. The default username/password is weblogic/weblogic1.

  6. Click Finish.

  7. If you started the Add Server Instance wizard from the Server Manager, click Close in the Server Manager dialog box. The IDE displays a server node for your application server in the Services window under the Servers node.

22.4.2 How to View the Server in the IDE

In the Services window, each registered instance of the Oracle WebLogic application server is represented by a node under the Servers node in the Services window. The subnodes of the Oracle WebLogic instance node represent the resources and applications that have been deployed to the server.

Table 22-3 shows you how to use the nodes in the Services window to explore and work with the server instance. To delete a resource, locate and right-click the resource under the appropriate node and choose Delete Resource.

Table 22-3 Nodes in the Services Window

Icon Description

Oracle Weblogic server

Oracle WebLogic Application Server

This node is visible under the Servers node ( servers node ) in the Services window and represents an instance of the GlassFish application server.

There is a corresponding server instance node for each instance registered with the IDE. For more information, see Section 22.4.1, "How to Register a Server Instance."

If the server instance is running ( Oracle Weblogic server ), you can expand this node to see the resources for the server instance. You can right-click the server instance node to stop, start and restart the server or remove the server instance. For more information, see Section 22.1.4.2, "Starting and Stopping Servers."

Application contexts deployed to the server

Applications

Expand this node to see the modules and application contexts deployed to the server. You can disable, enable and remove an application context by locating and right-clicking the context in the Applications node.

Resources registered with the server

Resources

Expand this node to see the resources registered with the server.

JDBC resources and connection pools

JDBC resources

Expand this node to see the JDBC resources and Connection Pools registered with the server.

Javamail session

JavaMail Session

Expand this node to see the JavaMail Session resources registered with the server.

Connector resources

Connectors

Expand this node to see the Connector resources registered with the server.


22.4.3 How to Start and Stop the Server

You can quickly start or stop the server in the Services window or from the Output window. For more information, see Section 22.1.4.2, "Starting and Stopping Servers."

To start and stop the server:

  • In the Services window, right-click the Oracle WebLogic application server node and choose Start / Stop Server.

    Alternatively, click the Start the Server button in the server log tab in the Output window.

22.5 Working with JBoss Application Servers

The JBoss Application Server supports JavaServer Pages (JSP), Java Servlets and Enterprise JavaBeans (EJB) component-based applications.

In the IDE, you can use this server for the following activities:

Once the JBoss Application Server is registered with the IDE, the server instance is visible in the Servers node in the Services window. For more information about what the icons represent, see Section 22.1.4.2, "Starting and Stopping Servers."

22.5.1 How to Register a Server Instance

Before you can start developing and deploying applications to an application server, you must register your application server with the IDE.

To register an instance of a JBoss Application Server:

  1. Choose Tools > Servers, and in the Servers manager, click Add Server.

    Alternatively, right-click the Servers node in the Services window and choose Add Server from the pop-up menu.

    The Add Server Instance wizard starts.

  2. In the Choose Server pane, do the following:

    1. Select your application server from the list.

    2. In the Name field, type a name for the server instance. This name is used to identify the server in the IDE.

    3. Click Next.

  3. In the Server Location pane, use Browse to navigate to and select the installation directory of your application server.

    Next is only enabled when you have selected the correct installation directory.

  4. Click Next.

  5. In the Instance Properties pane, from the Domain drop-down menu, select the JBoss Application Server domain you want to use for this server instance. The IDE automatically updates the Domain path field.

  6. Click Finish.

  7. If you started the Add Server Instance wizard from the Server Manager, click Close in the Server Manager dialog box. The IDE displays a server node for your application server in the Services window under the Servers node.

22.5.2 How to View the Server in the IDE

In the Services window, each registered instance of the JBoss application server is represented by a node under the Servers node in the Services window. The subnodes of the JBoss instance node represent the resources and applications that have been deployed to the server.

Table 22-4 shows you how to use the nodes in the Services window to explore and work with the server instance. To delete a resource, locate and right-click the resource under the appropriate node and choose Delete Resource.

Table 22-4 Nodes in the Services Window

Icon Description

JBoss server

JBoss Application Server

This node is visible under the Servers node ( servers node ) in the Services window and represents an instance of the JBoss application server.

There is a corresponding server instance node for each instance registered with the IDE. For more information, see Section 22.5.1, "How to Register a Server Instance."

If the server instance is running ( JBoss server ), you can expand this node to see the resources for the server instance. You can right-click the server instance node to stop, start and restart the server or remove the server instance. For more information, see Section 22.1.4.2, "Starting and Stopping Servers."

Application contexts deployed to the server

Applications

Expand this node to see the modules and application contexts deployed to the server. You can disable, enable and remove an application context by locating and right-clicking the context in the Applications node.

Resources registered with the server

Resources

Expand this node to see the resources registered with the server.

JDBC resources and connection pools

JDBC resources

Expand this node to see the JDBC resources and Connection Pools registered with the server.

Javamail session

JavaMail Session

Expand this node to see the JavaMail Session resources registered with the server.

Connector resources

Connectors

Expand this node to see the Connector resources registered with the server.


22.5.3 How to Start and Stop the Server

You can quickly start or stop the server in the Services window or from the Output window. For more information, see Section 22.1.4.2, "Starting and Stopping Servers."

To start and stop the server:

  • In the Services window, right-click the GlassFish application server node and choose Start / Stop Server.

    Alternatively, click the Start the Server button in the server log tab in the Output window.

22.5.4 How to Set up a Connection Pool

A JDBC connection pool is a group of reusable connections that a web server or application server maintains for a particular database. Applications requesting a connection to a database obtain that connection from the pool. When an application closes a connection, the connection is returned to the pool. Connection pool properties may vary with different database vendors. Some common properties are the URL for the database name, user name, and password.

The first step in creating a database connection pool on the JBoss Application Server is to create JDBC resource (also called a data source). A JDBC resource provides applications with a connection to a database. Typically, there is at least one JDBC resource for each database accessed by an application deployed in a domain. It is possible to have more than one JDBC resource for a database. You can create a JDBC resource manually in a file tailored to your database server, provided in the JBoss installation directory.

To set up a data source on the JBoss Application Server:

  1. Open the Favorites window (Ctrl+3).

  2. Right-click in the window, choose Add to Favorites, and browse to the JBoss installation directory's docs/examples/jca folder.

  3. Open the -ds.xml file of your choice in the editor. For example, if MySQL is your database server, double-click mysql-ds.xml.

  4. Define the data source. For example, for PointBase, the data source could be similar to the following:

    <datasources>
       <local-tx-datasource>
          <jndi-name>MySqlDS</jndi-name>
          <connection-url>jdbc:mysql://mysql-hostname:3306/jbossdb</connection-url>
          <driver-class>com.mysql.jdbc.Driver</driver-class>
          <user-name>x</user-name>
          <password>y</password>
          <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
          <metadata>
            <type-mapping>mySQL</type-mapping>
          </metadata>
      </local-tx-datasource>
    </datasources>
    
  5. Copy the file to your JBoss deployment directory. For example, if default is your domain, copy the file to server/default/deploy.

To reference a data source from a web application:

  1. In the WEB-INF/jboss-web.xml file, add a resource reference. For example, for the data source above, the resource reference could be as follows:

    <resource-ref>
      <res-ref-name>MySqlDS</res-ref-name>
      <jndi-name>MySqlDS</jndi-name>
    </resource-ref>
    
  2. In the WEB-INF/web.xml file, add a resource reference. For example, for the data source above, the resource reference could be as follows:

    <resource-ref>
      <res-ref-name>MySqlDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    

To prepare to use a data source on the JBoss Application Server:

  1. Register the JBoss Application Server. For more information, see Section 22.5.1, "How to Register a Server Instance."

  2. Set the JBoss port number in its server.xml file. By default, the port number is 8080. If you are using the default domain, the server.xml file is found here:

    \server\default\deploy\jbossweb.sar\server.xml
    
  3. Create a web application and select JBoss Application Server as the target server. For more information, see Section 22.1.4.2, "Starting and Stopping Servers."

  4. Access the data source in, for example, a JSP page.

22.5.5 How to Access Application Server Utilities

The JBoss Application Server instance node in the IDE provides access to the JBoss Management Console, JMX Console, and server log. You can manage server resources, such as deployed applications, through these utilities.

To access the JBoss Application Server's utilities:

  1. In the Services window, expand the Servers node.

  2. Start the server by right-clicking the JBoss Application Server instance node and choosing Start.

  3. After the server starts, right-click the node and choose View Admin Console, View JMX Console, or View Server Log.

22.6 Working with Tomcat Web Servers

The IDE provides an IDE module that handles integration with Tomcat Web Servers. A Tomcat Web Server is pre-configured to work with the plugin. The Tomcat Web Server that is bundled with the IDE implements the JavaServer Pages 2.2 and Servlet 3.0 specifications and includes many features that are useful in the deployment of web applications.

Instead of using the bundled Tomcat Web Server, you can register a supported Tomcat Web Server with the IDE and then deploy to it. The IDE supports Tomcat 8, Tomcat 7 and TomEE.

To see the Tomcat Web Servers that are registered with the IDE, expand the Servers node in the Services window.

For more information, see the following web sites:

When you download and install a version of the IDE that contains Java EE technologies, you can choose to install and register the Tomcat Web Server during the installation process.

The configuration files for the bundled Tomcat Web Server are in the Tomcat base (Catalina base) directory, located under your IDE user directory. The Tomcat home (Catalina home) directory is under the IDE installation directory. Note that this setup differs from a typical Tomcat installation, where the base directory and home directory coincide. To see the exact locations of the home and base directories, right-click the server's node in the Services tab and choose Properties from the popup menu.

Tip:

If the Tomcat base (Catalina base) folder does not exist, it is created the first time the server is started.

Shared libraries that are used by web applications must be added to the home directory. Do not add shared libraries to the base directory.

WARNING:

Developers using a common IDE installation need to exercise caution when adding shared libraries to the home directory. Libraries stored in the home directory are shared by all web applications that are deployed on the server, so the potential for version conflicts exists.

On the UNIX platform, the IDE is sometimes installed in a read-only directory. If this is the case, you cannot add shared libraries to the bundled Tomcat installation. Ask the person responsible for the IDE installation to make writable all directories under the Tomcat home directory. Alternatively, you could add another Tomcat Web Server and configure it to meet your needs.

22.6.1 How to Register a Server Instance

When you download and install a version of the IDE that includes Java EE technologies, you can choose to install and register the Tomcat Web Server during the installation process. You can also configure the IDE to deploy web applications to other installations of supported versions of the Tomcat Web Server. These Tomcat Web Server installations must first be registered. Unsupported versions of the Tomcat Web Server cannot be registered with the IDE.

To register an instance of the Apache Tomcat web server:

  1. Make sure the server is not running. If the server is running and there is a port number conflict with other installed servers, the IDE will not be able to resolve the conflict.

  2. Choose Tools > Servers.

    Alternatively, right-click the Servers node in the Services window and choose Add Server.

  3. Click Add Server to display the Add Server Instance wizard.

  4. Select the version of the Tomcat web server that you want to register. Click Next.

  5. Specify the server installation location and login properties in the Add Server Instance wizard. Click Finish.

    When you click Finish, the IDE adds a node for the server instance under the Servers node in the Services window. You can place the cursor over the server's node to display a tooltip that contains the server's port number.

To set the username and password for Tomcat Web Server:

  1. In the Services window, right-click the Servers node and choose Add Server.

    The Add Server Instance dialog box opens.

  2. Select the applicable server and click Next.

  3. Browse for the Catalina Home directory. You can also choose to use a private configuration folder.

  4. Enter the username and password you want to use for the server instance. If the user does not exist, click the checkbox to create the user.

  5. Click Finish to add the server instance. The new username and password is added to the tomcat-users.xml file.

To get the username and password from your user directory:

  1. Select Help > About from the main menu.

  2. Make a note of the path to the Userdir folder.

  3. In your file system, go to your Userdir and then to the apache-tomcat-8.0.x_base\conf folder.

  4. Open the tomcat-users.xml file and make a note of the password that is defined for the "ide" username.

Note:

The username and password are not saved when you enter them in this dialog box. The username and password are only saved if you define them in the Tomcat Web Server's Properties dialog box. To open the Properties dialog box, right-click the Tomcat Web Server's instance node in the Services window and select Properties.

To remove an instance of the Tomcat Web Server:

  1. Choose Tools > Servers from the main menu.

  2. In the Servers manager, select the Tomcat Web Server from the list of servers in the left pane.

  3. Click Remove Server.

  4. Click Close.

22.6.2 How to View the Server in the IDE

The Servers node in the Services window and its subnodes represent the Tomcat Web Server, its instances, and the contexts that have been deployed by an instance to the server. If you right-click a node and display its popup menu, you see a list of menu items that enable you to work with this node.

To view the Tomcat Web Server in the IDE:

  1. Choose Window > Services (Ctrl+5) from the main menu. The Services window appears.

  2. Expand the Servers node to view the Tomcat Web Server nodes.

    • The Servers node shows all the servers that are registered in the IDE, such as the bundled Tomcat Web Server.

    • Each physical installation of a Tomcat Web Server is represented by a Tomcat Server instance node.

    • The Web Applications node lists the web application contexts that have been deployed to the server. It appears under the server's instance node in the Services window. The IDE adds a web application's context node the first time the web application is deployed from the IDE.

In the Projects and Files windows, the Tomcat context descriptor node ( Tomcat server node ) reflects the context.xml file that contains the web application's context element. The Tomcat context descriptor node appears under the web application's META-INF node. When Tomcat is set as the target server, the IDE creates the META-INF directory and the Tomcat context descriptor when you create, open, or import a web application, unless one already exists.

The context.xml file is used for setting a web application context path and for advanced web application configuration. For simple web applications, you do not need to edit the context.xml file because you use the WEB-INF property sheet to set the context path and the deployment descriptor (web.xml) to configure the web application. The IDE maintains the context element's path attribute automatically when you edit the Context Path in the WEB-INF properties sheet. If you update the context path in one place, the IDE updates the value in the other place.

You can use the context.xml file to make the following settings:

  • Servlet context log files

  • JNDI resources and resource parameters (JDBC data source)

  • Web application context parameters and environment entries

The context.xml file represents the server.xml context element. It is recommended that the context information is specified in a standalone context.xml file in the META-INF directory. For more information about the context.xml configuration, see: http://tomcat.apache.org/tomcat-7.0-doc/config/context.html.

To open the Tomcat Web Application Manager

  1. In the Services window, right-click the Tomcat Web Server node and choose Start.

  2. Expand the Web Applications node and right-click the node for the /manager context and choose Open in Browser.

  3. Log in using a valid username and password.

To undeploy an application

  1. In the Services window, expand the Tomcat Web Server instance and the Web Applications node in the Services window.

  2. Expand the node which contains the type of application to undeploy.

  3. Right-click the application and choose Undeploy from the contextual menu.

22.6.3 How to Start and Stop the Server

The server starts automatically when you deploy a web application. For more information, see Section 22.1.4.2, "Starting and Stopping Servers."

To start the server manually:

  1. In the Services window, expand the Servers node.

  2. Right-click the Tomcat Web Server node and choose Start or Restart.

To stop the server:

  1. In the Services window, expand the Servers node.

  2. Right-click the Tomcat Web Server node and choose Stop.

22.6.4 How to Configure the Server Properties

You can configure properties and customize the server.

The Tomcat node in the Services window represents a physical installation of a Tomcat Web Server. When you choose the install Tomcat with the IDE, the installer automatically adds an instance for the bundled Tomcat Web Server. You can register additional Tomcat Web Servers using the Add New Server dialog box. See Section 22.6.1, "How to Register a Server Instance."

If you right-click the Tomcat node and display the contextual menu, you see a list of menu items that enable you to work with this node. The following list describes some of these menu items:

  • Start. Starts the server.

  • Start in Debug Mode. Starts the server in debug mode.

  • Start in Profile Mode. Starts the server in profile mode.

  • Restart. Stops and restarts the server.

  • Stop. Stops the server.

  • Refresh. Shows the status (started or stopped) of the server.

  • Remove. Removes the server from the Servers node.

  • Edit server.xml. Opens the server.xml file in the Source Editor. It is recommended to edit this file using the Tomcat Manager. Only advanced users should edit this file in the Source Editor.

  • View Server Output. Displays the server log file as defined in the server.xml file. This item is enabled when the server is running. If no logger is defined in the context.xml file, logging for that context is performed in this shared context log.

  • Properties. Opens the Tomcat Web Server instance's Properties dialog box.

To customize the server:

  1. In the Services window, expand the Servers node to view the Tomcat Web Server nodes.

  2. Right-click a Tomcat Web Server's instance and select Properties from the popup menu.

The Servers manager opens and displays the following information:

Connection Tab

  • Catalina Home. Specifies the location of the server installation.

  • Catalina Base. Specifies the base directory for the Tomcat Web Server. You can set this property when you add a Tomcat Web Server to the Server Manager. If you set a base directory, then that is where the Tomcat configuration files reside. One reason for specifying a separate base directory is to allow more than one user to use the same server. If no base directory is specified, then the configuration files reside in the home directory.

  • Credentials of an existing user in the "manager" role.

    • Username. Specifies the user name that the IDE uses to log into the server's manager application. The user must be associated with the manager role. The first time the IDE starts the Tomcat Web Server, such as through the Start/Stop menu action or by executing a web component from the IDE, the IDE adds an admin user with a randomly-generated password to the tomcat-base-path/conf/tomcat-users.xml file. (Right-click the Tomcat Web Server instance node in the Services window and select Properties. In the Properties dialog box, the Base Directory property points to the base-dir directory.) The admin user entry in the tomcat-users.xml file looks similar to the following:

       <user username="ide" password="woiehh" roles="manager"/>
      
    • Password. Specifies the user's password. See the explanation for the Username property above for details.

  • Server Port. Specifies the number of the TCP/IP port that the server listens on. The URL for a web application that is deployed on the server is derived from the host's URL and the server port, such as http://localhost:8086.

  • Shutdown Port. Specifies the port number on which the server waits for a shutdown command.

  • Enable HTTP Monitor. If selected, this checkbox enables the HTTP Monitor for web applications executing on the Tomcat Web Server. When enabling the monitor, you must restart the server in order for the change to take affect. The HTTP Monitor is useful for debugging web applications. If you are using the server for production purposes only, you may want to clear the checkbox to reduce its impact on the server's performance. When you clear the checkbox, the IDE removes the HTTP monitor's declaration from the server. However the monitor's libraries remain deployed to the server. When you disable the HTTP Monitor, you must restart the server for the change to take affect.

Startup Tab

  • Use Custom Catalina Script. When selected the server is started using a custom a Catalina script. Click Browse to specify the location of the custom script. This is deselected by default.

  • Force Stop. Specifies whether to use the force shutdown (shutdown is followed by the kill command). This is unchecked by default. This function is disabled on Windows.

  • Debugger Transport. Enables you to select either shared memory or socket based transport for debugging.

    • Shared Memory Name. When selected, the transport is set to dt_shmem. You can type a shared memory name or use the default name. This option is selected by default on Windows.

    • Socket Port. When selected the Java Platform Debugger Architecture (JPDA) transport is set to dt_socket and the JPDA address is set to the specified socket port number when the server is started in debug mode.

    The Shared Memory transport option is only available on Windows. If you want to use the JPDA socket transport for debugging on Windows, select Socket Port and specify the JPDA port number.

Deployment Tab

  • Deployment Timeout(s). Specifies the length of server timeouts.

  • Enable JDBC driver deployment. Specifies whether to enable JDBC driver deployment. This is checked by default.

Classes Tab

  • Lists all classes associated with the server instance.

Sources Tab

  • Lists all sources associated with the server instance.

Javadoc Tab

  • Lists all Javadoc associated with the server instance.

22.6.5 How to Edit the Configuration File

The main configuration file for Tomcat is the server.xml file. It provides configuration information for Tomcat components and specifies deployment information for the server. For simple web applications, editing the server.xml file is not necessary because the IDE makes the necessary changes automatically. Most edits to the server configuration file can be achieved by editing the properties for the Tomcat Web Server node, or by using menu commands in the Projects window, Files window, and Services window.

Editing is usually necessary only for advanced configuration, such as setting up authentication based on JNDI or database lookups. For more information about configuring Tomcat, see http://tomcat.apache.org/tomcat-7.0-doc/config/index.html.

The server.xml file can be in one of two places. Typically, you edit the server.xml file that is in the tomcat-installation-dir/conf directory. However, if the server node's property sheet shows a base directory path that is different from the home directory path, then you must edit the server.xml file that is in the base-dir/conf directory.

To edit the server.xml file in the Source Editor:

WARNING:

You can edit the server.xml file that is in the base-dir/conf directory in the Source Editor. It is recommended that only advanced users edit the server.xml file in the Source Editor.

  1. In the Services window, expand the Servers node and the Tomcat Servers node.

  2. Stop the server by right-clicking the Tomcat instance node and choosing Stop.

  3. Right-click the Tomcat instance node and choose Edit server.xml from the contextual menu to open the server.xml file in the Source Editor.

22.6.6 How to Authenticate the Server

It would not be safe to ship application servers and web servers with default settings that allowed anyone on the Internet to execute them on your server. Therefore, servers are shipped with the requirement that anyone who attempts to use them must authenticate themselves, using a username and password with the appropriate role associated with them.

For example, the Tomcat Web Server uses the Tomcat Manager to run web applications. To authenticate yourself when you run your web application, JSP file, or servlet, you need a username and password for a user with the "manager" role. This username and password are defined in the tomcat-users.xml file that is in your user directory.

Tip:

You can only use the usernames and passwords that are defined in the IDE user directory's tomcat-users.xml file, and not those that are in the IDE installation directory's tomcat-users.xml file. Click show to display the password for a username created while registering the server with the IDE.

During installation, the IDE generates a user called ide for use with the bundled Tomcat Web Server. This user is assigned the "manager" role and is created in your user directory's tomcat-users.xml file.

To set the username and password for the Tomcat Manager:

  1. In your system, go to Tomcat's base directory and then to its \conf subfolder.

    Tip:

    If you don't know where Tomcat's base directory is, right-click the Tomcat Web Server instance node in the Services window and select Properties. In the Server Manager, the Catalina Base Directory points to the base directory.

    The tomcat-users.xml file in Tomcat's base directory contains instructions for creating user roles. If necessary, define the necessary role, save the file and stop and restart the Tomcat instance in the Services window.

  2. Open the tomcat-users.xml file and make a note of the password that is defined for the ide username.

  3. Right-click the Tomcat Web Server instance node in the Services window and select Properties. In the Server manager, type the username and password.

Tip:

If the username and password have not been specified, a dialog box appears when you run a web application, JSP file, or servlet. If you specify the username and password in this dialog box, they are not saved. The username and password are only saved if you define them in the Tomcat Web Server instance's Properties dialog box.

For details on using the security manager, see the following document.

http://tomcat.apache.org/tomcat-7.0-doc/security-manager-howto.html

22.6.7 How to Set up a Connection Pool

A JDBC connection pool is a group of reusable connections that a web server or application server maintains for a particular database.  Applications requesting a connection to a database obtain that connection from the pool. When an application closes a connection, the connection is returned to the pool. Connection pool properties may vary with different database vendors. Some common properties are the URL for the database name, user name, and password.

For detailed information on Tomcat's database connection pooling functionality, see http://commons.apache.org/proper/commons-dbcp/.

The first step in creating a Tomcat database connection pool is to create JDBC resource (also called a data source). A JDBC resource provides applications with a connection to a database. Typically, there is at least one JDBC resource for each database accessed by an application deployed in a domain. It is possible to have more than one JDBC resource for a database. You can create a JDBC resource manually in your server.xml.

To add a JDBC resource manually in the server.xml file:

WARNING:

Be aware that you hand-edit the server.xml file at your own risk; the IDE cannot repair a damaged server.xml file. You are strongly encouraged to create a backup version of your working server.xml file before beginning to edit by hand.

  1. In the Services window, expand the Servers node and the Tomcat Servers node.

  2. Stop the server by right-clicking the Tomcat instance node and choosing Stop.

  3. Right-click the Tomcat instance node and choose Edit server.xml from the contextual menu to open the server.xml file in the Source Editor.

  4. Make your changes.

  5. Reference the JDBC resource from your web application as described below.

To reference a JDBC resource from a web application:

  1. Expand the project node in the Projects window. Then expand the Web Pages node and the WEB-INF node. Double-click the web.xml node and use the Source Editor to add your resource reference to the web.xml file as follows:

                <resource-ref>
                  <description>Tomcat DBCP</description>
                  <res-ref-name>jdbc/poolDB</res-ref-name>
                  <res-type>javax.sql.DataSource</res-type>
                  <res-auth>Container</res-auth>
              </resource-ref>
    
  2. Expand the META-INF node. Right-click the context.xml node, choose Edit from the contextual menu and use the Source Editor to add the following resource link between the <context> tags in the context.xml file:

    <ResourceLink name="jdbc/poolDB" type="javax.sql.DataSource" global="jdbc/poolDB"/>
    

    Note:

    Do not double-click the context.xml file. If you do so, the IDE opens the context.xml file in the Context Editor instead of the Source Editor. You cannot add a resource link in the Context Editor. As you cannot open the context.xml file in both the Source Editor and the Context Editor at the same time, the IDE disables Edit in the contextual menu if the context.xml file is opened in the Context Editor.

    Your web application's META-INF/context.xml file should now look similar to the following:

                <Context path="/Employees">
                  <ResourceLink name="jdbc/poolDB" type="javax.sql.DataSource" 
                   global="jdbc/poolDB"/>
                  <Logger className="org.apache.catalina.logger.FileLogger" 
                   prefix="Employees" suffix=".log" timestamp="true"/>
              </Context>
    
  3. Finally, use the JDBC resource in your web application.

22.7 Working with Web Applications on the Cloud

It is recommended to develop web applications locally and deploy the final application to the cloud, although it is possible to develop web applications directly on cloud-based servers. Developing applications locally has the following advantages:

Note:

To locally develop applications that you will later deploy to the cloud, your local environment must mirror the environment on the cloud.

When your local environment is set up, develop web applications as usual. When the application is complete, deploy it to the cloud environment.

The following task list shows how to develop and deploy to the Cloud.

Task 1   Create an account
  • Create an account with the cloud provider.

Task 2   Register your cloud account in the IDE
  1. Open the Services window.

  2. Right-click the Cloud node.

  3. Select Add Cloud.

  4. Enter your cloud account details.

For more information, see Section 22.7.2, "How to Register a Cloud Account in the IDE."

Task 3   Develop your application locally
  1. Set up your local environment (application and database server) to match the cloud environment.

  2. Create the web application in the local environment, selecting a local server that matches the cloud environment.

  3. Test, debug, and tweak your application using NetBeans IDE tools.

Task 4   Deploy and run the application on the cloud
  1. In the Projects window, right-click the application's node and select Properties.

  2. Select the Run category in the project's Properties.

  3. Select a cloud-based server from the Server drop-down list.(If you registered a cloud account with NetBeans IDE, the servers associated with that account are listed.)

  4. In the Projects window, right-click the project's root node and select Run. The IDE builds the project and deploys it to the cloud, and the application's landing page opens in a browser window.

22.7.1 About Web Applications on the Cloud

NetBeans IDE supports the development of Java web applications on cloud-based servers. The IDE currently supports the following clouds:

  • Oracle Cloud (requires Oracle Cloud plugin)

  • Amazon Elastic Beanstalk

Cloud accounts can be registered in the Services window under the Cloud node.

After you register a cloud account in the IDE, the server associated with that cloud account appears in the Services window under the Servers node. You can treat a server in the cloud like you would treat any other server registered in the IDE.

You cannot create or administer a cloud account from inside the IDE. You must go to the cloud provider's web page to create or administer an account.

For more details about working with cloud providers supported in the IDE, see:

22.7.2 How to Register a Cloud Account in the IDE

To develop and deploy applications to cloud-based servers you need to register your cloud account with the IDE.

To register your cloud account:

  1. If necessary, open the Services window (Ctrl+5).

  2. Right-click the Cloud node in the Services window and select Add Cloud to open the Add Cloud Provider wizard.

  3. Select a cloud provider and click Next.

  4. Specify the details of your cloud account. Click Next.

    When you click Next the IDE attempts to communicate with your cloud account. If communication is successful a list of the resources associated with your cloud account is displayed in the wizard.

  5. Click Finish.

After registering a cloud account, the web/application servers associated with the account appear in the Services window under the Servers node.

22.7.3 How to Develop Cloud Applications Locally

You are recommended to develop web applications locally and deploy the final application to the cloud, although you can develop web applications directly on cloud-based servers. Developing applications locally has the following advantages:

  • Local deployment takes seconds on a running server. Deployment to the Cloud can take minutes.

  • Incremental deployment is only available locally.

  • Debugging is only available locally.

To locally develop applications that you will later deploy to the cloud, your local environment must mirror the environment on the cloud.

When your local environment is set up, develop web applications as usual. When the application is complete, deploy it to the cloud environment.

For more details about working with cloud providers supported in the IDE, see:

22.7.4 How to Deploy Web Applications to the Cloud

To deploy a web application to the cloud, set the application's server to a server on the cloud and run the application.

To deploy your application:

  1. In the Projects window, right-click the application's node and select Properties.

  2. Select the Run category in the project's Properties window.

  3. Select the target server from the Server drop-down list and click OK.

    The remote cloud server will be listed in the drop-down list if the cloud account is registered in the IDE.

    Alternatively, you can select a cloud server when you create the web application and develop it entirely on the cloud. However this is not recommended. See Section 22.7.3, "How to Develop Cloud Applications Locally."

  4. In the Projects window, right-click the project's root node and select Run.

    When you click Run the IDE builds the project and deploys it to the cloud server. You can follow the progress of deployment in the IDE's Output window. The application's landing page opens in a browser window.

22.8 Working with the HTTP Server-Side Monitor

The IDE provides the HTTP Server-Side Monitor to help diagnose problems with data flow from JSP page and servlet execution on the web server. The HTTP Server-Side Monitor gathers data about HTTP requests that are processed by the servlet engine. For each HTTP request that is processed, the monitor records data about the incoming request and the data states maintained on the server.

You can analyze your HTTP requests, store request records for future sessions, and replay and edit previous HTTP requests. HTTP request records are stored until you exit the IDE, unless you explicitly save them.

Additional tools are the profiler and the debugger. For more information, see:

The following task list shows how to work with the HTTP Server-Side Monitor.

Task 1   Set up the HTTP Server-Side Monitor
  1. Ensure that the HTTP Server-Side Monitor is configured correctly.

  2. Ensure that the HTTP Server-Side Monitor is enabled for the web server.

    By default, the HTTP Server-Side Monitor starts when you deploy to the Tomcat Web Server. For the Glassfish application server, go to the Services window (Ctrl+5), expand the Servers node, right-click the server's node, choose Properties, and select the Enable HTTP Monitor checkbox.

Task 2   Analyze Session Data
  1. Run the web application.

  2. Use the HTTP Server-Side Monitor to analyze session data. For more information, see Section 22.8.2, "How to Analyze Session Data."

Task 3   Optional

22.8.1 How to Set up the HTTP Server-Side Monitor

The HTTP Server-Side Monitor is enabled and displayed by default when you deploy to the Tomcat Web Server. For the Glassfish application server, you must enable it manually. If the HTTP Server-Side Monitor does not display or if it does not show the session data for a running web application, ensure that it is enabled as described below.

To manually display the HTTP Server-Side Monitor:

  • Choose Window > Debugging > HTTP Server-Side Monitor from the main menu.

To enable the HTTP Server-Side Monitor for servers that are started from the IDE:

  1. Right-click your server's node in the Services window's Servers node.

  2. Choose Properties.

  3. Select Enable HTTP Monitor.

  4. If the server is running, stop and restart it.

The HTTP Server-Side Monitor is now enabled and will appear when you deploy your application.

To enable the HTTP Server-Side Monitor for servers that are started outside the IDE:

  1. Copy the following two files to your web application's WEB-INF/lib folder.

    • IDE-install-directory/enterprise/modules/ext/org-netbeans-modules-web-httpmonitor.jar

    • IDE-install-directory/ide/modules/org-netbeans-modules-schema2beans.jar

    The Glassfish application server has its own schema2beans.jar. Therefore, when you are using the Glassfish application server, only copy httpmonitor.jar to your web application's WEB-INF/lib folder.

  2. Add the filter declaration that is appropriate for your servlet's version to the top of your web application's WEB-INF/web.xml file. Filters and filter mapping entries must come first in a deployment descriptor.

    • Servlet 2.4 Filter Declaration:

        <filter>
          <filter-name>HTTPMonitorFilter</filter-name>
          <filter-class>org.netbeans.modules.web.monitor.server.MonitorFilter</filter-class>
          <init-param>
            <param-name>netbeans.monitor.ide</param-name>
            <param-value>name-of-host-that-runs-IDE:port-of-internal-HTTP-server
            </param-value>
          </init-param>
        </filter>
        <filter-mapping>
          <filter-name>HTTPMonitorFilter</filter-name>
          <url-pattern>/*</url-pattern>
          <dispatcher>REQUEST</dispatcher>
          <dispatcher>FORWARD</dispatcher>
          <dispatcher>INCLUDE</dispatcher>
          <dispatcher>ERROR</dispatcher>
        </filter-mapping>
      
    • Servlet 2.3 Filter Declaration:

        <filter>
          <filter-name>HTTPMonitorFilter</filter-name>
          <filter-class>org.netbeans.modules.web.monitor.server.MonitorFilter</filter-class>
          <init-param>
            <param-name>netbeans.monitor.ide</param-name>
            <param-value>name-of-host-that-runs-IDE:port-of-internal-HTTP-server
            </param-value>
          </init-param>
        </filter>
        <filter-mapping>
          <filter-name>HTTPMonitorFilter</filter-name>
          <url-pattern>/*</url-pattern>
        </filter-mapping>
      
  3. To monitor the data records from a web application using more than one IDE, add a second init-param entry as follows:

      <init-param>
      <param-name>netbeans.monitor.register</param-name>
      <param-value>
      other-IDE-host:other-HTTP-server-port,
      another-IDE-host:another-HTTP-server-port</param-value>
      </init-param>
    

Tip:

When you deploy the web application to a production server, remember to remove the jar files from your WEB-INF/lib folder and remove the filter and filter mapping declarations from the web application's deployment descriptor.

22.8.2 How to Analyze Session Data

After you have setup the HTTP Server-Side Monitor, you can use it to debug your web application by observing data flow from your JSP page and servlet execution on the server. The HTTP Server-Side Monitor records data about each incoming request.

To analyze session data:

  1. Run a web application.

  2. Click the HTTP Server-Side Monitor.

  3. Select any HTTP request in the tree view to view its information in the display panel.

The HTTP Server-Side Monitor consists of two panels. On the left is a tree view of HTTP request records. On the right is a display panel that presents the session data associated with the selected HTTP request records.

The tree view

In the tree view, the All Records category contains two subcategories: Current Records and Saved Records. Individual HTTP request records reside in either of these sub-categories. They are accompanied by the following icons:

  • Get method Get method

  • Post method Post method

Each method icon includes a badge based upon the value of the response status code:

Badge Description

Information

1xx - Information

None

2xx or the value could not be determined.
In the latter case, this normally means that the request has succeeded (200 - OK)

Warning

3xx - Warning

Error

400 - Error


The request's method type and status code are also displayed in the display panel's Request tab. For a full description of each of the status codes, see Section 10, "Status Code Definitions" of the Hypertext Transfer Protocol -- HTTP/1.1 available from the World Wide Web Consortium (W3C) at http://www.w3.org/Protocols/rfc2616/rfc2616.html.

Requests resulting in an internal dispatch cause nested nodes on servers that support this functionality. The forwarded or included requests are nested under the node corresponding to the main requests.

Entries in Current Records are available only during the current IDE session. Current HTTP request records persist across restarts of the server. They are cleared whenever you exit the IDE, or when you explicitly delete them. Entries in Saved Records persist until you delete them. Records in all categories can be sorted according to various criteria using the buttons above the tree view:

Icon Description

Reloads the HTTP request records

Reloads all the HTTP request records stored on the client.

Sort timestamps in descending order

Sorts the HTTP request records by timestamp in descending order.

Sort HTTP request records in ascending order

Sorts the HTTP request records by timestamp in ascending order.

sorts alphabetically

Sorts the HTTP request records alphabetically.

Show or hide timestamps

Shows or hides the time stamps in the list of HTTP request records.


Tip:

If the HTTP Server-Side Monitor does not show the HTTP request records for a running web module, verify that the monitor is enabled for your web server by right-clicking your web server's node in the Services window's Servers node and choosing Properties from the contextual menu. The Enable HTTP Monitor checkbox should be selected.

The display panel

When you select a HTTP request record in the tree view on the left, the session data corresponding to that HTTP request record appears in the display panel on the right.

22.8.3 How to Save Session Data

The HTTP request records that are in the tree view's Current Records node are available only during the current IDE session. Current HTTP request records persist across restarts of the server. They are cleared whenever you exit the IDE, or when you explicitly delete them. Entries in the Saved Records node persist until you delete them

You can save the HTTP request records that are in the Current Records node of the tree view. This action lets you view or replay the HTTP request in a later IDE session.

To save session data:

  1. Right-click the HTTP request record to be saved. You can select multiple records at one time by using the Shift or Control keys.

  2. Choose Save from the contextual menu.

    The selected records are moved, not copied, to the Saved Records subcategory.

22.8.4 How to Replay Session Data

You can replay HTTP requests that are associated with the current and saved HTTP request records. When you replay a request, the response appears in the web browser.

Notes:

  • If the server or the web application is not running, an error message is displayed. If this happens, re-execute the application on a running target server.

  • If the server or the web application is not running, an error message is displayed. If this happens, re-execute the application on a running target server.

  • If a servlet or JSP page reads data directly from the ServletInputStream, instead of using methods from the getParameter family, requests to that resource will not replay correctly.

To edit HTTP requests before replaying them:

  1. In the tree view on the left side of the HTTP Server-Side Monitor, right-click the HTTP request record that you want to edit and replay.

  2. Choose Edit and Replay from the contextual menu. The Edit and Replay dialog box appears.

In the Edit and Replay dialog box, you can do the following:

To edit requests:

  1. Click the Request tab.

  2. Edit the request:

    • To edit the Request URI parameter or the Protocol parameter, click the ellipsis (...) button next to the parameter.

    • To change the request method, select the desired method from the combo box in the Method parameter. For instance, change GET to POST.

  3. Click Send HTTP Request.

To edit cookies:

  1. Click the Cookies tab.

  2. Edit the cookie:

    • To add a cookie, click Add Cookie. The Add Cookie dialog box appears. Type a name and value, and click OK.

    • To edit a cookie, click the ellipsis (...) button next to the cookie.

    • To delete a cookie, select the cookie and click Delete Cookies. Use the Shift or Control key to select multiple cookies for deletion.

  3. Click Send HTTP Request.

    Note:

    Not all servers support the editing of cookies. The server ignores the values that were saved when the record was recorded, and the server uses the cookie that the browser generates. If the record header does not include a session cookie, the browser does not send a cookie. Although you can edit session cookies, the changes do not take effect on most servers. The reason is because the session's cookie ID is read before the request enters the servlet container.

To edit servers:

  1. Click the Server tab.

  2. Edit the server. To change a parameter's value, such as the hostname of servlet engine or the port number of an HTTP service click the ellipsis (...) button next to the parameter.

  3. Click Send HTTP Request.

To edit headers:

  1. Click the Headers tab.

  2. Edit the header.

    • To add a header, click Add Header. The Add Header dialog box appears. Type in a name and value and click OK.

    • To edit a header parameter such as Accept, Connection, Host, or User-Agent, click the ellipsis (...) button next to the parameter.

    • To delete a header, select it and click Delete Headers. Use the Shift or Control key to select multiple headers for deletion.

  3. Click Send HTTP Request.