on 06-25-2007 4:25 PM
I want to be able to write a file in a Web Dynpro view and get the URL to that file for display in the IFrame of another view.
What I've tired without success is:
String filename = "temp_" + (new Date()).getTime() + ".html";
File file = new File(filename);
PrintWriter output = new PrintWriter(new FileWriter(file));
output.println("<html><body>This is a test</body></html>");
String fileURL = WDURLGenerator.getAbsoluteWebResourceURL(filename);
....
I was hoping that the last line would give me a URL to reference the file that was created, but apparently it does not.
I guess what I want to do is create a File in a platform independant way, find out where that file is located and get a publically accessible URL to it to display it.
Has anyone done anything like that who can point me in the right direction?
I think I'm getting closer, though still not quite working:
String filepath = WDURLGenerator.getPublicResourcePath("testing.html");
File file = new File(filepath);
PrintWriter output = new PrintWriter(new FileWriter(file));
output.println("<html><body><h1>This is a test</h1></body></html>");
output.flush();
output.close();
String url = WDURLGenerator.getWebResourceURLForPath(filepath);
wdContext.currentContextElement().setChartFilename(url);
wdComponentAPI.getMessageManager().reportSuccess("PublicResourcePath " + filepath);
wdComponentAPI.getMessageManager().reportSuccess("WebResourceURLForPath " + url);
My output from this is:
PublicResourcePath .\temp\webdynpro\public\local\Workflow\webdynpro\testing.html
WebResourceURLForPath ../../../resources/temp/webdynpro/public/local/Workflow/webdynpro/testing.html
I get a resource not found (404) when I try to load an IFrame with the url ../../../resources/temp/webdynpro/public/local/Workflow/webdynpro/testing.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this code:
String filepath = WDURLGenerator.getPublicResourcePath("testing.html");
File file = new File(filepath);
PrintWriter output = new PrintWriter(new FileWriter(file));
output.println("<html><body><h1>This is a test</h1></body></html>");
output.flush();
output.close();
String url = WDURLGenerator.getWebResourceURLForPath(filepath);
wdContext.currentContextElement().setChartFilename(filepath);
Regards,
Satyajit.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.