You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by Andreas Hartmann <an...@apache.org> on 2009/02/03 16:29:44 UTC

[Proposal] ResourceType.getSupportedMimeTypes()

Hi Lenya devs,

I'd like to introduce the method

   String[] ResourceType.getSupportedMimeTypes()

Purpose:

* Resource types can be restricted to particular mime types.

* When a document is created, the repository can throw an exception if 
the mime type is not supported by the resource type.

* Upload (and WebDAV access etc.) can be safely enabled for various 
resource types.

* The Firedocs editor (and maybe other editors?) requires a list of 
mime-types for asset upload. IMO configuring this at resource type level 
makes the most sense.


The configuration could look like this, e.g. for the "resource" resource 
type:

   <mime-types>
     image/jpg, image/gif, image/png,
     application/pdf
   </mime-types>

At a first glance it would be appealing to support wildcards (e.g., 
image/*), but AFAIK this wouldn't be compatible with Firedocs. (@Thomas: 
is this correct?)


WDYT?

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: [Proposal] ResourceType.getSupportedMimeTypes()

Posted by Andreas Hartmann <an...@apache.org>.
Felix Roethenbacher schrieb:
> Andreas Hartmann wrote:
>> Felix Röthenbacher schrieb:
>>> Andreas Hartmann schrieb:

[…]

>>> Better
>>>
>>> <supports>
>>>   <mime-type>image/jpg</mime-type>
>>>   <mime-type>image/gif</mime-type>
>>>   <mime-type>image/png</mime-type>
>>>   <mime-type>application/pdf</mime-type>
>>> </supports>
>>
>> Is the intention of the generic <supports> element to allow for later 
>> additions, like e.g. a maximum content-length value? Otherwise I find 
>> it a bit unusual to use a generic element as the parent of specific 
>> elements. Most schemas would probably use
>>
>> <mime-types>
>>   <mime-type>image/jpg</mime-type>
>>   <mime-type>image/gif</mime-type>
>>   <mime-type>image/png</mime-type>
>>   <mime-type>application/pdf</mime-type>
>> </mime-types>

> This suggestion comes from the portlet deployment descriptor where they
> use the <supports> tag to define the allowed mime-types for a portlet.
> Using <supports> makes clear that the following mime-types are
> supported.

This sounds reasonable.

> If you want to keep it open for later additions it would be better to
> use
> 
> <supports>
>   <mime-types>
>     <mime-type>image/jpg</mime-type>
>   </mime-types>
>   <some-addition> ... </some-addition>
> </supports>

I'm not sure if this is necessary – the portlet descriptor schema 
doesn't use an additional hierarchy either:

<supports>
   <mime-type>text/html</mime-type>
   <portlet-mode>edit</portlet-mode>
   <portlet-mode>help</portlet-mode>
   …
</supports>

So I'd be fine with your first suggestion (at the top of this mail). Is 
this OK for the others?

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: [Proposal] ResourceType.getSupportedMimeTypes()

Posted by Felix Roethenbacher <fr...@apache.org>.
Andreas Hartmann wrote:
> Felix Röthenbacher schrieb:
>> Andreas Hartmann schrieb:
> 
>>> I'd like to introduce the method
>>>
>>>   String[] ResourceType.getSupportedMimeTypes()
>>>
>>> Purpose:
>>>
>>> * Resource types can be restricted to particular mime types.
>>>
>>> * When a document is created, the repository can throw an exception 
>>> if the mime type is not supported by the resource type.
>>>
>>> * Upload (and WebDAV access etc.) can be safely enabled for various 
>>> resource types.
>>>
>>> * The Firedocs editor (and maybe other editors?) requires a list of 
>>> mime-types for asset upload. IMO configuring this at resource type 
>>> level makes the most sense.
>>>
>>>
>>> The configuration could look like this, e.g. for the "resource" 
>>> resource type:
>>>
>>>   <mime-types>
>>>     image/jpg, image/gif, image/png,
>>>     application/pdf
>>>   </mime-types>
>>>
>>
>> Better
>>
>> <supports>
>>   <mime-type>image/jpg</mime-type>
>>   <mime-type>image/gif</mime-type>
>>   <mime-type>image/png</mime-type>
>>   <mime-type>application/pdf</mime-type>
>> </supports>
> 
> Is the intention of the generic <supports> element to allow for later 
> additions, like e.g. a maximum content-length value? Otherwise I find it 
> a bit unusual to use a generic element as the parent of specific 
> elements. Most schemas would probably use
> 
> <mime-types>
>   <mime-type>image/jpg</mime-type>
>   <mime-type>image/gif</mime-type>
>   <mime-type>image/png</mime-type>
>   <mime-type>application/pdf</mime-type>
> </mime-types>
> 
> But I'm +0 to use <supports> as the parent.
> 
> WDOT?
> 
> -- Andreas
> 
> 

This suggestion comes from the portlet deployment descriptor where they
use the <supports> tag to define the allowed mime-types for a portlet. 
Using <supports> makes clear that the following mime-types are
supported.

If you want to keep it open for later additions it would be better to
use

<supports>
   <mime-types>
     <mime-type>image/jpg</mime-type>
   </mime-types>
   <some-addition> ... </some-addition>
</supports>


- Felix

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: [Proposal] ResourceType.getSupportedMimeTypes()

Posted by Andreas Hartmann <an...@apache.org>.
Felix Röthenbacher schrieb:
> Andreas Hartmann schrieb:

>> I'd like to introduce the method
>>
>>   String[] ResourceType.getSupportedMimeTypes()
>>
>> Purpose:
>>
>> * Resource types can be restricted to particular mime types.
>>
>> * When a document is created, the repository can throw an exception if 
>> the mime type is not supported by the resource type.
>>
>> * Upload (and WebDAV access etc.) can be safely enabled for various 
>> resource types.
>>
>> * The Firedocs editor (and maybe other editors?) requires a list of 
>> mime-types for asset upload. IMO configuring this at resource type 
>> level makes the most sense.
>>
>>
>> The configuration could look like this, e.g. for the "resource" 
>> resource type:
>>
>>   <mime-types>
>>     image/jpg, image/gif, image/png,
>>     application/pdf
>>   </mime-types>
>>
> 
> Better
> 
> <supports>
>   <mime-type>image/jpg</mime-type>
>   <mime-type>image/gif</mime-type>
>   <mime-type>image/png</mime-type>
>   <mime-type>application/pdf</mime-type>
> </supports>

Is the intention of the generic <supports> element to allow for later 
additions, like e.g. a maximum content-length value? Otherwise I find it 
a bit unusual to use a generic element as the parent of specific 
elements. Most schemas would probably use

<mime-types>
   <mime-type>image/jpg</mime-type>
   <mime-type>image/gif</mime-type>
   <mime-type>image/png</mime-type>
   <mime-type>application/pdf</mime-type>
</mime-types>

But I'm +0 to use <supports> as the parent.

WDOT?

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch
Tel.: +41 (0) 43 818 57 01


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


Re: [Proposal] ResourceType.getSupportedMimeTypes()

Posted by Felix Röthenbacher <fr...@apache.org>.
Andreas Hartmann schrieb:
> Hi Lenya devs,
> 
> I'd like to introduce the method
> 
>   String[] ResourceType.getSupportedMimeTypes()
> 
> Purpose:
> 
> * Resource types can be restricted to particular mime types.
> 
> * When a document is created, the repository can throw an exception if 
> the mime type is not supported by the resource type.
> 
> * Upload (and WebDAV access etc.) can be safely enabled for various 
> resource types.
> 
> * The Firedocs editor (and maybe other editors?) requires a list of 
> mime-types for asset upload. IMO configuring this at resource type level 
> makes the most sense.
> 
> 
> The configuration could look like this, e.g. for the "resource" resource 
> type:
> 
>   <mime-types>
>     image/jpg, image/gif, image/png,
>     application/pdf
>   </mime-types>
> 

Better

<supports>
   <mime-type>image/jpg</mime-type>
   <mime-type>image/gif</mime-type>
   <mime-type>image/png</mime-type>
   <mime-type>application/pdf</mime-type>
</supports>

and no wildcards.

- Felix

> At a first glance it would be appealing to support wildcards (e.g., 
> image/*), but AFAIK this wouldn't be compatible with Firedocs. (@Thomas: 
> is this correct?)
> 
> 
> WDYT?
> 
> -- Andreas
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org