UrlRedirect.java Source code

Java tutorial

Introduction

Here is the source code for UrlRedirect.java

Source

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UrlRedirect extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, java.io.IOException {
        String contextPath = "http://www.java2s.com";
        response.sendRedirect(response.encodeRedirectURL(contextPath + "/maps"));
    }
}