Hi,

1. Yes, it's possible. Since all sitemap matching URL's are actually kind
of HTTP Servlets, you can just use any http client (e.g. Apache HttpClient)
to invoke the servlet and get the response (if that is outside Cocoon):

HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://www.test.com/servlet.xml";);
HttpResponse response = client.execute(request);
*// Get the response*
BufferedReader rd = new BufferedReader
  (new InputStreamReader(response.getEntity().getContent()));

String line = "";while ((line = rd.readLine()) != null) {
  ...
}


2. You can invoke any sitemap-servlet from within cocoon pipeline of course:
http://wiki.apache.org/cocoon/IntegrateAServlet

3. If you want to invoke sitemap-servlet from Cocoon API, first you need to
decide at which step that action need to be taken. If it's a Starter, you
can use XMLGenerator with given URL:

URL base = this.getClass().getResource("http://www.test.com/";);
Pipeline<SAXPipelineComponent> pipeline = new
NonCachingPipeline<SAXPipelineComponent>();
pipeline.addComponent(new XMLGenerator(new URL(base, "servlet.xml")));


If it's somewhere in the middle of the pipeline, you can use
IncludeTransformer that will call your servlet-service:

pipeline.addComponent(new XIncludeTransformer("servlet_calling_include.xml"));


where:

servlet_calling_include.xml


<data_from_servlet><i:include
src="servlet:/data/servlet"/></data_from_servlet>


Hope that helps.

Greetings,
Greg



2014-03-21 9:14 GMT+01:00 Yahoo <hansheinrichbr...@yahoo.de>:

>
> Hello Greg,
>
> is it possible  to call a sitemap-snippet within a program an getting the
> respone inside a program?
>
> H.Braun
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
> For additional commands, e-mail: users-h...@cocoon.apache.org
>
>

Reply via email to