import javax.servlet.http.HttpServletRequest; public class DemoServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String scheme = request.getScheme(); System.out.println("Scheme: " + scheme); } }In this example, the getScheme() method is used to retrieve the scheme of the request and print it to console. This method is provided by the javax.servlet.http package/library.