Glassfishサーバー3.1.2とjsf2.1を使用しています。sitemaps.orgの標準に基づいて、Webサイト全体のサイトマップファイルはルートフォルダにある必要があります。複数のサイトマップがあり、新しいエントリを作成するとサイトマップが動的に変更されます。私はそこで読んだことがあります、私は代替のdocrootを使いたいです。しかし、ルートディレクトリの代替docrootを作成できません。代替のdocrootのような解決策を見つける必要があります。
1 に答える
2
ジョブを実行するための単純なサーブレットを作成できます。
@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.
// ...
}
}
于 2012-11-06T15:06:31.747 に答える