cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Fagerstrom <dani...@nada.kth.se>
Subject Re: More problems with implementing servlet services
Date Thu, 17 May 2007 13:11:15 GMT
Grzegorz Kossakowski skrev:
> Daniel Fagerstrom pisze:
>> Grzegorz Kossakowski skrev:
>>> Daniel Fagerstrom pisze:
>>>
>>> I wonder how to achieve this less restrictive assumption. In 
>>> AbstractProcessingPipeline#setMimeTypeForSerializer() there is:
>>> if (mimeType != null) {
>>>   environment.setContentType (mimeType);
>>> } else {
>>>   // No mimeType available
>>>   String message = "Unable to determine MIME type for " +
>>>     environment.getURIPrefix() + "/" + environment.getURI();
>>>   throw new ProcessingException(message);
>>> }
>>>
>>> We have to move this checking somewhere further in the processing but 
>>> I have no good idea where exactly. Ideas?
>>
>> I don't see any possibility to do this in the pipeline. My idea was to 
>> do the mime type setting (on the http response object) in the 
>> endDocument method of the ServletServiceSerializer. It could be done 
>> after the:
>>
>> IOUtils.copy(new StringReader(serializedXML), 
>> servletSource.getOutputStream());
>>
>> but before:
>>
>> IOUtils.copy(servletSource.getInputStream(), super.output);
>>
>> The http response object is available from the object model.
> 
> I understand your intention. I was asking what we should do with the 
> checking above? Surely, I can remove throwing exception but this way we 
> lose check if mime type was set. I was asking if we can move it 
> somewhere else.

Don't think so. After the check the event generation is started, it seem 
complicated to create an APO for doing e.g. some mime type check callback.

> If not, do you feel that removing that check is a good idea?

No.

Couldn't we just give the servlet service serializer e.g. text/xml as 
default mime type. That will make the check happy. Then we just 
overwrite the default in the serializer. OK, it is a hack, but it 
doesn't seem that easy to find a clean solution for this.

See 
http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/resources/META-INF/cocoon/spring/cocoon-core-serializers.xml

for how you set mime types on serializers.

/Daniel

Mime
View raw message