は、データベースへのハンドルを取得するためにloadDatabase方法です。これは、このこの「defaultSession」がRestEngineの作成時に設定され、DominoUtils.getCurrentSession()を使用している「defaultSession」メンバフィールドです。
protected void loadDatabase(DominoParameters parameters) throws NotesException {
String dbName = parameters.getDatabaseName();
if(StringUtil.isEmpty(dbName)) {
if(defaultDatabase==null) {
throw new IllegalStateException("No default database assigned to the service"); // $NLX-RestDominoService.Nodefaultdatabaseassignedtotheser-1$
}
this.database = defaultDatabase;
this.shouldRecycleDatabase = false;
return;
}
if(defaultSession==null) {
throw new IllegalStateException("No default session assigned to the service"); // $NLX-RestDominoService.Nodefaultsessionassignedtotheserv-1$
}
this.database = DominoUtils.openDatabaseByName(defaultSession,dbName);
this.shouldRecycleDatabase = true;
}
。これはのXPagesの「セッション」変数に相当し、それを使用しませんそして残念ながらsessionAsSignerはありません。 それはどこにもないようですRestEngineの作成とレスポンスを生成するrenderServiceメソッドの間で変更できます。
private class Engine extends RestViewJsonService {
Engine(HttpServletRequest httpRequest, HttpServletResponse httpResponse, Parameters params) {
super(httpRequest,httpResponse,params);
setDefaultSession(DominoUtils.getCurrentSession());
setDefaultDatabase(DominoUtils.getCurrentDatabase());
}
あなたが本当に確かにそれを行う必要がある場合は、それがプロパティによって制御することができるように修正することができるが、これは、あなたが拡張ライブラリの独自のバージョンを建設する意味します。
「sessionAsSigner」プロパティーをcom.ibm.xsp.extlib.component.rest.DominoServiceに追加し、適切なxsp-configファイル内のプロパティーの定義を追加することもできます。残りのエンジンを作成するときに
このプロパティは、アクセスすることができます
private class Engine extends RestViewJsonService {
Engine(HttpServletRequest httpRequest, HttpServletResponse httpResponse, Parameters params) {
super(httpRequest,httpResponse,params);
if (isSessionAsSigner()) {
setDefaultSession(ExtLibUtil.getCurrentSessionAsSigner());
} else {
setDefaultSession(DominoUtils.getCurrentSession());
}
setDefaultDatabase(DominoUtils.getCurrentDatabase());
}
私はそれをテストしていませんが、私の脳は、それが動作すると言うが、それは金曜日に23時です。
独自のバージョンの拡張ライブラリを作成する習慣がない場合は、今のところcustomRestServiceを使用する方が簡単です。
ありがとうキャメロン。あなたが言うように、customRestServiceはおそらく(少なくとも短期間で)最も簡単なオプションです。しかし、拡張ライブラリを拡張することは面白いことです。 –
それはかなり小さい/迅速な修正であるので残念ですが、前もってやっていなければかなり努力を要するでしょう。私はそれを修正し、extlibプロジェクトにプルリクエストを送信することもあるかもしれませんが、残念ながら5月の私の以前のプルリクエストはまだそこに残っていますので、extlibを現時点で更新する時間が多いかどうかはわかりません –