Skip to Content
author's profile photo Former Member
Former Member

getPublicCachedWebResource method is unstable after adding 2nd server node

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 05:21 PM

    Hi Roy,

    Have you found a solution for this? I'm having the same problem..

    Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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");
      

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.