I'm using glassfish server 3.1.2 and jsf 2.1. Based on sitemaps.org standarts, sitemap file of entire web site should be in root folder. I will have multiple sitemaps and sitemap will change dynamically after i create new entries. I have read there, i want to use alternate docroot. But i can't create alternate docroot for root directory. I should find a solution as like as alternate docroot.
Asked
Active
Viewed 650 times
0
-
stackoverflow said that Your question couldn't be submitted because: It does not meet our quality standards. then i make my question more unreadable and posted it successfully !!!!!!!!!!! – Deniz Nov 06 '12 at 01:00
-
Your question lacks capitalization. In English (and all other latin based languages), sentences start with an uppercase and the word "I" is also to be written in uppercase. Those are the major triggers for the quality filter. Please try to pay more attention to this. In other words, *try* to not write like a teen in a chatbox, but instead as a professional programmer. You don't need to be a linguistic genius, just start sentences with an uppercase and write "I" as such. Using capitalization properly is a rather little effort which will give your post a relatively enormous boost in readability. – BalusC Nov 06 '12 at 02:09
-
my words and sentences are very understandable. i spent 1 hour to overcome these unnecessary validations and i'm still angry. only school boys need rules that you said. professional programmers can understand well if we don't start sentences with uppercase after dot. – Deniz Nov 06 '12 at 14:16
-
I'm just explaining why the quality filter kicked in and how you could avoid that. I didn't said that your question is not understandable, just that it is harder to quickly read as it's formulated in an unprofessional way. I understood your question perfectly fine, but I admit that it costs a little more effort and time, because I have to re-read some parts again. – BalusC Nov 06 '12 at 14:17
-
which parts did you mean i don't know but as i said, i added unnecessary sentences to my question for posting it. whatever, i will edit now – Deniz Nov 06 '12 at 14:33
-
That's better. Back to the concrete question: Where exactly are those sitemaps located? How exactly does the sitemap change dynamically? Are you autogenerating the XML file or so? – BalusC Nov 06 '12 at 14:42
-
I will autogenerate with sitemapgen4j frequently: http://code.google.com/p/sitemapgen4j/ . As far as i know, sitemaps must be located in webapp's root folder. – Deniz Nov 06 '12 at 14:52
1 Answers
2
You could create a simple servlet to perform the job.
@WebServlet("/sitemap.xml")
public class SitemapServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/xml");
// You might want to add finer grained browser cache related headers.
InputStream input = new FileInputStream("/some/path/to/sitemap.xml");
OutputStream output = response.getOutputStream();
// Now just write input to output using your favorite way.
// ...
}
}
-
do you have a example for jsf , or can i use this servlet on a springboot primefaces app ? – Cesar Jan 16 '20 at 09:07