沒有RequestAware攔截器......有一個Servlet-Config攔截器,它將檢查你的動作是否有下列接口之一:ServletContextAware,ServletRequestAware,ServletResponseAware,ParameterAware,RequestAware,SessionAware,ApplicationAware,PrincipalAware。
Servlet-Config攔截器是您可能已經使用的默認堆棧的一部分。因此,使用其中一個感知接口不需要額外的成本或配置。
這且不說,如果你有一個名爲「openid.response_nonce」,其中包含一個字符串參數,你應該能夠引用它:
//following not tested, and not checked for syntax errors
private Map openid = new HashMap();
//In Constructor{
oauth.put("response_nonce","");
}
//create BOTH a getter and setter for openid
public getOpenid(){
return openid;
}
public setOpenid(Map openid){
this.openid = openid;
}
現在的struts2應該能夠找出如何設定值...我想,對不起沒有測試它。你總是可以創建一個名爲OpenID的一個response_nonce屬性(用適當的getter和setter方法該類一起)類...但我認爲,在這種情況下,它可能是最好只使用RequestAware如果你只需要一個單一的屬性。
我知道這件事,但我的問題是與我從雅虎找回參數的'openid.response_nonce'名 –