|
From: Ryan J. M. <ry...@da...> - 2008-06-25 13:10:45
|
Yeah, I was planning on doing that as well, just not right away
because there's a few things I want to do. But I came across something
that i don't thing the spec supports: proving hints to providers.
Currently, the provider will always use the highest quality settings
for images that can be compressed. However, if I want to use a lower
setting there's not a good way to configure that. You could configure
this at the application level, but if I want to different
configurations for different resources, there's not a portable way to
do it.
This is an item that will also affect a FileProvider as well: where do
you read and write the files. The Jersey FileProvider uses temp files
which isn't very flexible. If I were writing files, I'd want to
specify a specific location. With that said, I was thinking about
something like this:
@POST
@ConsumeMime("*/*")
@ProviderHints(provider = FileProvider.class,
hints= {@Hint(name="basedir",value="/opt/files")})
public File processFile(File file) {
To define the root location for this resource. With this approach,
each resource could write files to different locations. For the
IIOImageProvider, you could do something like this to change the
compression level.
@POST
@ConsumeMime("image/*")
@ProduceMime("image/jpeg")
@ProviderHints(provider = IIOImageProvider.class,
hints= {@Hint(name="compresionQuality",value="0.6")})
public IIOImage transcodeImage(IIOImage image) {
In this case, we'd be overriding the default compression value to get
a more compressed image. There's still more thinking to be done, such
as is this just a class-level or method level annotation, etc.
However, i wanted to get some feedback on the idea.
Ryan-
On Jun 25, 2008, at 7:59 AM, Bill Burke wrote:
> Cool. Thanks man!
>
> Are you going to document your new providers on the Wiki too? If
> not, let me know and I'll get to it sometime.
>
> Ryan J. McDonough wrote:
>> I just committed a IIOImageProvider that could be useful if you
>> need/ want to handle image data. However, in the process I came
>> across an issue when trying to throw a WebApplictaionException
>> from the provider. The provider handles image/* since if you may
>> have an ImageIO plugin to read additional image formats beyond
>> what the stock JDK offers. If the provider cannot read the image,
>> it attempts to throw a WebApplictaionException issuing a 406
>> response with the list of variants that the provider can support.
>> However, the client always gets a 400 response. I have logged the
>> defect here:
>> http://jira.jboss.com/jira/browse/RESTEASY-63
>> Additionally, I also made some tweaks to the pom's by adding more
>> project information and additional reports.
>> Ryan-
>> -------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://sourceforge.net/services/buy/index.php
>> _______________________________________________
>> Resteasy-developers mailing list
>> Res...@li...
>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
|