on 09-19-2006 7:23 AM
I am trying to implement a simple KM repository framework program.
I was informed to use this:
IUser serviceUser = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
ResourceContext c = new ResourceContext(serviceUser);
Since I am on EP 7 2004S I have to use this:
com.sap.security.api.IUser user=(com.sap.security.api.IUser)request.getUser();
IResourceContext resourceContext=new ResourceContext(user);
But now I get an error:
<b>Constructor ResourceContext(IUser) is undefined</b> in Eclipse.
And I get this whole list of errors <b>"Missing required library: C:Program Files/SAP/IDE/IDE70/eclipse/plugins/com.sap.km.rfwizard/lib/prtapi.jar"</b> when in my nwds i get all the jars in folder <b>com.sap.km.rfwizard_7.1.5</b>
Please do help me out.
hi,
In portalapp.xml:
Mention
<property name="SharingReference" value="com.sap.km.cm"/>
also
import com.sap.security.api.IUser;
import com.sapportals.portal.security.usermanagement.IUser
com.sapportals.portal.security.usermanagement.IUser user=(com.sapportals.portal.security.usermanagement.IUser)request.getUser().getUser();
IResourceContext resourceContext=new ResourceContext(user);
Regards,
Ganesh N
Message was edited by: Ganesh Natarajan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try something like this:
...
IResourceFactory resFactory = ResourceFactory.getInstance();
IResource res = (IResource) resFactory.getResource(rid, rContext);
IContent content = resource.getUnfilteredContent();
InputStream is = content.getInputStream();
byte[] bytes = new byte[(int) content.getContentLength()];
int i = is.read();
int count = 0;
while (i != -1) {
char b = (char) i;
bytes[count] = (byte) i;
count++;
i = is.read();
}
...
response.write(new String(bytes, "UTF-8"));
Getting the content and writing to the response could be better, but works good enough for my case
Romano
Hi,
If you know, that the resource is HTML (or generally text/string) you read the content (<i>resource.getUnfilteredContent()</i>) get the inputstream (<i>resource.getUnfilteredContent().getInputStream()</i>) read it byte by byte and write it to string (<i>new String(bytes, "UTF-8")</i>). Then give this string to <i>response.write()</i> method.
There is a lot of methods how to read InputStream in java, check the Google for some (surely better) examples
Romano
Dear All,
Could I have some help on this please.
I need it urgently.
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.