Hello,
I'm not sure if anyone tracks implementation of COCOON-2050 issue. The status is that basic infrastructure is implemented and almost works
as expected. Some really basic samples are provided too.
Almost refers to the problem with serializer that makes servlet calls. Currently, method returning mime type cannot be implemented because
it's up to called service to determine mime type. The getMimeType is called during pipeline's setup phase but servlet call is done during
processing phase so serializer has no chance to return proper mime type during setup phase.
I propose following solution:
Given that mime type (and other http header informations) are calculated during setup phase of service's pipeline setup phase it's
guaranteed that this information can be properly determined without providing any content (in service call, it's POSTed one). Thus, it's
enough to perform HTTP HEAD request that does not post any data and does not expect any data returned by the service.
It means that serializer will need to perform two requests:
1. HTTP HEAD which is meant only to collect all data required to set all http
headers correctly (including Content-Type)
2. Actual HTTP POST that POSTs the data and gets transformed data returned by
the service
The obvious drawback of this method is that we need to perform two requests. However, first one should be really cheap because pipeline
needs only to setup components to gather all required meta information, no processing will be performed. The advantage of this method (if
implemented) is that it makes Cocoon even more HTTP-complaint, at general.
What do you think about this solution? Do you have other?
Another problem is that if we want servlet services really usable we need to forward Environment to the called service. An obvious example
is service that takes effort of styling Forms and handling Ajax requests. It needs to access all environment data to get run Forms machinery
properly. I was thinking about it for a while and I have no appealing idea how to solve it. I guess that this task is far beyond HTTP
capabilities and in this area we need to break conformity with HTTP specification. I mean that we just attach Environment object to the
BlockCallHttpServletRequest instance and we'll modify cocoon's core a little bit to detect that request is service call so it will be able
to make us of forwarded Environment.
What do you think?
--
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/