Hello folks,
I have a doubt on the chapter 12 of the book Head-First
Servlets and
JSP, I tried to do an authentication example in agreement with the book but I don't get to call the standard form of the browser, it follows the example
in tomcat-users.xml ********************************************
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="Guest"/>
<role rolename="Adm"/>
<role rolename="Member"/>
<user username="Annie" password="admin" roles="Adm,Member,Guest"/>
<user username="Diane" password="coder" roles="Member,Guest"/>
<user username="Ted" password="newBie" roles="Guest"/>
</tomcat-users>
in web.xml in my application, called Beer *********************************
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>teste</servlet-name>
<servlet-class>AddRecipe.servletTeste</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>teste</servlet-name>
<url-pattern>/t.do</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>UpdateRecipes</web-resource-name>
<url-pattern>/Beer/*</url-pattern>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<realm-name></realm-name>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name>Adm</role-name>
</security-role>
</web-app>
and it follows the structure of pastes used in the application ************
-->webapps
-->Beer (with. jsp that calls a servlet through method get)
-->WEB-INF (with web.xml)
-->classes
-->AddRecipe (with servlet.class)
obs: It�s works, but I don't get to call the form of authentication of the browser