public static String getReletiveURL(HttpServletRequest req) {
    return req.getContextPath() + req.getServletPath() + req.getPathInfo();
  }
public static String getReletiveURL(HttpServletRequest req) {
    return req.getContextPath() + req.getServletPath() + req.getPathInfo();
  }
public static String getReletiveURL ( HttpServletRequest req ) { return req . getContextPath ( ) + req . getServletPath ( ) + req . getPathInfo ( ) ; }
Return the request URL relative to the server (i.e., starting with the context path).

@param req request
@return URL relative to the server
Return the request URL relative to the server ( i . e . starting with the context path ) .