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

Error in simple java code.

Hi folks,

I am having some problem to compile this code, anybody can help me please ?

Thanks a lot.

Patricio.

-


package Duck02;

import java.util.List;

import com.sapportals.portal.prt.component.*;

import com.sapportals.wcm.repository.IResource;

import com.sapportals.wcm.repository.ResourceContext;

import com.sapportals.wcm.repository.ResourceFactory;

import com.sapportals.wcm.util.uri.RID;

import com.sapportals.portal.security.usermanagement.IUser;

import com.sap.netweaver.bc.rf.common.exception.*;

public class MyFirstComponent extends AbstractPortalComponent

{

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)

{

IResourceContext resourceContext = new ResourceContext(user);

RID rid = RID.getRID("/etc");

try {

IResource resource = ResourceFactory.getInstance().getResource(rid, resourceContext);

if( resource != null ) {

// resource found

System.out.println("resource " + resource.getRID() + " found");

} else {

// resource not found

System.out.println("resource " + resource.getRID() + " does not exist");

}

}

catch( ResourceException e ) {

// problem while retrieving the resource

System.out.println(

"exception while trying to get resource " + e.getRID()

+ ": " + e.getMessage()

);

}

}

}

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2005 at 02:37 PM

    There is nothing wrong with your code. Try /documents folder and that should give you a good idea of your code works or not. What is the exception that you are getting? I have never read /etc folder before, i wonder if it is not acessible via KM api.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 03, 2005 at 03:09 PM

    add the following jar as a reference in your project.

    com.sap.security.api.ep5.jar

    Add a comment
    10|10000 characters needed characters exceeded

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.