cancel
Showing results for 
Search instead for 
Did you mean: 

How to transfer external parameters to Webdynpro Application.

sergey_tuzov
Explorer
0 Kudos

Dear Experts.

I need to transfer some exteral parameter (maximum file size, which users can attach)

from Netweaver Portal to webdynpro application.

Portal administrator should have ability to change those parameter without ear file rebuilding.

Could you please describe any possible ways for this task.

Accepted Solutions (0)

Answers (3)

Answers (3)

sergey_tuzov
Explorer
0 Kudos

Now my problem is solved thank you for your attention.

pravesh_verma
Active Contributor
0 Kudos

Hi Sergey Tuzov,

It is possible to pass the parameter using the ivew Parameters. Those parmaters can be set at the portal side and can be accessed in th ewebdynpro application. You need not have to rebuild the ear by this way.

Check this code:


String hostName = WDProtocolAdapter.getProtocolAdapter().getRequestObject().getParameter("parameterName");

Check this link for more details:

Regards

Pravesh

Former Member
0 Kudos

Hi sergey it's possible to transfer some external parameters from your iView to webdynpro application. Is it possible to elobarate further on your requirements?

sergey_tuzov
Explorer
0 Kudos

Santosh, task description is the following:

How users have ability to attach file in webdynpro application. Files are storing in KM.

It is nesessary to restrict maximum file size which can be attached.

So, I need to read maximum file size parameter from external environment in webdynpro application.

pravesh_verma
Active Contributor
0 Kudos

Hi,

For that you can simple use the JAVA code to check the file size before uploading...

Please check this code which calculates the file size. If the file size is greater than what your requirement is just show the error to user and return from the function:

Check this class file:


import java.io.File;

public class FileUtil {

  public long getFileSize(String filename) {

    File file = new File(filename);
    
    if (!file.exists() || !file.isFile()) {
      System.out.println("File doesn\'t exist");
      return -1;
    }
    
    //Here we get the actual size
    return file.length();
  }

  public static void main(String[] args) {
    FileUtil fileutil = new FileUtil();
    long size = fileutil.getFileSize("/temp/myfile1.txt");
    System.out.println("Filesize in bytes: " + size);
  }
}

You can also have a look to this code:


File file = new File("c:/temp/logo.jpg");
       
        long byteSize = file.length();
       
        // Divide by 1024 to get size in KB
        long kbSize = byteSize / 1024;
       
        System.out.println(byteSize + " bytes");
        System.out.println(kbSize + " KB");

I hope this will solve your issue.

Thanks and Regards

Pravesh