On Dec 30, 2008, at 7:13 PM, Markus KARG wrote:
> I currently have defined header constants like "Depth", as defined
> by the WebDAV spec. I have seen that some of them are defined in the
> WebDAV spec to be actually not Strings but enums, i. e. for example,
> the WebDAV "Depth" header must only be one of the Strings "0", "1"
> or "infinity". So to prevent people from incidentially using "2",
> "3" or "infinte" as an invalid header value, it would be great to
> make that particular header not a String but an enum. Is that
> possible in JAX-RS? For example, can I use an enum in a method as a
> @HeaderParam variable?
IIRC it is possible to use Enum classes, i recommend experimenting
with a simple class.
> Like:
>
> @PROPFIND
> public MultiStatus propfind(@HeaderParam final DepthEnum depth)
@HeaderParam("Depth")
>
> Will Jersey be able to parse the header value "0" to inject
> Depth.ZERO here?
If "0" is the value of the enum constant then i think yes.
>
> If possible, then I will overhaul the code once more before
> committing it, since it is so much easier to work with enums. :-)
Is Depth associated with all forms of WebDAV method or with particular
methods.
The reason i ask is that you might be able to combine the request
entity with headers without your own special type and message body
reader (as they are also capable of getting request header information).
Paul.