com.redfin.sitemapgenerator.WebSitemapGenerator Java Examples
The following examples show how to use
com.redfin.sitemapgenerator.WebSitemapGenerator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StubbornJavaSitemapGenerator.java From StubbornJava with MIT License | 6 votes |
private static List<String> genRecommendations() throws MalformedURLException { WebSitemapGenerator wsg = new WebSitemapGenerator(HOST); List<String> recommendations = Lists.newArrayList( "java-libraries" , "best-selling-html-css-themes-and-website-templates" ); for (String recommendation : recommendations) { String url = HttpUrl.parse(HOST) .newBuilder() .addPathSegment(recommendation) .build() .toString(); wsg.addUrl(url); } return wsg.writeAsStrings(); }
Example #2
Source File: AnnotationUrlProvider.java From play-sitemap-module.edulify.com with Apache License 2.0 | 6 votes |
@Override public void addUrlsTo(WebSitemapGenerator generator) { String baseUrl = configuration.getString("sitemap.baseUrl"); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Reflections reflections = new Reflections("controllers", new MethodAnnotationsScanner()); Set<Method> actions = reflections.getMethodsAnnotatedWith(SitemapItem.class); for(Method method : actions) { String actionUrl = actionUrl(classLoader, method); SitemapItem annotation = method.getAnnotation(SitemapItem.class); if(annotation != null) { WebSitemapUrl url = webSitemapUrl(baseUrl, actionUrl, annotation); generator.addUrl(url); } } }
Example #3
Source File: StubbornJavaSitemapGenerator.java From StubbornJava with MIT License | 6 votes |
private static List<String> genRecommendations() throws MalformedURLException { WebSitemapGenerator wsg = new WebSitemapGenerator(HOST); List<String> recommendations = Lists.newArrayList( "java-libraries" , "best-selling-html-css-themes-and-website-templates" ); for (String recommendation : recommendations) { String url = HttpUrl.parse(HOST) .newBuilder() .addPathSegment(recommendation) .build() .toString(); wsg.addUrl(url); } return wsg.writeAsStrings(); }
Example #4
Source File: StubbornJavaSitemapGenerator.java From StubbornJava with MIT License | 5 votes |
private static List<String> genGuides() throws MalformedURLException { WebSitemapGenerator wsg = new WebSitemapGenerator(HOST); List<GuideTitle> guides = Guides.findTitles(); for (GuideTitle guide : guides) { String url = HttpUrl.parse(HOST) .newBuilder() .addPathSegment("guides") .addPathSegment(guide.getSlug()) .build() .toString(); wsg.addUrl(url); } return wsg.writeAsStrings(); }
Example #5
Source File: AnnotationUrlProviderTest.java From play-sitemap-module.edulify.com with Apache License 2.0 | 5 votes |
@Test public void should_generate_sitemap_with_url_for_annotated_action() throws Exception { WebSitemapGenerator generator = new WebSitemapGenerator("http://localhost:9000", baseDir); AnnotationUrlProvider provider = application.injector().instanceOf(AnnotationUrlProvider.class); provider.addUrlsTo(generator); generator.write(); String content = FileUtils.readFileToString(new File(baseDir, "sitemap.xml")); Assertions.assertThat(content).contains("<loc>http://localhost:9000/index</loc>"); Assertions.assertThat(content).contains("<changefreq>monthly</changefreq>"); Assertions.assertThat(content).contains("<priority>0.8</priority>"); }
Example #6
Source File: AnnotationUrlProviderTest.java From play-sitemap-module.edulify.com with Apache License 2.0 | 5 votes |
@Test public void should_generate_sitemap_file() throws Exception { WebSitemapGenerator generator = new WebSitemapGenerator("http://localhost:9000", baseDir); AnnotationUrlProvider provider = application.injector().instanceOf(AnnotationUrlProvider.class); provider.addUrlsTo(generator); generator.write(); Assertions.assertThat(new File(baseDir, "sitemap.xml")).exists(); }
Example #7
Source File: SitemapTest.java From jakduk-api with MIT License | 5 votes |
@Test public void generateSitemap() { try { WebSitemapGenerator wsg = new WebSitemapGenerator("https://jakduk.com"); WebSitemapUrl url = new WebSitemapUrl.Options("https://jakduk.com/board/free/1") .lastMod(new Date()).priority(1.0).changeFreq(ChangeFreq.DAILY).build(); wsg.addUrl(url); Assert.assertTrue(! ObjectUtils.isEmpty(wsg.writeAsStrings())); } catch (MalformedURLException e) { e.printStackTrace(); } }
Example #8
Source File: StubbornJavaSitemapGenerator.java From StubbornJava with MIT License | 5 votes |
private static List<String> genLibraries() throws MalformedURLException { WebSitemapGenerator wsg = new WebSitemapGenerator(HOST); List<JavaLib> libraries = Seq.of(JavaLib.values()).toList(); for (JavaLib lib : libraries) { String url = HttpUrl.parse(HOST) .newBuilder() .addPathSegment("java-libraries") .addPathSegment(lib.getName()) .build() .toString(); wsg.addUrl(url); } return wsg.writeAsStrings(); }
Example #9
Source File: StubbornJavaSitemapGenerator.java From StubbornJava with MIT License | 5 votes |
private static List<String> genTags() throws MalformedURLException { WebSitemapGenerator wsg = new WebSitemapGenerator(HOST); List<Tag> tags = Tags.getTags(); for (Tag tag : tags) { String url = HttpUrl.parse(HOST) .newBuilder() .addPathSegment("tags") .addPathSegment(tag.getName()) .addEncodedPathSegment("posts") .build() .toString(); wsg.addUrl(url); } return wsg.writeAsStrings(); }
Example #10
Source File: StubbornJavaSitemapGenerator.java From StubbornJava with MIT License | 5 votes |
private static List<String> genPosts() throws MalformedURLException { WebSitemapGenerator wsg = new WebSitemapGenerator(HOST); List<String> slugs = Posts.getAllSlugs(); for (String slug: slugs) { String url = HttpUrl.parse(HOST) .newBuilder() .addPathSegment("posts") .addPathSegment(slug) .build() .toString(); wsg.addUrl(url); } return wsg.writeAsStrings(); }
Example #11
Source File: StubbornJavaSitemapGenerator.java From StubbornJava with MIT License | 5 votes |
private static List<String> genPosts() throws MalformedURLException { WebSitemapGenerator wsg = new WebSitemapGenerator(HOST); List<String> slugs = Posts.getAllSlugs(); for (String slug: slugs) { String url = HttpUrl.parse(HOST) .newBuilder() .addPathSegment("posts") .addPathSegment(slug) .build() .toString(); wsg.addUrl(url); } return wsg.writeAsStrings(); }
Example #12
Source File: StubbornJavaSitemapGenerator.java From StubbornJava with MIT License | 5 votes |
private static List<String> genLibraries() throws MalformedURLException { WebSitemapGenerator wsg = new WebSitemapGenerator(HOST); List<JavaLib> libraries = Seq.of(JavaLib.values()).toList(); for (JavaLib lib : libraries) { String url = HttpUrl.parse(HOST) .newBuilder() .addPathSegment("java-libraries") .addPathSegment(lib.getName()) .build() .toString(); wsg.addUrl(url); } return wsg.writeAsStrings(); }
Example #13
Source File: StubbornJavaSitemapGenerator.java From StubbornJava with MIT License | 5 votes |
private static List<String> genTags() throws MalformedURLException { WebSitemapGenerator wsg = new WebSitemapGenerator(HOST); List<Tag> tags = Tags.getTags(); for (Tag tag : tags) { String url = HttpUrl.parse(HOST) .newBuilder() .addPathSegment("tags") .addPathSegment(tag.getName()) .addEncodedPathSegment("posts") .build() .toString(); wsg.addUrl(url); } return wsg.writeAsStrings(); }
Example #14
Source File: StubbornJavaSitemapGenerator.java From StubbornJava with MIT License | 5 votes |
private static List<String> genGuides() throws MalformedURLException { WebSitemapGenerator wsg = new WebSitemapGenerator(HOST); List<GuideTitle> guides = Guides.findTitles(); for (GuideTitle guide : guides) { String url = HttpUrl.parse(HOST) .newBuilder() .addPathSegment("guides") .addPathSegment(guide.getSlug()) .build() .toString(); wsg.addUrl(url); } return wsg.writeAsStrings(); }
Example #15
Source File: SitemapGenerator.java From scipio-erp with Apache License 2.0 | 4 votes |
protected WebSitemapGenerator getSitemapGenerator(String filePrefix) throws IOException { File myDir = getSitemapDirFile(); myDir.mkdirs(); return WebSitemapGenerator.builder(getBaseUrl(), myDir).fileNamePrefix(filePrefix).dateFormat(sitemapConfig.getDateFormat()).gzip(sitemapConfig.isGzip()).build(); }
Example #16
Source File: UrlProvider.java From play-sitemap-module.edulify.com with Apache License 2.0 | 2 votes |
/** * Receives a sitemap generator and add urls to it. * * @param generator the web site generator */ void addUrlsTo(WebSitemapGenerator generator);
Example #17
Source File: SitemapGenerator.java From scipio-erp with Apache License 2.0 | votes |
public WebSitemapGenerator getWsg() { return wsg; }