|
From: Ryan J. M. <ry...@da...> - 2008-06-25 02:28:36
|
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- |
|
From: Bill B. <bb...@re...> - 2008-06-25 11:57:34
|
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 |
|
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
|
|
From: Bill B. <bb...@re...> - 2008-06-25 14:15:11
|
Ryan J. McDonough wrote:
> 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.
>
You don't need a @Hint in this case. Just create a new IIOImage
specific annotation
@POST
@ConsumeMime("image/*")
@ProduceMime("image/jpeg")
@CompressionQuality(0.2)
public IIOImage transcodeImage(@CompressionQuality(0.6) image) {...}
The @CompressionQuality annotation would be 0.6 for the
MessageBodyReader, 0.2 for Writer.
You get the list of annotations on the parameter for input, method for
output.
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Bill B. <bb...@re...> - 2008-06-25 14:20:28
|
Also, maybe the client could request a compression via a new ACCEPT header?
ACCEPT_COMPRESSION
Bill Burke wrote:
>
> Ryan J. McDonough wrote:
>> 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.
>>
>
> You don't need a @Hint in this case. Just create a new IIOImage
> specific annotation
>
> @POST
> @ConsumeMime("image/*")
> @ProduceMime("image/jpeg")
> @CompressionQuality(0.2)
> public IIOImage transcodeImage(@CompressionQuality(0.6) image) {...}
>
>
> The @CompressionQuality annotation would be 0.6 for the
> MessageBodyReader, 0.2 for Writer.
>
> You get the list of annotations on the parameter for input, method for
> output.
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Martin A. <sp...@ma...> - 2008-06-26 11:51:29
|
This is a minor I suppose.
Just had a quick look at the code. Is there a reason the test data is
under src/test/test-data rather than maven style src/test/resources
where it would get automatically copied to the class output where it
could be read using ClassLoader.getResourceAsStream()?
Two files involved me thinks:
TestDataSourceProvider.java: File file = new File("./src/test/test-
data/harper.jpg");
TestIIOImageProvider.java: private static final String SRC_ROOT =
"./src/test/test-data/";
TestIIOImageProvider.java: private static final String OUTPUT_ROOT
= "./target/test-data/";
M
On 25 Jun 2008, at 04:28, 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
|
|
From: Ryan M. <rmc...@sa...> - 2008-06-26 12:26:56
|
No reason I suppose. I'll make that change.
Ryan-
On 6/26/08 7:51 AM, "Martin Algesten" <sp...@ma...> wrote:
>
> This is a minor I suppose.
>
> Just had a quick look at the code. Is there a reason the test data is
> under src/test/test-data rather than maven style src/test/resources
> where it would get automatically copied to the class output where it
> could be read using ClassLoader.getResourceAsStream()?
>
> Two files involved me thinks:
>
> TestDataSourceProvider.java: File file = new File("./src/test/test-
> data/harper.jpg");
> TestIIOImageProvider.java: private static final String SRC_ROOT =
> "./src/test/test-data/";
> TestIIOImageProvider.java: private static final String OUTPUT_ROOT
> = "./target/test-data/";
>
> M
>
> On 25 Jun 2008, at 04:28, 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
>
>
> -------------------------------------------------------------------------
> 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
Ryan J. McDonough
Platform, Specialist Java EE | Sapient
131 Dartmouth St.
Boston, MA 02116
mobile: +1 508 735 4503
fax: +1 617 621 1300
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.
|