Daniel Fagerstrom wrote:
Reinhard Poetz skrev:
Daniel Fagerstrom wrote:
hmm, the "src" attribute of generators desribes, what is feed into
the component. In the case of a servlet service generator, the
output stream of a servlet is used as stream input.
Rather something that is transformed to SAX output.
The "data" parameter defines the content that is passed to the
servlet service. IMO that's not the starting point of the generator.
IMO it is ;)
The normal case:
Source ==[octet stream]==> Generator ==[SAX]==> ...
Servlet service generator as I see it:
Source ==[octet stream]==> Generator ==[SAX]==> ...
| ^
v |
ServletService
As you can see, the connection to the servlet service is something
that differ from the ordinary generator usage, and because of that it
is natural to put it in a parameter.
:-) yes, technically that's of course right but from a user's POV the
generator uses a servlet service as source.
I don't see how a user would gain anything in having a faulty conceptual
view of what the component does or why we should add to the potential
confusion by having a non consistent use of the source attribute.
The src attribute is used for reading from a source in all other cases,
using it for posting would be really confusing from a user POV ;)
Actually the code uses the input stream of the called pipeline:
generate():
SourceUtil.parse(saxParser, this.servletSource, super.xmlConsumer);
setup():
Source inputSource;
try {
try {
servletSource = (PostableSource)resolver.resolveURI(service);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
} catch (ClassCastException e) {
throw new ProcessingException("Resolved '" + service + "' to source that
}
inputSource = super.resolver.resolveURI(src);
} catch (SourceException se) {
throw SourceUtil.handle("Error during resolving of '" + src + "'.", se);
}
IOUtils.copy(inputSource.getInputStream(), servletSource.getOutputStream());
The data is the payload added to the request and only the _indirect_
source for the calling pipeline.
This is really a technical POV, and no, there is nothing _indirect_ in
this particular use of the src attribute.
By "indirect" I mean that in your example, the src attribute of the servlet
service generator specifies not its own source but the source of the generator
of the called pipeline. See the last statement.
I think the problem here is that we have two sources and depending on the
context, one is the "main" source. But if it's only me having this view on that,
I won't argue for it any more.
Any other opinions?
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------