protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { StringBuffer requestURL = request.getRequestURL(); System.out.println("Request URL: " + requestURL.toString()); }In this example, the getRequestURL method is called within a servlet's doGet method to get the requested URL and print it to the console. The javax.servlet.http.HttpServletRequest class is part of the Java EE (Enterprise Edition) library, specifically the servlet-api package.