How to convert a Node to a Resource? | Community
Skip to main content
LinearGradient
Level 6
October 16, 2015
Solved

How to convert a Node to a Resource?

  • October 16, 2015
  • 2 replies
  • 8149 views

Basically I am looking for the reverse of:

    Node node = resource.adaptTo(Node.class)

How can this be done?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JustinEd3

Hi,

You can do this by using the AdapterManager OSGi service and:

adapterManager.getAdapter(node, Resource.class);

Regards,

Justin

2 replies

Level 6
October 16, 2015

You can do - 

String nodePath = resource.getPath();

Node node = session.getNode(nodePath);

JustinEd3Adobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

Hi,

You can do this by using the AdapterManager OSGi service and:

adapterManager.getAdapter(node, Resource.class);

Regards,

Justin