本文整理汇总了Java中com.redfin.sitemapgenerator.WebSitemapGenerator类的典型用法代码示例。如果您正苦于以下问题:Java WebSitemapGenerator类的具体用法?Java WebSitemapGenerator怎么用?Java WebSitemapGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebSitemapGenerator类属于com.redfin.sitemapgenerator包,在下文中一共展示了WebSitemapGenerator类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: genRecommendations
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
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();
}
开发者ID:StubbornJava,项目名称:StubbornJava,代码行数:17,代码来源:StubbornJavaSitemapGenerator.java
示例2: addUrlsTo
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
@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);
}
}
}
开发者ID:edulify,项目名称:play-sitemap-module.edulify.com,代码行数:18,代码来源:AnnotationUrlProvider.java
示例3: genPosts
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
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();
}
开发者ID:StubbornJava,项目名称:StubbornJava,代码行数:15,代码来源:StubbornJavaSitemapGenerator.java
示例4: genGuides
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
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();
}
开发者ID:StubbornJava,项目名称:StubbornJava,代码行数:15,代码来源:StubbornJavaSitemapGenerator.java
示例5: genTags
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
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();
}
开发者ID:StubbornJava,项目名称:StubbornJava,代码行数:16,代码来源:StubbornJavaSitemapGenerator.java
示例6: genLibraries
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
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();
}
开发者ID:StubbornJava,项目名称:StubbornJava,代码行数:15,代码来源:StubbornJavaSitemapGenerator.java
示例7: addUrl
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
private void addUrl(WebSitemapGenerator generator, URL url) {
WebSitemapUrl webSiteUrl = new WebSitemapUrl
.Options(url)
.lastMod(new Date())
.priority(1.0)
.changeFreq(frequency)
.build();
generator.addUrl(webSiteUrl);
}
开发者ID:openfigis,项目名称:sharks,代码行数:10,代码来源:SitemapXmlGenerator.java
示例8: generateSitemap
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
@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();
}
}
开发者ID:JakduK,项目名称:jakduk-api,代码行数:16,代码来源:SitemapTest.java
示例9: should_generate_sitemap_file
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
@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();
}
开发者ID:edulify,项目名称:play-sitemap-module.edulify.com,代码行数:9,代码来源:AnnotationUrlProviderTest.java
示例10: should_generate_sitemap_with_url_for_annotated_action
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
@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>");
}
开发者ID:edulify,项目名称:play-sitemap-module.edulify.com,代码行数:13,代码来源:AnnotationUrlProviderTest.java
示例11: getSitemapGenerator
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
protected WebSitemapGenerator getSitemapGenerator(String filePrefix) throws IOException, URISyntaxException {
File myDir = getSitemapDirFile();
myDir.mkdirs();
return WebSitemapGenerator.builder(getBaseUrl(), myDir).fileNamePrefix(filePrefix).dateFormat(config.getDateFormat()).gzip(config.isGzip()).build();
}
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:6,代码来源:SitemapGenerator.java
示例12: toXml
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
private String toXml(WebSitemapGenerator generator)
{
StringBuilder sb = new StringBuilder();
for (String line:generator.writeAsStrings()) sb.append(line);
return sb.toString();
}
开发者ID:openfigis,项目名称:sharks,代码行数:7,代码来源:SitemapXmlGenerator.java
示例13: addUrlsTo
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
/**
* Receives a sitemap generator and add urls to it.
*
* @param generator the web site generator
*/
void addUrlsTo(WebSitemapGenerator generator);
开发者ID:edulify,项目名称:play-sitemap-module.edulify.com,代码行数:7,代码来源:UrlProvider.java
示例14: getWsg
import com.redfin.sitemapgenerator.WebSitemapGenerator; //导入依赖的package包/类
public WebSitemapGenerator getWsg() { return wsg; }
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:2,代码来源:SitemapGenerator.java
注:本文中的com.redfin.sitemapgenerator.WebSitemapGenerator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论