RSS FEED default servlet for every page
Hello guys,
I want to create a RSS component for every page.
Iam not sure I am thinking the right way.
I want to write a servlet which returns xml of the actual node and give the title, the description and the modify date as RSS-XML to the user. But I don't know how to write one servlet which is called for every page under:
- example.com/examplepage.rss.xml
- example.com/examplepage1.rss.xml
- example.com/examplepage2.rss.xml
- ...
the servlet should be callable as default for every page.
How can I achieve this? Can someone point me in the right direction.
up to now I have the following servlet which renders for a specific resoureType but I am searching for a wildcard or something to call it for every path or specific root path and all of its children.
@SuppressWarnings("serial")
@SlingServlet(resourceTypes = "geometrixx/components/homepage",
selectors = "rss",
extensions = "xml",
methods = "GET",
metatype =true)public class SimpleServlet extends SlingSafeMethodsServlet {
@Reference
private Repository repository;
@Override
protected void doGet(final SlingHttpServletRequest req,
final SlingHttpServletResponse resp) throws ServletException, IOException {resp.setContentType("application/json");
String keys[] = repository.getDescriptorKeys();
JSONObject jsonobject = new JSONObject();
try {jsonobject.put("test", "testvalue");
} catch (JSONException e) {e.printStackTrace();
}resp.getWriter().println(jsonobject.toString());
}