Test your basic authentication servlet
A servlet can use basic authentication to log in to PolicyCenter. This procedure shows you how to test a basic authentication servlet.
Before you begin
mycompany.test.TestingServlet servlet, as shown in Example of a basic authentication servlet. To test the servlet, you must use a tool that supports adding HTTP basic authentication headers for the user name and password.Procedure
-
Run the QuickStart server with the following command:
gwb runServer -
Test the servlet at the URL:
http://localhost:8180/pc/service/testThe text
"/test"in the URL is the part that matches the servlet string. Change the port number and the server name to match your PolicyCenter application. -
In the authentication dialog box that appears, type valid login credentials.
The following text appears on the page:
I am the page /testThe following messages appear in the console in Studio:
servlet test url: /pc/service/test query string: null -
Test additional pages:
http://localhost:8180/pc/service/test/is/this/working?param=valueThe following text appears on the page:
I am the page /test/is/this/workingThe following messages appear in the console in Studio:
servlet test url: /pc/service/test query string: param=value -
To test the HTTP basic authentication without using the default login dialog:
- Close your browser to remove the session context.
- Re-test your servlet, using a tool that supports adding HTTP headers for HTTP basic authentication.
