私は、「美しい」人間が読めるURLからWebCenterの内部表現へ、またはその逆にURLを書き換えようとしています。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を解決するたびに別のセッションを作成することは絶対に避けたいと思います。なぜ例外が発生するのですか?これを処理するための良い方法は何でしょうか?