[Yanel-dev] Introducing a WebViewable interface

Michael Wechner michael.wechner at wyona.com
Sat Feb 17 22:00:39 CET 2007


Josias Thöny wrote:

> Michael Wechner wrote:
>
>> Josias Thöny wrote:
>>
>>> Michael Wechner wrote:
>>>
>>>> Hi
>>>>
>>>> I am currently working on the integration of a toolbar. One 
>>>> condition is that one knows the mime-type of a response, because
>>>> the toolbar only makes sense for requesst which have (x)html as a 
>>>> response. Hence it's important to ask a resource for the mime-type
>>>> before the actual response is actually being generated.
>>>>
>>>> In other situations this should also be the case for other HTTP 
>>>> header fields, e.g. size, because the header should be set before 
>>>> the response body is being streamed.
>>>>
>>>> With the current Viewable interfaces and the View class, this is 
>>>> not really being forced and I think it's design mistake which I 
>>>> caused ;-)
>>>
>>>
>>>
>>> How would you enforce that?
>>> IIUC you are talking about a getMimeType() method. This method could 
>>> either be in the View interface (as it is now), or in the Viewable 
>>> interface. In either case the only way I see to force the resource 
>>> to actually set the mime-type is by adding a contract in javadoc, 
>>> like e.g. "The resource MUST always set a valid mime-type". Then the 
>>> servlet could throw an exception if a resource doesn't set a mime-type.
>>
>>
>>
>> exactly
>>
>>> I guess we could add such a contract to the the getMimeType() method 
>>> in the View interface.
>>> BTW, would it make sense to move the getSize() method from the 
>>> ViewableV2 interface to the View interface?
>>
>>
>>
>> Well, I think we should deprecate the View class and move the 
>> getMimeType into the Viewable interface.
>>
>> The reason for this is to allow "streaming", i.e. the resource can 
>> directly write into the response instead of creating an object like 
>> "View" first with a buffered InputStream
>
>
> If the resource is writing directly into the response, it will be 
> difficult for the servlet to manipulate the response.


agreed, but "streaming big data"  it's  basically a requirement

> IIUC your idea was that the servlet adds the toolbar by inserting some 
> code into the response. I don't quite see how those two things would 
> fit together.


using an iframe this should still work, but otherwise you're right, it 
wouldn't work

>
> About the toolbar, it might be a good idea to discuss the different 
> options (embed into html vs. frame) first because it's something that 
> won't be easy to change later on.


I have a prototype of the toolbar using iframe. You might want to give 
it a try by

URL?yanel.toolbar=on

resp.

URL?yanel.toolbar=off

whereas the iframe is causing some headaches, and you will notice very 
quickly ;-)

I am currently looking for alternatives :-)

>
> have a nice weekend,


u2 :-)

Michael

> josias
>
>>
>>>
>>>>
>>>> So I think we should either change the ViewableV2 interface (which 
>>>> hasn't be released yet) or introduce a new interface which takes 
>>>> care of the issues described above.
>>>
>>>
>>>
>>> How would the changed interface (or a new interface) look like?
>>
>>
>>
>> the changed interface would contain "getMimeType()", whereas I 
>> haven't though concretely about the WebViewable interface.
>>
>> Cheers
>>
>> Michi
>>
>>>
>>> Josias
>>>
>>>>
>>>> Another distinction we might want to make is between "web-viewable" 
>>>> and "viewable" in a more general sense.
>>>>
>>>> Hence I think it would make sense to introduce a WebViewable 
>>>> interface.
>>>>
>>>> WDYT?
>>>>
>>>> Cheers
>>>>
>>>> Michael
>>>>
>>>
>>>
>>> _______________________________________________
>>> Yanel-development mailing list
>>> Yanel-development at wyona.com
>>> http://wyona.com/cgi-bin/mailman/listinfo/yanel-development
>>>
>>
>>
>
>
> _______________________________________________
> Yanel-development mailing list
> Yanel-development at wyona.com
> http://wyona.com/cgi-bin/mailman/listinfo/yanel-development
>


-- 
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner at wyona.com                        michi at apache.org
+41 44 272 91 61




More information about the Yanel-development mailing list