Spring Web とセキュリティ 3.1 を実行しています。セキュア エリア内のセキュア エリアから別のローカル ページをダウンロードする必要があります。次のコードがあるとします。
@Controller
@RequestMapping("/secure")
public class SecureArea {
@RequestMapping("/downloadMe.xhtml")
public String downloadMe(HttpServletRequest request, HttpServletResponse response) throws Exception {
// do stuff
return "myJsp";
}
@RequestMapping("/viewStuff")
public void viewStuff(HttpServletRequest request, HttpServletResponse response) throws Exception {
InputStream in = (new URL("http://"+request.getServerName()+":"+request.getServerPort()+"/secure/downloadMe.xhtml").openStream());
// read the input stream and do stuff with it, obviously returns my 401 page
}
}
春のセキュリティのため、viewStuff メソッドは /downloadMe.xhtml ページを表示できません。リクエストのセキュリティ認証情報を新しいリクエストに入れ、downloadMe.xhtml をダウンロードする方法はありますか。
*この方法または同じ結果が得られる同様の方法で行う必要があります。単に downloadMe(request, response) を呼び出すことはできません。myJsp から返されたデータとそれに付随するすべてのロジックが必要です。