Loading resources in extension commands

6 views
Skip to first unread message

Lance Walton

unread,
Aug 10, 2017, 10:36:35 PM8/10/17
to concordion-dev
Hi.

I am trying to write an extension (in Scala). In my command I want to load a resource specified by the parameter to the command. e.g.

object MyCommand extends AbstractCommand {
  override def execute(commandCall: CommandCall, evaluator: Evaluator, resultRecorder: ResultRecorder): Unit = {
    val path = evaluator.evaluate(commandCall.getExpression).asInstanceOf[String]
    val resource = commandCall.getResource.getRelativeResource(path)
    ...

What I want is to open an InputStream to the resource & fully load it. I can see that there is an interface called org.concordion.api.Source that seems to have exactly what I want, but I have no idea how to get hold of an instance of a Source.

Can anybody help?

Regards,

Lance

Lance Walton

unread,
Aug 11, 2017, 5:37:24 AM8/11/17
to concordion-dev
OK. I see how to do it. Just instantiate a ClassPathSource.
Reply all
Reply to author
Forward
0 new messages