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

Different images for different geographic region

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Aug 30, 2013 at 06:57 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

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.