cancel
Showing results for 
Search instead for 
Did you mean: 

Access XML file in portal application

Former Member
0 Kudos

Hello,

I develop a portal application and I would access a xml file "getRooms.xml" in my JSPDynPage.

- I put my xml file under project <b>root</b>.

- I use the following code :

IPropertiesResource rooms = (IPropertiesResource)(request.getResource("xml", "getRooms.xml"));

But I've a FileNotFoundException, the system cannot find the file specified.

Must I put the xml file under a specific folder ?

Could you help me please ?

Thanks.

Delphine.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Saravanan,

I'm not trying to get the resource from KM repository.

I develop a application in Eclipse, a portal application project. The hierarchy of this project are :

- src.api

- src.core

- dist : under this folder, there are others folders as "css", "images" and "scripts" where we can put resources (image.jsp under "images" for example).

I would use a xml file but I don't know where I put this resource in my project.

Have you an idea ?

Thanks.

Delphine.

Former Member
0 Kudos

Hi Delphine!

You have to put files in the following folders:

1. WEB resources: can be accessed from the outside by an HTTP request: <project_root>/dist/

2. Public resources: can be accessed by other portal components: <project_root>/dist/PORTAL-INF

3. Private resources: can only be accessed by the component itself: <project_root>/dist/PORTAL-INF/private

Within the different folder you can create any sub folders you need.

The file path can then be get by the IPortalComponentRequest.getPublicResourcePath(), getWebResourcePath() or getPrivateResourcePath() method.

example:

you put your xml file in the folder <project_root>/dist/PORTAL-INF/xml/file.xml

you can the get a java File object by using:

IPortalComponentRequest request;

String location =request.getPublicResourcePath()+"/xml/file.xml";

File f = new File(location);

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

I have a scenario like XI sends XML file to servlet

XI->J2EE application. For this am using HTTP adapter as receiver. I have to retrieve that XML file in my servlet and display the same in browser. How to do that, please help me.

Thanks

Saravanan_SD
Advisor
Advisor
0 Kudos

Hi Delphine,

If i understand properly, you are trying to get the resource from KM repository... right???

In that case you need to use RID.

RID rid = RID.getRID("/root/getRooms.xml");
IResourceContext resourceContext = new ResourceContext(user);
IResource resource =ResourceFactory.getInstance().getResource(rid, resourceContext);

Hope it helps.

regards,

Saravanan.

Former Member
0 Kudos

Hi Saravanan!

I have a scenario like XI sends XML file to servlet

XI->J2EE application. For this am using HTTP adapter as receiver. I have to retrieve that XML file in my servlet and display the same in browser. How to do that, please help me.

Thanks