Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.2
-
Component/s: ICE-Components
-
Labels:None
-
Environment:All
Description
When using the outputResource component to display pdfs, if attachement="true" the filename will be appended to the URL when the user selects save. If attachment="false", the filename is not included in the generated URL.
i.e:
http://localhost/testApp/Web/block/resource/LTE4NTk2MjU0MzQ=/filename.pdf
instead of just
http://localhost/testApp/Web/block/resource/LTE4NTk2MjU0MzQ=/
i.e:
http://localhost/testApp/Web/block/resource/LTE4NTk2MjU0MzQ=/filename.pdf
instead of just
http://localhost/testApp/Web/block/resource/LTE4NTk2MjU0MzQ=/
Here is the fix for ResourceDispatcher.java:
private class FileNameOption implements Resource.Options {
{ return fileName; }private String fileName;
public String getFileName()
public void setAsAttachement()
{ // TODO Auto-generated method stub }public void setExpiresBy(Date date) { // TODO Auto-generated method stub }
public void setFileName(String fileName)
{ this.fileName = fileName; }public void setLastModified(Date date)
{ // TODO Auto-generated method stub }public void setMimeType(String mimeType) { // TODO Auto-generated method stub }
}
{ resource.withOptions(options); }public URI registerResource(Resource resource, ResourceLinker.Handler handler) {
if( handler == null )
handler = NOOPHandler;
final FileNameOption options = new FileNameOption();
try
catch (IOException e)
{ throw new RuntimeException(e); }final String filename = options.getFileName();
final String name = prefix + encode(resource) + "/" + (filename != null && filename != "" ? filename : "");