> From: Les Hughes [mailto:[EMAIL PROTECTED]]
>
> Reading the servlet spec again it says that calls such as
> servletcontext.getRealPath() will *possibly* return null if
> the content is
> being served from a war as opposed the physical path on disk
> - I'm informed
> that weblogic actually returns the name of the warfile and
> not the exploded
> location. But you're right, Tomcat works differently.
What kind of URL does weblogic return for
servletContext.getResource("//index/segments")?
Is it a file: URL?
Keeping the index in files and using FSDirectory will be much more
efficient. If all the major servlet containers support this it would be a
shame not to take advantage of it. You might look at the result of
getResource and use an FSDirectory if a file: url is returned, and do
something else when it's not.
> So in order to isolate from different interpretations of the
> spec, I'm going
> to knock up a WARDirectory that probably will wrap a
> RAMDirectory (going
> back to the servlet container to getResourceAsStream seems
> awfully expensive
> to me) as a first go.
> I'll post my efforts in a couple of days.
One technique you might consider is, when the index is not available as a
file, use getResourceAsStream to copy it to a temporary directory in
System.getProperty("java.io.tmpdir"), then use FSDirectory. Storing the
whole index in a RAMDirectory will make searches really fast, but could also
chew up a lot of memory. If the index isn't that big anyway, maybe this
isn't an issue.
Doug
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>