[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Paperclips-discuss] HEAD, was: API_23_ALPHA_2_1
From: |
Christopher K. St. John |
Subject: |
Re: [Paperclips-discuss] HEAD, was: API_23_ALPHA_2_1 |
Date: |
Mon, 25 Jun 2001 20:50:49 -0500 |
Nic Ferrier wrote:
>
> WWW.java:
> public void doGet(HttpServletRequest request,HttpServletResponse
> response)
> {
> ...
> target.connect();
> if(!target.getContentType().equals("text/directorylisting"))
> ...
>
> Yes, it's worth cleaning up.
>
if(!target.getContentType().equals("text/directorylisting"))
changes to:
if (!("text/directorylisting".equals(target.getContentType())))
same change for:
protected long getLastModified(HttpServletRequest request)
I'm told the "blahblah".equals(var) style is more
politically correct than var.equals("blahblah") because
of the null thing, but personally I don't like the
way it looks :-) In this case, though, it's probably
the right thing to do.
>
> The problem is really with the getContentType method because it
> should handle mime type mapping better.
>
Well, there will always be some files that there really
isn't a mime-type mapping for, and if the call returned
a default then you'd have no way to tell the difference
between "defaulted" and "unknown".
> I'm not really sure how to do
> this though... the API specs the registration of mime types in a DD
> but might it be a good idea for Paperclips to read a mime.types file
> in some default places if the DD doesn't register any mime types?
>
Hmm, I've never messed with the DD mime type mappings,
but it looks like WWW servlet should be doing:
ServletContext.getMimeType()
in order to access the mime types mappings in the DD? I'm
assuming that DD mappings wouldn't affect URL.getContentType()?
Random thoughts:
- WWW should use ServletContext.getMimeType()
- WWW has a built-in DD (distributed as a war?)
- The built-in DD has the appropriate mime-type
entries, instead of using a separate mime.types
files.
- Should be a set of default built-in mime types
for those times when the WWW DD gets trashed
or is unavailable.
- Don't use URL.getContentType(), since URL is
a random nasty unpredictable class.
- WWW must handle the case where the mime type
is really unknown, default it to something
reasonable. Probably text/plain.
Random question:
- Any reason WWW doesn't return clickable links
in directory indexes?
--
Christopher St. John address@hidden
DistribuTopia http://www.distributopia.com
- Re: [Paperclips-discuss] HEAD, was: API_23_ALPHA_2_1, Nic Ferrier, 2001/06/25
- Re: [Paperclips-discuss] HEAD, was: API_23_ALPHA_2_1, Nic Ferrier, 2001/06/25
- Re: [Paperclips-discuss] HEAD, was: API_23_ALPHA_2_1,
Christopher K. St. John <=
- Re: [Paperclips-discuss] HEAD, was: API_23_ALPHA_2_1, Nic Ferrier, 2001/06/25
- Re: [Paperclips-discuss] HEAD, was: API_23_ALPHA_2_1, Nic Ferrier, 2001/06/26