?? protectedservlet.java
字號(hào):
package com.wrox.servlets;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.security.*;
public class ProtectedServlet extends HttpServlet {
public void init(ServletConfig cfg) throws ServletException {
super.init(cfg);
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException {
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
String authType = req.getAuthType();
out.println("You are authorized to view this page");
out.println("You were authenticated using: " + authType
+ " method of authentication");
Principal princ = req.getUserPrincipal();
out.println("The user is: " + princ.getName());
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -