|
From: Rogan D. <ro...@da...> - 2008-01-30 09:29:26
|
Geoffrey De Smet wrote:
> Forms are ussually meant for domain objects or transfer objects.
> Just like it's pretty impossible to try to jpa-persist a (heavy)
> business service or DAO instance.
>
> Wouldn't the use case you describe be better off if you
> initialize the encodedBody before showing the form?
>
> With kind regards,
> Geoffrey De Smet
Let me give some more detail:
This is for WebScarab-NG, which is an HTTP testing tool (including an
intercepting proxy).
What I am modeling here is the HTTP Message (Request or Response), with
the following properties:
"startLine" ("GET http://example.com HTTP/1.0" or "HTTP/1.0 200 ok")
"headers" (NamedValue[])
"rawBody"
"decodedBody"
"decodedBody" is the result of applying the various transforms listed in
the "headers" (e.g "Transfer-Encoding: chunked" or "Content-Encoding:
gzip") to "rawBody". I don't actually store "decodedBody", but rather
update "rawBody" by applying the various transforms. Unfortunately, the
process of applying the transforms can generate IOExceptions, since I
push the data through (Input|Output)Streams such as GZIPInputStream.
So, the idea is that the user can edit various properties of the HTTP
message before sending the message to the server, and this should
obviously include setting the "rawBody" (if desired) or "decodedBody"
(likely easier). Naturally, the two properties should remain in sync,
modulo the transforms.
I have implemented PropertyChangeSupport for this object, so various
forms can be notified when the fields they are listening to are changed
as a result of other fields being modified. This is all working very well.
The only problem now is what to do when the "(get|set)DecodedBody"
methods throw an Exception. My preference is simply to allow the user to
continue editing, with a warning/error message until no exception is thrown.
Thanks for your help.
Rogan
P.S. is there an existing place to present the results of some of the
advice that I have received on this list? e.g. how to do the
Binder/Binding to String<->byte[], how to actually bind variables to
JComponents correctly, etc? I don't have my own blog (although I did
find http://spring-rich.blogspot.com/)
>
> Rogan Dawes schreef:
>> Hi folks,
>>
>> I am trying to deal with a derived property that can throw an exception
>> when set (or even when "get").
>>
>> The method signature is:
>>
>> byte[] getEncodedBody() throws IOException;
>> void setEncodedBody(byte[] body) throws IOException;
>>
>> As suggested, there are some cases where invalid data will cause an
>> IOException to be thrown. When this happens, I get "methodInvocation"
>> showing up in my form message area.
>>
>> Is there some way of handling this exception, and propagating the
>> underlying exception to the user? This appears to be handled somewhere
>> in the BeanPropertyAccessStrategy or BeanWrapperImpl, although I can't
>> see exactly where.
>>
>> Any ideas?
>>
>> Rogan
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Springframework-rcp-dev mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-rcp-dev
>
>
|