|
Re: [xmlc] DocumentLoaderImpl Cache Keys: msg#00001java.enhydra.xmlc
At 06:56 AM 1/12/2007, you wrote: >Here's my problem... I want to switch which html file is used for a >given generated interface X based on some request values. > Interface or Class? I suspect you are talking about Class, not Interface. Read on... >I've gotten this ALMOST working by extending StandardDocumentLoader >and overriding getSourceFileName(Class). The problem is that this >value is then cached in the DocumentLoaderImpl superclass. Then, when >I make another request that should use a different html file for >interface X, it uses the first html file that it already has cached. > This is why I suspect you are talking about Class, not Interface. getSourceFileName() calls getClassConstant() to obtain the source file associated with the Class, not Interface. For instance, the following might be in your generated XMLC Class... public static final String XMLC_SOURCE_FILE = "xmlc/demo/Welcome.html" You may have multiple classes, with different source files, all implementing the same interface. If the document loader sees a new class it hasn't seen before, it will be loaded and cached separately from any other class, even if both classes implement the same interface. Does this not work for you? Maybe if you explain your use-case a little more, it will make more sense to me. I'm open to changes, but I'm not sure I see the necessity of them at this point, especially when there are other ways to do it. Jake >I propose slightly changing how DocumentLoaderImpl makes cache keys. If >--- >protected CacheEntry getCacheEntry(Class docClass) { > String name = docClass.getName(); > ... >} >--- >was changed to >--- >protected String makeCacheKey(Class docClass) { > return docClass.getName(); >} >protected CacheEntry getCacheEntry(Class docClass) { > String name = makeCacheKey(docClass); > ... >} >--- >then I could simply override makeCacheKey() and make it unique for >each of my html files. > >Does that sound okay? Am I going about it all wrong? The other >option would be to make the templateCache member variable protected, >and then I could just duplicate getCacheEntry() and tweak it to my needs. > >Thanks in advance, >Erik > > > >-- >You receive this message as a subscriber of the xmlc@xxxxxxxxxxxxx >mailing list. >To unsubscribe: mailto:xmlc-unsubscribe@xxxxxxxxxxxxx >For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help >ObjectWeb mailing lists service home page: http://www.objectweb.org/wws -- You receive this message as a subscriber of the xmlc@xxxxxxxxxxxxx mailing list. To unsubscribe: mailto:xmlc-unsubscribe@xxxxxxxxxxxxx For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [xmlc] DocumentLoaderImpl Cache Keys, i_am_erik |
|---|---|
| Next by Date: | Re: [xmlc] DocumentLoaderImpl Cache Keys, Erik Rasmussen |
| Previous by Thread: | [xmlc] DocumentLoaderImpl Cache Keys, i_am_erik |
| Next by Thread: | Re: [xmlc] DocumentLoaderImpl Cache Keys, Erik Rasmussen |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |