我正在尝试将 url 从“美丽的”人类可读的 url 重写为 webcenter 内部表示,反之亦然。我正在使用 AssetDataManager 将资产 ID 映射到我在 URL 中使用的资产描述,反之亦然。这就是我的 url 程序集:
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);
但是,我当然不想每次要解析 url 时都创建另一个会话。为什么我会得到异常?什么是处理这个问题的好方法?