on 05-09-2007 3:20 PM
Hello,
I am using WDWebResource.getPublicCachedWebResource in order to put some excel file on the server and I use WDScopeType.CLIENTSESSION_SCOPE as the session type parameter.
Everything was working OK when we worked with just one server node but since we added another server node it is very unstable.
I have created a sample program that uses this method, generates the file and prints it's location on the server using IWDCachedWebResource.getAbsoluteURL() method.
I've noticed that at many times, if I open up a browser and browse to the getAbsoluteURL(0 location I receive a resource does not exist message.
I couldn't find any pattern in here, sometimes the resource is there and sometimes it doesn't.
Any idea why this strange thing is happening?
Roy
Hi Roy,
Have you found a solution for this? I'm having the same problem..
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, I developed my own solution..
The problem is: If you have only one Webdynpro server, the file is generated right away, and you can download immediately. But, if you have multiple servers, it takes a few seconds for the file to be generated. So, I developed a simple wait mechanism:
IWDCachedWebResource resource;
resource = WDWebResource.getPublicCachedWebResource(
excel.getBytes(), WDWebResourceType.XLS,
WDScopeType.APPLICATION_SCOPE,
wdThis.wdGetAPI().getComponent().getDeployableObjectPart(),
"UserRoles");
resource.setAttachment(true);
String filePath = WDURLGenerator.getResourcePath(
wdThis.wdGetAPI().getComponent().getDeployableObjectPart(),
resource.getResourceName());
File file = new File(filePath);
long timeStart = System.currentTimeMillis();
long time = timeStart;
while (!file.exists() && (time-timeStart < 10000))
{time = System.currentTimeMillis();};
if (file.exists())
wdComponentAPI.getWindowManager().createNonModalExternalWindow(
resource.getAbsoluteURL(), "").show();
else
throw new Exception("An error occured while creating Excel file");
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.