私のアプリケーションでは、ユーザーは、たとえば、キッドクラブ、ユースクラブ、アダルトクラブ、エルダーリークラブなどのさまざまなクラブに登録できます。ここで、ユーザーが2012年10月7日にすでにキッドクラブに登録していて、2012年11月2日に同じクラブ「キッドクラブ」に再度登録しようとした場合、そのユーザーをユースクラブやアダルトクラブなどの別のクラブにリダイレクトしようとします。または高齢者クラブ。各クラブには、次のような独自のドメインがあります(例)
Kid club = kidclub.google.mobi
Youth Club = youthclub.yahoo.mobi
Adult Club=adult.godaddy.mobi
Elderly Club = elderly.google.mobi
以下はリダイレクトのサンプルコードですが、これは別のドメインURLにリダイレクトされていません。sendRedirect()メソッドが原因ですか?このアプリケーションではサーブレットは使用されていません。ApacheTomcatServerのMySQLデータベースではJSPのみが使用されます。できるだけ早く提案してください。
void doRedirect(HttpServletResponse response, String url)
{
try
{
response.sendRedirect(url);
}
catch (Exception e)
{
e.printStackTrace()
}
}
void redirectReturningUser( HttpServletRequest request, HttpServletResponse
response, ClubDomain currentDomain )
{
String redirectToUrl = currentDomain.getDefaultUrl();
if( "kidclub.google.mobi".equals( currentDomain.getDefaultUrl() ) )
redirectToUrl = "youthclub.yahoo.mobi";
else if( "adult.godaddy.mobi".equals( currentDomain.getDefaultUrl() ) )
redirectToUrl = "kidclub.google.mobi";
else if( "youthclub.yahoo.mobi".equals( currentDomain.getDefaultUrl() ) )
redirectToUrl = "adult.godaddy.mobi";
else if( "adult.godaddy.mobi".equals( currentDomain.getDefaultUrl() ) )
redirectToUrl = "elderly.google.mobi";
else if( "elderly.google.mobi".equals( currentDomain.getDefaultUrl() ) )
redirectToUrl = "adult.godaddy.mobi";
doRedirect(response, "http://"+redirectToUrl );
}
前もって感謝します