我有一段代碼從門戶頁面uniquename獲取WebSphere Portal URL。但是生成的URL也有我不需要的導航狀態細節。我需要沒有任何狀態信息的網址。請幫忙。提前致謝!!用於獲取無導航狀態的URL的WebSphere Portal API
URLFactory urlFactory = null;
SelectionAccessorController selCtrl = null;
PortletServiceHome serviceHome = null;
Context ctx = null;
try {
ctx = new InitialContext();
serviceHome = (PortletServiceHome) ctx.lookup("portletservice/com.ibm.portal.state.service.PortletStateManagerService");
PortletStateManagerService service =
(PortletStateManagerService) serviceHome
.getPortletService(PortletStateManagerService.class);
try {
PortletStateManager manager = service.getPortletStateManager(request, response);
urlFactory = manager.getURLFactory();
EngineURL url = urlFactory.newURL(Constants.EMPTY_COPY);
com.ibm.portal.state.accessors.selection.SelectionAccessorFactory selFct =
(com.ibm.portal.state.accessors.selection.SelectionAccessorFactory) manager
.getAccessorFactory(com.ibm.portal.state.accessors.selection.SelectionAccessorFactory.class);
selCtrl = selFct.getSelectionAccessorController(url.getState());
selCtrl.setSelection(uniqueName);
return url.writeDispose(new StringWriter()).toString();
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
if (null != selCtrl)
selCtrl.dispose();
if (null != urlFactory)
urlFactory.dispose();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
if (null != selCtrl)
selCtrl.dispose();
if (null != urlFactory)
urlFactory.dispose();
}
return null;
}