Hi,

For all the Pier distribution I've checked I've noticed that for each request the stylesheet was being served from a new Url. The relevant implementation is:

MAFileModel>>url
"Answer a link to a request handler for the given file."
| handler |
handler := MAFileModelHandler on: self.
^ WACurrentRequestContext value registry
register: handler;
urlFor: handler


Which means that for every request for a file model's url, a new MAFileModelHandler is being created and registered.

The result is:
* The browser never caches the stylesheet
* Each page request unnecessarily adds to the application's collection of handlers.

Note: This is a generic Pier issue for PRFile requests, unless the url includes the query ?view=PRDownloadView OR MAExternalFileModel class baseUrl: has been defined).

One solution would be to add ?view=PRDownloadView to the url for stylesheet requests or possibly for all file requests (modify MAExternalFileModel>>url to add ?view=PRDownloadView).

However pondering the problem I've prototyped a solution in which PRFile have a custom view component "PRFileView" which responds with it's associated PRFile file directly, rather than delegating to MAFileModelHandler. The logic is that, by default, PRFile>>#url responds with a fully qualified path to itself within the pier structure e.g. /pier/template/style.css then PRFileView>>#initialRequest checks the request to see if it matches the mime-type of it's associated PRFile's mime-type, if so it will respond true to  PRFileView>#isFullResponse and serve the file directly in  PRFileView>#respondUsing:

MAExternalFileModel class>>#baseUrl still works as intended and MAFileModel>>#url (and friends) remains unchanged.

The result appears to be a neater solution than modify MAExternalFileModel>>url to add ?view=PRDownloadView, but I might be suffering from implementors bias :-)

I thought I should check that:

1) people think it looks like a sensible fix and improvement
2) if (1) then whether I should delete  MAFileModel>>#url (and friends), deprecate them, or leave them as is.

Thanks

Nick