on 06-26-2008 3:38 PM
Hello all,
I would like to store a resource file in KM and have my web dynpro application read that file at runtime. Is this possible? Any examples of how to achieve this?
I hoping to be able to modify this resource file in KM to easily change certain behaviors in my webdynpro application.
These blogs show how to read an image from KM, is there a way to read a file with name/value pairs? Example:
Config = value1
Config = value2
etc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
lets create a file named "sample.properties" contains values
Config1 = value1
Config2 = value2
placed in KM.
the code is below to read the values
IResourceFactory factory = com.sapportals.wcm.repository.ResourceFactory.getInstance();
IWDClientUser wdClientUser =WDClientUser.getCurrentUser();
com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
ResourceContext context = new ResourceContext(WPUMFactory.getUserFactory().getEP5User(sapUser));
IResource resource = factory.getResource(RID.getRID("/xxx/XXX/sample.properties"),context);
InputStream is=resource.getContent().getInputStream();
Properties prop=new Properties();
prop.load(is);
String val=prop.getProperty("Config1 ");
wdComponentAPI.getMessageManager().reportSuccess(val);
Regards,
Naga
I think your right about the UTF8 encoding... when i check out the document for editing locally, it automatically opens in Notepad. I can then save the document in a different encoding....but it looks like it always is saved in UTF8....I wonder if there's a way to encode the inputstream in java to remove those funny characters?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is the native2ascii-tools in the JDK (of sun) to convert files into an acceptable encoding of properties-files. However, it is a batchtool. I'm not sure if it would remove those BOM-characters, maybe it just converts them into ascii-encoding ;-). Guess the easiest would be to use a reasonable editor.
I put it in debug mode and I see those special characters...it does not work without them...I have no idea where they are coming from...any thoughts?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
kind of strange, the only way to get a value out of the properties file is
String val = prop.getProperty("CONFIG1");
Do you know why I have to use these strange characters?

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Naga Raju Meesala.
How come all these methods are deprecated...getEP5User
Also, since I am building a weddynpro DC, what is the proper way to include these jar files as Used DCs?
Now proceed in the same way with the variable PORTAL_HOME and add the following .jar files:
u2022 \lib\prtapi.jar The portal runtime APIs
u2022 \portalapps\com.sap.portal.usermanagement\lib\com.sap.security.api.ep5.jar The user management APIs of the Enterprise Portal 5.0 are deprecated, but still in use in SAP NetWeaver 04
u2022 \portalapps\com.sap.netweaver.bc.rf\lib\bc.rf.framework_api.jar KM Repository Framework APIs
u2022 \portalapps\com.sap.netweaver.bc.rf.service\lib\bc.rf.global.service.urlgenerator_api.jar Repository Framework Utility: URL Generator
u2022 \portalapps\com.sap.netweaver.bc.sf\lib\bc.sf.framework_api.jar Repository Framework: Repository Services
u2022 \portalapps\com.sap.netweaver.bc.util\lib\bc.util.public_api.jar Repository Framework Utilities
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
/people/rohit.radhakrishnan/blog/2005/05/27/uploading-files-to-km-repository-using-webdynpro-apis
/people/bobu.georgeputheeckal/blog/2006/12/22/getting-an-image-from-km-documents-to-be-used-in-web-dynpro
Regards,
Naga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.