/*
 * Copyright 2016 Fendler Consulting cc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.jensfendler.ninjasitemap;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jensfendler.ninjasitemap.controller.NinjaSitemapController;

import ninja.Router;
import ninja.application.ApplicationRoutes;
import ninja.utils.NinjaProperties;

/**
 * @author Jens Fendler
 *
 */
public class NinjaSitemapRoutes implements ApplicationRoutes {

	private static final Logger LOG = LoggerFactory.getLogger(NinjaSitemapRoutes.class);

	@SuppressWarnings("unused")
	private NinjaProperties ninjaProperties;

	/**
	 * @see ninja.application.ApplicationRoutes#init(ninja.Router)
	 */
	@Override
	public void init(Router router) {
		LOG.info("Installing Ninja Sitemap routes.");
		router.GET().route("/sitemap.xml").with(NinjaSitemapController.class, "getSitemapXml");
	}

}

@@ -970,24 +970,29 @@
 utes %7B%0A%0A
-%09priva
+    protec
 te
+d
  static 
@@ -1066,45 +1066,174 @@
 );%0A%0A
-%09@SuppressWarnings(%22unused%22)%0A%09private
+    protected static final String KEY_SITEMAP_ROUTE = %22ninja.sitemap.route%22;%0A%0A    protected static final String DEFAULT_SITEMAP_ROUTE = %22/sitemap.xml%22;%0A%0A    protected
  Nin
@@ -1267,14 +1267,20 @@
 s;%0A%0A
-%09/**%0A%09
+    /**%0A    
  * @
@@ -1342,14 +1342,20 @@
 er)%0A
-%09 */%0A%09
+     */%0A    
 @Ove
@@ -1360,17 +1360,20 @@
 verride%0A
-%09
+    
 public v
@@ -1398,18 +1398,128 @@
 uter) %7B%0A
-%09%09
+        String sitemapRoute = ninjaProperties.getWithDefault(KEY_SITEMAP_ROUTE, DEFAULT_SITEMAP_ROUTE);%0A        
 LOG.info
@@ -1555,15 +1555,38 @@
 utes
-.%22);%0A%09%09
+: %7B%7D%22, sitemapRoute);%0A        
 rout
@@ -1600,30 +1600,28 @@
 ).route(
-%22/
 sitemap
-.xml%22
+Route
 ).with(N
@@ -1671,9 +1671,12 @@
 %22);%0A
-%09
+    
 %7D%0A%0A%7D

Support for configurable route to sitemap.xml.