Class AbstractSitemapGenerator

    • Constructor Detail

      • AbstractSitemapGenerator

        public AbstractSitemapGenerator​(String baseUrl)
    • Method Detail

      • constructSitemap

        public abstract String[] constructSitemap()
      • constructSitemapString

        public String constructSitemapString()
        Construct sitemap into single String
        Returns:
        sitemap
      • constructSitemapGzip

        public byte[] constructSitemapGzip()
        Construct sitemap into gzipped file
        Returns:
        byte array
      • saveSitemap

        public void saveSitemap​(File file,
                                String[] sitemap)
                         throws IOException
        Save sitemap to output file
        Parameters:
        file - Output file
        sitemap - Sitemap as array of Strings (created by constructSitemap() method)
        Throws:
        IOException - when error
      • constructAndSaveSitemap

        public void constructAndSaveSitemap​(File file)
                                     throws IOException
        Construct and save sitemap to output file
        Parameters:
        file - Output file
        Throws:
        IOException - when error
      • pingGoogle

        public void pingGoogle​(String sitemapUrl)
        Ping Google that sitemap has changed. Will call this URL: http://www.google .com/webmasters/tools/ping?sitemap=URL_Encoded_sitemapUrl
        Parameters:
        sitemapUrl - sitemap url
      • pingBing

        public void pingBing​(String sitemapUrl)
        Ping Bing that sitemap has changed. Will call this URL: http://www.bing.com/ping?sitemap=URL_Encoded_sitemapUrl
        Parameters:
        sitemapUrl - sitemap url
      • pingGoogle

        public void pingGoogle()
        Ping Google that sitemap has changed. Sitemap must be on this location: baseUrl/sitemap.xml (for example http://www.javavids.com/sitemap.xml)
      • pingBing

        public void pingBing()
        Ping Google that sitemap has changed. Sitemap must be on this location: baseUrl/sitemap.xml (for example http://www.javavids.com/sitemap.xml)
      • escapeXmlSpecialCharacters

        protected String escapeXmlSpecialCharacters​(String url)
        Escape special characters in XML
        Parameters:
        url - Url to be escaped
        Returns:
        Escaped url