2012-09-09 96 views
0

我想從「漂亮」的人類可讀的URL到webcenter內部表示的URL重寫,反之亦然。我使用AssetDataManager將資產ID映射到資源描述,我在URL中使用,反之亦然。這就是我與URL組件:與oracle webcenter網站的Url重寫會話問題11gR1

Session ses = SessionFactory.getSession(); 
AssetDataManager mgr = (AssetDataManager) ses 
    .getManager(AssetDataManager.class.getName()); 
List<AssetId> assets = new ArrayList<AssetId>(); 
assets.add(new AssetId() 
{ 
    private long id = assetId; 
    private String type = "Page"; 

    @Override 
    public String getType() 
    { 
     return type; 
    } 

    @Override 
    public long getId() 
    { 
     return id; 
    } 
}); 
Iterable<AssetData> assetDataItems = mgr.read(assets); 

這是URL拆解:

Session ses = SessionFactory.getSession(); 
AssetDataManager mgr = (AssetDataManager) ses 
    .getManager(AssetDataManager.class.getName()); 
final String assetType = "Page"; 

final String subType = null; 
final Condition condition = ConditionFactory.createCondition(
     "description", OpTypeEnum.EQUALS, pageName); 
final List<String> desiredAttributes = Arrays.asList("id"); 
Query query = new SimpleQuery(assetType, subType, condition, 
     desiredAttributes); 
query.getProperties().setIsBasicSearch(true); 

Iterable<AssetData> assetDataItems = mgr.read(query); 

兩者都在我的自定義彙編程序的情況下,延伸QueryAssembler使用。 大會工作正常,重用現有會話,但拆卸失敗:

COM.FutureTense.Common.ContentServerException: ContentServerException: (Unexpected runtime exception) Error code:GENERIC SERVER ERROR 
    at com.openmarket.Satellite.servlet.BaseServlet.doGet(BaseServlet.java:126) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
    at com.fatwire.wem.sso.cas.filter.CASFilter.doFilter(CASFilter.java:554) 
    at com.fatwire.wem.sso.SSOFilter.doFilter(SSOFilter.java:51) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) 
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) 
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) 
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) 
    at java.lang.Thread.run(Thread.java:619) 
Caused by: com.openmarket.Satellite.RequestContext$RequestContextInitializationException: Co-resident Satellite Server failed to capture ICS 
    at com.openmarket.Satellite.RequestContext.getICS(RequestContext.java:1030) 
    at com.openmarket.Satellite.RequestContext.captureInputCoResident(RequestContext.java:518) 
    at com.openmarket.Satellite.RequestContext.<init>(RequestContext.java:428) 
    at com.openmarket.Satellite.servlet.BaseServlet.doGet(BaseServlet.java:112) 
    ... 18 more 
Caused by: java.lang.NullPointerException 
    at COM.FutureTense.Common.CS.PushVars(CS.java:217) 
    at com.openmarket.framework.objects.ContentCatalog.Lookup(ContentCatalog.java:305) 
    at com.openmarket.framework.objects.AbstractContent.Read(AbstractContent.java:510) 
    at com.openmarket.framework.objects.AbstractObject.Read(AbstractObject.java:460) 
    at com.openmarket.framework.objects.AbstractObject.Read(AbstractObject.java:446) 
    at com.openmarket.xcelerate.asset.AssetType.Load(AssetType.java:499) 
    at com.fatwire.assetapi.util.AssetUtil.isComplexAsset(AssetUtil.java:125) 
    at com.fatwire.assetapi.util.AssetUtil.isFlexAsset(AssetUtil.java:274) 
    at com.fatwire.assetapi.data.AssetDataManagerImpl.read(AssetDataManagerImpl.java:79) 
    at mypackage.urlassembler.ComplexDisassemblyData.getAssetIdFromPageName(ComplexDisassemblyData.java:189) 
    at mypackage.urlassembler.ComplexDisassemblyData.valueOf(ComplexDisassemblyData.java:145) 
    at mypackage.urlassembler.MyCustomURLAssembler.getDisassemblyContext(MyCustomURLAssembler.java:79) 
    at com.fatwire.cs.core.uri.AbstractAssembler.disassemble(AbstractAssembler.java:418) 
    at com.fatwire.cs.core.uri.AssemblerEngine.disassemble(AssemblerEngine.java:242) 
    at COM.FutureTense.Servlet.ServletRequest.disassembleURI(ServletRequest.java:852) 
    at COM.FutureTense.Servlet.ServletRequest.initializeParameters(ServletRequest.java:1023) 
    at COM.FutureTense.Servlet.ServletRequest.getParameters(ServletRequest.java:786) 
    at COM.FutureTense.Servlet.FRequestObj.prepInput(FRequestObj.java:1090) 
    at COM.FutureTense.Servlet.FRequestObj.init(FRequestObj.java:973) 
    at COM.FutureTense.Servlet.FRequestObj.<init>(FRequestObj.java:271) 
    at COM.FutureTense.Servlet.FRequestObj.newInstance(FRequestObj.java:231) 
    at COM.FutureTense.Servlet.FRequestObj.newInstance(FRequestObj.java:218) 
    at COM.FutureTense.CS.Factory.newCS(Factory.java:66) 
    at com.openmarket.Satellite.RequestContext.getICS(RequestContext.java:1026) 
    ... 21 more 

這似乎很奇怪。由於某些原因,它無法使用現有會話。如果我改變拆卸會議檢索到這一點,它工作正常:

Session ses = SessionFactory.newSession(userName, pass); 

不過,我肯定不會想我要解決的網址,每次創建另一個會話。爲什麼我會得到異常?什麼是處理這個問題的好方法?

回答

0

好的,很明顯URL反彙編不能做任何與DB內容相關的任何事情,因爲它意味着要在沒有連接性的衛星服務器上執行。對於使用數據庫的URL組裝很好,但...

因此,根據this,我發現我需要將我的Asset API代碼移到從未緩存的包裝器調用的輔助類。從那裏它工作正常。