on 08-29-2013 8:26 AM
Hi,
We have a requirement, webdynpro Java application will be deployed in different geographic region.
1)In the screen (view), we need to show different images depends upon the region which application is accessing. Also all geographic region should use the same URL (we cannot use different URL parameters for different regions).
2)Need to give an utility to admin user, he will upload the required image for his region, in webdynpro application , we should show that image (admin uploded) in the image place holder. In this case where to store the uploaded image and how to show in it webdynpro application.
Please help on this.
Regards,
Rakesh Mathew
First, you have to determine the user's region.
1. You can use the Google/Microsoft's Geolocation api to get the user's region - Runtime determination of user's region
2. You can set a locale for the user in UME. The code can read the locale assigned to the logged in user and according behave. - Design time config of user's preferred locale and obtain it
For option 2: Use the method:
IWDClientUser loginUser = WDClientUser.getLoggedInClientUser();
Locale locale = loginUser.getLocale(); | |
locale.getCountry(); | |
Now, store the images for the regions in a location - server location/central folder.
Follow the locale naming convention.
Either create a screen / request admins to maintain images in that folder/location.
In your application, after determining the user's locale, retrieve the relevant image in the location.
- To retrieve the image/resource, use the WDResourceFactory and WDURLGenerator.
Sample: Explore the WDResourceFactory to fulfill this requirement.
// Receieve the image as file, read into stream and then build the resource and assign it to the image UI element.
byte[] buffer = wdContext.currentOutputElement().getXstring_Data(); // here am receiving -1, Array Index out of bound exp
IWDResource resource = WDResourceFactory.createCachedResource(new ByteArrayInputStream(buffer),"JPG",WDWebResourceType.JPG_IMAGE,true);
Regards,
Sharath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is no specific path which is ideal but recommended to keep it simpler.
Also, explore the usage of KM folder to store the images. This way, you avoid the need to have direct access to server. Once you store images in KM folder, make use of KM apis to access the folder and image in KM.
This makes the job of admin also easier, as they can log onto portal - KM and upload files.
Regards,
Sharath
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.