2011-07-03 8 views
0

私はOpen Id Developmentの新機能です。インターネットからopenid4javaサンプルアプリケーションをダウンロードし、同じものを実装しようとしています。その後、発見ポイントまでdiscover.itしてからend point URIをヒットしようとすると、私のプロジェクトのURLパスも追加されているので、404エラーが出ます。 例:オープンIDエンドポイントフォワードが機能していない

/Openid/http:/www.myopenid.com/server.(here Openidは私のプロジェクト名です)。

これは私のサーブレットです:

package com.openid.registration; 

import java.io.IOException; 

import javax.servlet.RequestDispatcher; 
import javax.servlet.ServletException; 
import javax.servlet.http.HttpServlet; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
import javax.servlet.http.HttpSession; 

import org.openid4java.discovery.DiscoveryInformation; 
import org.openid4java.message.AuthRequest; 

public class OpenIdRegistrationServlet extends HttpServlet 
{ 
private static final long serialVersionUID = 1L; 
private String returnToUrl; 
RequestDispatcher rd = null; 

protected void processRequest(HttpServletRequest request, HttpServletResponse response) 
throws ServletException, IOException 
{ 
    HttpSession session=request.getSession(false); 
    String OpenID=request.getParameter("openid"); 
    System.out.println("Open ID entered by the user"+OpenID); 
    // Delegate to Open ID code 
    DiscoveryInformation discoveryInformation = RegistrationService.performDiscoveryOnUserSuppliedIdentifier(OpenID); 
    // Store the disovery results in session. 
    System.out.println("OPEnd Point"+discoveryInformation.getOPEndpoint()); 
    session.setAttribute("discoveryInformation", discoveryInformation); 
    // Create the AuthRequest 
    returnToUrl=RegistrationService.getReturnToUrl(); 
    AuthRequest authRequest = RegistrationService.createOpenIdAuthRequest(discoveryInformation, returnToUrl); 
    rd = request.getRequestDispatcher(authRequest.getDestinationUrl(true)); 
    System.out.println("Destination URL:"+authRequest.getDestinationUrl(true)); 
    rd.forward(request, response); 

} 
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 
    processRequest(request,response); 
    // TODO Auto-generated method stub 
} 

/** 
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 
*/ 
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 
    processRequest(request,response); 
    // TODO Auto-generated method stub 
} 

}

私はそこにTomcat 5.Isで自分のアプリケーションにURLから私のプロジェクト名を削除する方法を導入しているか、私は、Apacheからリダイレクトする必要がありますウェブサーバー?どんな助けもあります

答えて

0

私の間違いです。私はsendRedirect(authRequest.getDestinationUrl(true))にforward(要求、応答)を変更しました。

関連する問題