Java Webserver
Starting the java web server
c:\javaWebserver2.0\bin\httpd
Accessing the admin
http://localhost:9090/
If you Forgot your Admin Password...
-
Stop your Java Web Server. (see next 2 tips)
-
In your favorite text editor, open the file server_root/realms/data/adminRealm/keyfile
-
Change the admin line there so that it reads: admin::YWRtaW4=
-
Save the file.
-
Restart your Java Web Server.
You should now be able to access the Administration Tool using admin as
the login and password.
Stopping/Shutting down the java webserver from the Admin tool
-
log in as administrator
-
choose shut down (option is towards the end of the page)
Stopping/Shutting down the java webserver from the command prompt
c:\javaWebserver2.0\bin\jsadmin user/password -stop
Changing name and password of Admin
Go to Admin tool : properties
Choose tabbed pane "Admin Password"
Changing the External port of Admin (default is 9090)
Go to Admin tool : properties
Choose tabbed pane "External Port"
* The internal port at which the admin listen can also be changed.
Changing the port fot HTTP (def:8080) and HTTPS (def:7070)
Service name --> Manage -->Setup --> Network
Changing the Doc root directory (def: server_dir/public_html)
Service name --> Manage -->Setup --> Site-->contents
Servlet directory...
c:\javaWebserver2.0\servlets
Installing the Servlet
The process for installing a servlet into a web server varies from
web server to webserver. For the Java Web
Server, the procedure is as follows:
-
Start the Java Web Server, if it is not already running
-
Log in to the Java Web Server on the administration port. By default, the
administration port is 9090 and the username/password is admin/admin. If
you are successful, you should see the services page of the AdminTool applet.
-
Select the WebPage Service then click the Manage button. This should bring
up the Web Service window.
-
Click the Servlets button, then select the Add entry in the list in the
lefthand pane. You should now see the Add a New
Servlet fields in the righthand pane.
-
Fill in the fields as follows:
-
Servlet Name: Choose any name you like, it need not be related to
the filename. This will be the name used to invoke the servlet. We'll use
FirstServlet.
-
Servlet Class: Provide the actual name of the servlet class, not
file, you created -- for this example the real name is MyFirst.
-
Click the Add button and you will see your servlet name appear in
the list of servlets in the lefthand pane under Configure.
The righthand pane will have changed to two tabbed panels -- Configuration
and Properties. We won't need these for our simple example so simply close
the window.
Configuring and Specifying Parameters to a Servlet
service name--> manage --> servlets --> configure
Configuration includes specifying values for fields load at startup,
loaded now, loaded remotely, URL for remote servlet class.
The properties tabbed can be used to specify properties to the servlet.
Loading the Servlet...
While entering details for the new servlet options are there to load
the servlet instantly or at start up.
Testing Your Servlet...
http://localhost:8080/servlet/MyFirst
Filtering and Servlet Chaining:
If internal servlets that provide java webserver's own functionality
are to be used in the servlet chaining for filtering then they must be
first in the chain.
Steps in setting up servlet chaining:
-
enable chaining : Choose Enabled Chain from setup-->site-->Options
-
establish the servlet by using servlet aliases or MIME type:
-
using servlet aliases: use Servlet Aliasing subsection of setup
option
in the administration tool to set a list of servlets for a specifed URL
request. (service --> manage --> setup --> Servlet Aliasing)
-
using mime type : when a servlet sends a response it first sets the MIME
type. If chaining is done using MIME type then the outputStream of servlets
with that MIME type becomes the InputStream of the next servlet in the
chain. There is no admin tool option to set up servlet chaining by
MIME type. The file c:\javawebServer2.0\properties\service_defaults\webpageservice\mimeservlets.properties
must
be modifed to include the MIME-type=servletname entry.
Servlets Loading
-
put the class file in the server_root/classes directory. This directory
is in the CLASSPATH of the java web server
-
servlet classes are droppped in the server_root/servlets directory
-
load from a remote location ( the path is specified while configuring the
servlet using administrative tool)
Passing Initial values to servlets..
-
In the server_root/servlets directory put the file MyServletClass.initArgs
with arguments of the form variable=value, to pass init arguments to the
servlet whose class is MyServletClass.Whenever the servlet classes in this
directory is recompiled the Server reloads the corresponding servlets.
-
Choose the Servlets Icon from the Service Window and choose/add the servlet.
Choose the Properties tabbed pane to set initial arguments.
Serving up Documents
service -->manage -->setup-->site-->contents
server_root\public_html directory (default)
File Aliases
Short-Cut names can be provided for files in the doc-root directory
or any other directory.
For example:
Alias |
File Pathname |
/member |
c:\servlet\One\form.html |
Servlet Aliases:
Lengthy URLs to can be mapped to servlets.
For Example:
URL |
Servlet |
/newFilter.html |
filter1.filter2 |