
|
If you were logged in you would be able to see more operations.
|
|
|
SiteMesh
Created: 18/Oct/02 12:28 AM
Updated: 20/Dec/03 03:36 AM
|
|
| Fix Version/s: |
2.1
|
|
|
Environment:
|
Win2K + JDK1.4.1 + WW + Orion1.6
|
|
|
In the download functionality to the webapp product I oversee at our company, you can click on a link in a directory view on a web page to download a file from a remote server via your browser. I currently am getting a parse error in FastPageParser. However, I've determined the problem.
I have setup Sitemesh to ignore my download URL's, /download.jspx and /file-download.jspx. It correctly does not attempt to decorate these. However, Sitemesh currently parses a page before it decides whether or not it needs to decorate it. (This is not the actual problem, but maybe it shouldn't parse a page it's not meant to decorate anyway. Anyway...)
In my code I have:
response.setContentType(mimeType + "; name=\" + fileName + "\"");
While the name parameter is not actually necessary and was in there from some carryover code from the previous release, RFC 2045 indicates that a parameter is an 'attribute=value' with no limitation on what attribute should be other than valid characters that should be used.
Sitemesh however, in com.opensymphony.module.sitemesh.filter.PageResponse.setContentType() has:
if ((index = type.lastIndexOf('=')) != -1) {
encoding = type.substring(index + 1).trim();
}
which assumes that if there's a parameter present, it must be the encoding. This is not correct according to RFC2045. So basically what happens is that Sitemesh sets the encoding to the filename I specified, which breaks com.opensymphony.module.sitemesh.parser.FastPageParser.parse(byte[] data, String encoding) at the line:
reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data), encoding));
due to the now invalid encoding type.
So basically, the PageResponse class needs to be fixed to not assume that any parameters in the content type will be a charset parameter.
While the filename parameter is not actually necessary in my code (and I have in fact removed it to work with current Sitemesh), obviously there may be a case where a parameter other than charset is necessary. Certainly, the RFC allows it.
Anyway, thought I should log this as a bug, right?
- Darryl Pentz
|
|
Description
|
In the download functionality to the webapp product I oversee at our company, you can click on a link in a directory view on a web page to download a file from a remote server via your browser. I currently am getting a parse error in FastPageParser. However, I've determined the problem.
I have setup Sitemesh to ignore my download URL's, /download.jspx and /file-download.jspx. It correctly does not attempt to decorate these. However, Sitemesh currently parses a page before it decides whether or not it needs to decorate it. (This is not the actual problem, but maybe it shouldn't parse a page it's not meant to decorate anyway. Anyway...)
In my code I have:
response.setContentType(mimeType + "; name=\" + fileName + "\"");
While the name parameter is not actually necessary and was in there from some carryover code from the previous release, RFC 2045 indicates that a parameter is an 'attribute=value' with no limitation on what attribute should be other than valid characters that should be used.
Sitemesh however, in com.opensymphony.module.sitemesh.filter.PageResponse.setContentType() has:
if ((index = type.lastIndexOf('=')) != -1) {
encoding = type.substring(index + 1).trim();
}
which assumes that if there's a parameter present, it must be the encoding. This is not correct according to RFC2045. So basically what happens is that Sitemesh sets the encoding to the filename I specified, which breaks com.opensymphony.module.sitemesh.parser.FastPageParser.parse(byte[] data, String encoding) at the line:
reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data), encoding));
due to the now invalid encoding type.
So basically, the PageResponse class needs to be fixed to not assume that any parameters in the content type will be a charset parameter.
While the filename parameter is not actually necessary in my code (and I have in fact removed it to work with current Sitemesh), obviously there may be a case where a parameter other than charset is necessary. Certainly, the RFC allows it.
Anyway, thought I should log this as a bug, right?
- Darryl Pentz |
Show » |
|
response.setContentType(mimeType + "; name=\"" + fileName + "\"");
A typo on my part. :\