on 07-20-2006 4:04 AM
Using
WDWebResource.getPublicCachedWebResource(
byte[] webResource,
WDWebResourceType resourceType,
WDScopeType scopeType,
WDDeployableObjectPart deployableObjectpart,
<b>String key</b>)
to create a downloadable file which url can be retrieved with
IWDCachedWebResource.getAbsoluteURL()
. However, the filename generated is always to be key (last parameter of getPublicCachedWebResource)+ <b>5-digit-code</b> + extension-of-resourceType.
Is it possible to remove the automatically appended 5-digit-code? I tried
IWDCachedWebResource.setResourceName(String resourceName)
but it makes no change on the filename.
Thanks!
Tony
Hi Tony,
Imagine that 2 or more concurent users are running same code in WD controller that creates IWDCachedWebResource with same key but the content is different. <b>5-digit-code</b> allows to have 2 or more <b>real</b> different resources and prevent overwrite of previously saved content.
So, I don`t think you would be able to remove them.
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Maksim,
I think it's just because session data is not necessary when downloading this file. That is, if that URL is copied and pasted to another browser instance, the corresponding IWDCachedWebResource can still be downloaded, even though the scope of IWDCachedWebResource is set to be <b>WDScopeType.CLIENTSESSION_SCOPE</b>.
I just found that using FileDownload UI can solve this issue, and the IWDResource pointed by the FileDownload can only be downloaded within the same browser session. This way is more secure than using IWDCachedWebResource.
By the way, thanks for your valuable information.
Regards,
Tony
Ok, after some investivation I have found following:
file name is build by following code:
private PublicResourcePoolElement(String directory, String key, String fileExtension, byte bytes[]) throws IOException, WDIllegalArgumentException
{
...
file = File.createTempFile(key, "." + fileExtension, tmpDir);
this.key = file.getName();
...
}
Check http://java.sun.com/j2se/1.3/docs/api/java/io/File.html#createTempFile(java.lang.String,%20java.lang... about the logic of File.createTempFile() method.
Hi Maksim,
Thank you for your information. However, it seems downloading file thru either URL-generation from IWDCachedWebResource or FileDownload UI should do the same thing: creating a temp file holding data and redirect the browser to that temp file.
With FileDownload UI, filename can be fully controlled, while IWDCachedWebResource cannot do so.
Thanks!
Tony
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.