cancel
Showing results for 
Search instead for 
Did you mean: 

KM Task Scheduler , retrieve IPortalComponentRequest request

Former Member
0 Kudos

Hello,

I would like to use KM Task Scheduler :

public void run( String id, Properties properties ) {

IPortalComponentRequest request;

String location = request.getPublicResourcePath();

}

It's normal, it doesn't work ! How can I use IPortalComponentRequest for my schedule task ?

Thanks a lot

Best regards,

Aurélien

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Aurelien,

i think that IPortalComponentRequest object is available only in components that suppose direct user interaction (components which accept requests from a browser).

In case of SchedulerTask it's not posiible because this type of component is internal only and it is not invocable by a external request. So i'm almost sure - there is no way to get IPortalComponentRequest in SchedullerTask service.

Try to specify what exactly are you trying to do, why do you need this type of object. Resp. why do you need getPublicResourcePath in SchedullerTask???

regards.

mz

Former Member
0 Kudos

Hello Maxim,

Thanks a lot for your answer.

I woud like to read xml file including in my portal application.

There is another way to do it ?

Thanks a lot

Best regards,

Former Member
0 Kudos

Aurelien,

first question - what kind of portal application are you trying to do? What is it's purpose? This is an necessary pre-step to define where to place that XML file and how to access it. Is it supposed to be an internal portal service or an component accesed by users?

regards

mz

Former Member
0 Kudos

Hello Maxim,

It is a task services. I would like to use a xml file inside this service and this xml file must be read in the Method run of the service.

Thanks a lot

best regards,

Aurélien HENRY

Former Member
0 Kudos

Aurelien,

ok then, place your xml file into any package of your project. For example:

In package called "my.package.files" place file "myfile.xml"

then wherever within your code (let's assume you have an class called MySchedullerTask) call next structure:


URL url = MySchedullerTask.getClass().getClassLoader().getResource("my/package/files/myfile.xml");

and then work with the file.

Just one more note: non Java files are not build always into application PAR acrhive.

To do so, you have to check in option:

"Yes, I want the non java sources includet into the portal components jars"

You will find this option in NWDS:

Window -> Preferences -> SAP Enterprise Portal -> Application Development Studio.

regards

mz

Answers (0)