|
From: Rogan D. <li...@da...> - 2008-01-29 14:42:56
|
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 |
|
From: Geoffrey De S. <ge0...@gm...> - 2008-01-30 08:16:11
|
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 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/ |
|
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
>
>
|
|
From: Peter De B. <pet...@gm...> - 2008-01-30 09:53:51
|
I tried to reproduce this behaviour, but I failed. I'm not seeing
"methodInvocation" in my text area, instead the exception is handled
normally (a dialog with the error message is shown).
Can you show the implementation of your converter(s)?
the best place for the documentation is the reference manual. If you want,
you can create jira issues + patches, so we can put it in the reference
manual.
regards,
Peter
On 1/30/08, Rogan Dawes <ro...@da...> wrote:
>
> 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
> >
> >
>
>
> -------------------------------------------------------------------------
> 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
>
|
|
From: Peter De B. <pet...@gm...> - 2008-01-30 09:55:32
|
Indeed, I could add you as a writer, however I think it'd be better if this
stuff is put into the reference manual.
WDYT?
On 1/30/08, Jan Hoskens <jh...@sc...> wrote:
>
> Normally when any Exception pops up during the setting of a value, the
> exception is caught by the DefaultFormModel.ValidatingFormValueModel
> class and transformed to a bindingError. So if you get a error in your
> message area, it probably came from there. Note that there are some
> issues here: all listeners attached to the value change may also throw
> exceptions that are handled in the same manner. I did suggest a change
> here to provide an explicit binding exception that can be thrown in the
> accessStrategy to separate the good from the bad (so to speak). Normally
> this error should disappear if the value being set doesn't generate any
> exception. Does this work as expected?
>
> The getting of a value is another story. I don't think any handling is
> available at that point so an exception will probably be caught by the
> ExceptionHandler that you provide in your context.
>
> The developer blog was started by Peter. He could add you as a writer to
> the blog or we could post it in your name after a quick review. It would
> be nice to see some more stuff explained there.
>
> Additionally I've checked your project's website. It seems to be open
> source so I'm thinking of checking it out. It would be easier to
> actually see the problem than to write about it. I guess this isn't a
> problem?
>
> Kind Regards,
> Jan
>
> On Wed, 2008-01-30 at 11:27 +0200, Rogan Dawes wrote:
> > 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
> > >
> > >
> >
> >
> >
> -------------------------------------------------------------------------
> > 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
>
>
> **** DISCLAIMER ****
> http://www.schaubroeck.be/maildisclaimer.htm
>
> -------------------------------------------------------------------------
> 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
>
|
|
From: Jan H. <jh...@sc...> - 2008-01-30 10:02:45
|
I would think that the blog is exactly for that purpose: showing a
specific example of how to work with converters. The converter mechanism
should however be a part of the manual. Possibly with an example which
might be the same as on the blog but preferably not.
Kind Regards,
Jan
On Wed, 2008-01-30 at 10:55 +0100, Peter De Bruycker wrote:
> Indeed, I could add you as a writer, however I think it'd be better if
> this stuff is put into the reference manual.
>
> WDYT?
>
>
> On 1/30/08, Jan Hoskens <jh...@sc...> wrote:
> Normally when any Exception pops up during the setting of a
> value, the
> exception is caught by the
> DefaultFormModel.ValidatingFormValueModel
> class and transformed to a bindingError. So if you get a error
> in your
> message area, it probably came from there. Note that there are
> some
> issues here: all listeners attached to the value change may
> also throw
> exceptions that are handled in the same manner. I did suggest
> a change
> here to provide an explicit binding exception that can be
> thrown in the
> accessStrategy to separate the good from the bad (so to
> speak). Normally
> this error should disappear if the value being set doesn't
> generate any
> exception. Does this work as expected?
>
> The getting of a value is another story. I don't think any
> handling is
> available at that point so an exception will probably be
> caught by the
> ExceptionHandler that you provide in your context.
>
> The developer blog was started by Peter. He could add you as a
> writer to
> the blog or we could post it in your name after a quick
> review. It would
> be nice to see some more stuff explained there.
>
> Additionally I've checked your project's website. It seems to
> be open
> source so I'm thinking of checking it out. It would be easier
> to
> actually see the problem than to write about it. I guess this
> isn't a
> problem?
>
> Kind Regards,
> Jan
>
> On Wed, 2008-01-30 at 11:27 +0200, Rogan Dawes wrote:
> > 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
> > >
> > >
> >
> >
> >
> -------------------------------------------------------------------------
> > 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
>
>
> **** DISCLAIMER ****
> http://www.schaubroeck.be/maildisclaimer.htm
>
> -------------------------------------------------------------------------
> 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
>
> -------------------------------------------------------------------------
> 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
**** DISCLAIMER ****
http://www.schaubroeck.be/maildisclaimer.htm
|
|
From: Peter De B. <pet...@gm...> - 2008-01-30 10:16:22
|
agreed. Any volunteers? ;-)
On 1/30/08, Jan Hoskens <jh...@sc...> wrote:
>
> I would think that the blog is exactly for that purpose: showing a
> specific example of how to work with converters. The converter mechanism
> should however be a part of the manual. Possibly with an example which
> might be the same as on the blog but preferably not.
>
> Kind Regards,
> Jan
>
> On Wed, 2008-01-30 at 10:55 +0100, Peter De Bruycker wrote:
> > Indeed, I could add you as a writer, however I think it'd be better if
> > this stuff is put into the reference manual.
> >
> > WDYT?
> >
> >
> > On 1/30/08, Jan Hoskens <jh...@sc...> wrote:
> > Normally when any Exception pops up during the setting of a
> > value, the
> > exception is caught by the
> > DefaultFormModel.ValidatingFormValueModel
> > class and transformed to a bindingError. So if you get a error
> > in your
> > message area, it probably came from there. Note that there are
> > some
> > issues here: all listeners attached to the value change may
> > also throw
> > exceptions that are handled in the same manner. I did suggest
> > a change
> > here to provide an explicit binding exception that can be
> > thrown in the
> > accessStrategy to separate the good from the bad (so to
> > speak). Normally
> > this error should disappear if the value being set doesn't
> > generate any
> > exception. Does this work as expected?
> >
> > The getting of a value is another story. I don't think any
> > handling is
> > available at that point so an exception will probably be
> > caught by the
> > ExceptionHandler that you provide in your context.
> >
> > The developer blog was started by Peter. He could add you as a
> > writer to
> > the blog or we could post it in your name after a quick
> > review. It would
> > be nice to see some more stuff explained there.
> >
> > Additionally I've checked your project's website. It seems to
> > be open
> > source so I'm thinking of checking it out. It would be easier
> > to
> > actually see the problem than to write about it. I guess this
> > isn't a
> > problem?
> >
> > Kind Regards,
> > Jan
> >
> > On Wed, 2008-01-30 at 11:27 +0200, Rogan Dawes wrote:
> > > 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
> > > >
> > > >
> > >
> > >
> > >
> >
> -------------------------------------------------------------------------
> > > 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
> >
> >
> > **** DISCLAIMER ****
> > http://www.schaubroeck.be/maildisclaimer.htm
> >
> >
> -------------------------------------------------------------------------
> > 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
> >
> >
> -------------------------------------------------------------------------
> > 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
>
>
> **** DISCLAIMER ****
> http://www.schaubroeck.be/maildisclaimer.htm
>
> -------------------------------------------------------------------------
> 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
>
|
|
From: Jan H. <jh...@sc...> - 2008-01-30 10:30:08
|
Volunteers? Ok, pick a number between 1 and 10 ... :)
Just to inform you: Lieven (a co-worker) will try to write something
about the rules. I'm struggling with a quick start and some more info on
the formModel/valueModel stuff.
I'll probably send a status mail later this evening concerning the
things we still need to do (issues) and the upcoming release.
Kind Regards,
Jan
On Wed, 2008-01-30 at 11:16 +0100, Peter De Bruycker wrote:
> agreed. Any volunteers? ;-)
>
> On 1/30/08, Jan Hoskens <jh...@sc...> wrote:
> I would think that the blog is exactly for that purpose:
> showing a
> specific example of how to work with converters. The converter
> mechanism
> should however be a part of the manual. Possibly with an
> example which
> might be the same as on the blog but preferably not.
>
> Kind Regards,
> Jan
>
> On Wed, 2008-01-30 at 10:55 +0100, Peter De Bruycker wrote:
> > Indeed, I could add you as a writer, however I think it'd be
> better if
> > this stuff is put into the reference manual.
> >
> > WDYT?
> >
> >
> > On 1/30/08, Jan Hoskens <jh...@sc...> wrote:
> > Normally when any Exception pops up during the
> setting of a
> > value, the
> > exception is caught by the
> > DefaultFormModel.ValidatingFormValueModel
> > class and transformed to a bindingError. So if you
> get a error
> > in your
> > message area, it probably came from there. Note that
> there are
> > some
> > issues here: all listeners attached to the value
> change may
> > also throw
> > exceptions that are handled in the same manner. I
> did suggest
> > a change
> > here to provide an explicit binding exception that
> can be
> > thrown in the
> > accessStrategy to separate the good from the bad (so
> to
> > speak). Normally
> > this error should disappear if the value being set
> doesn't
> > generate any
> > exception. Does this work as expected?
> >
> > The getting of a value is another story. I don't
> think any
> > handling is
> > available at that point so an exception will
> probably be
> > caught by the
> > ExceptionHandler that you provide in your context.
> >
> > The developer blog was started by Peter. He could
> add you as a
> > writer to
> > the blog or we could post it in your name after a
> quick
> > review. It would
> > be nice to see some more stuff explained there.
> >
> > Additionally I've checked your project's website. It
> seems to
> > be open
> > source so I'm thinking of checking it out. It would
> be easier
> > to
> > actually see the problem than to write about it. I
> guess this
> > isn't a
> > problem?
> >
> > Kind Regards,
> > Jan
> >
> > On Wed, 2008-01-30 at 11:27 +0200, Rogan Dawes
> wrote:
> > > 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
> > > >
> > > >
> > >
> > >
> > >
> >
> -------------------------------------------------------------------------
> > > 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
> >
> >
> > **** DISCLAIMER ****
> > http://www.schaubroeck.be/maildisclaimer.htm
> >
> >
> -------------------------------------------------------------------------
> > 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
> >
> >
> -------------------------------------------------------------------------
> > 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
>
>
> **** DISCLAIMER ****
> http://www.schaubroeck.be/maildisclaimer.htm
>
> -------------------------------------------------------------------------
> 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
>
> -------------------------------------------------------------------------
> 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
**** DISCLAIMER ****
http://www.schaubroeck.be/maildisclaimer.htm
|
|
From: Geoffrey De S. <ge0...@gm...> - 2008-01-30 09:50:05
|
It's a good use case.
I wonder if you might be better off with only allowing setRawBody() and
then use a custom binding which convert decoded input into rawBody?
That binder can then notify the user that it's corrupt input,
in exactly the same way what happens if you input "blub" into a
textfield binded to an int value with a number binder.
With kind regards,
Geoffrey De Smet
Rogan Dawes schreef:
> 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
>>
>>
>
>
> -------------------------------------------------------------------------
> 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/
|
|
From: Rogan D. <ro...@da...> - 2008-01-30 10:26:41
|
Geoffrey De Smet wrote:
> It's a good use case.
>
> I wonder if you might be better off with only allowing setRawBody() and
> then use a custom binding which convert decoded input into rawBody?
> That binder can then notify the user that it's corrupt input,
> in exactly the same way what happens if you input "blub" into a
> textfield binded to an int value with a number binder.
>
>
> With kind regards,
> Geoffrey De Smet
That sounds like a good idea, with one caveat:
Since my "decodedBody" depends on the value of "headers", the Binder
would need to have access to the "headers" ValueModel as well as the
"rawBody" ValueModel.
The Binder would obviously need to be constructed manually, rather than
using a FormBuilder.
Hmmm, looking at it a little more, I could make the "headers" property
name be an attribute of the "context" that is passed in the
Binder.bind() call (currently an EMPTY_MAP):
Binder headerBinder = new TextAreaBinder();
Binding headerBinding = headerBinder.bind(getFormModel(),
IMessage.PROPERTY_RAW_HEADER, Collections.EMPTY_MAP);
JComponent ta = headerBinding.getComponent();
Rogan
>
> Rogan Dawes schreef:
>> 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
>>>
>>>
>>
>> -------------------------------------------------------------------------
>> 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
>
>
|
|
From: Jan H. <jh...@sc...> - 2008-01-30 09:51:12
|
Normally when any Exception pops up during the setting of a value, the
exception is caught by the DefaultFormModel.ValidatingFormValueModel
class and transformed to a bindingError. So if you get a error in your
message area, it probably came from there. Note that there are some
issues here: all listeners attached to the value change may also throw
exceptions that are handled in the same manner. I did suggest a change
here to provide an explicit binding exception that can be thrown in the
accessStrategy to separate the good from the bad (so to speak). Normally
this error should disappear if the value being set doesn't generate any
exception. Does this work as expected?
The getting of a value is another story. I don't think any handling is
available at that point so an exception will probably be caught by the
ExceptionHandler that you provide in your context.
The developer blog was started by Peter. He could add you as a writer to
the blog or we could post it in your name after a quick review. It would
be nice to see some more stuff explained there.
Additionally I've checked your project's website. It seems to be open
source so I'm thinking of checking it out. It would be easier to
actually see the problem than to write about it. I guess this isn't a
problem?
Kind Regards,
Jan
On Wed, 2008-01-30 at 11:27 +0200, Rogan Dawes wrote:
> 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
> >
> >
>
>
> -------------------------------------------------------------------------
> 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
**** DISCLAIMER ****
http://www.schaubroeck.be/maildisclaimer.htm
|
|
From: Rogan D. <ro...@da...> - 2008-01-30 10:38:24
|
Jan Hoskens wrote: > Normally when any Exception pops up during the setting of a value, the > exception is caught by the DefaultFormModel.ValidatingFormValueModel > class and transformed to a bindingError. So if you get a error in your > message area, it probably came from there. Note that there are some > issues here: all listeners attached to the value change may also throw > exceptions that are handled in the same manner. I did suggest a change > here to provide an explicit binding exception that can be thrown in the > accessStrategy to separate the good from the bad (so to speak). Normally > this error should disappear if the value being set doesn't generate any > exception. Does this work as expected? Yes, the methodInvocation comes and goes as I type valid and invalid input. > The getting of a value is another story. I don't think any handling is > available at that point so an exception will probably be caught by the > ExceptionHandler that you provide in your context. Mmm. I guess I should rather return "null", instead of throwing the exception. This would fit in with the PropertyChangeEvent I fire when someone changes the "rawBody" in such a way as to make "getDecodedBody()" throw an exception. > The developer blog was started by Peter. He could add you as a writer to > the blog or we could post it in your name after a quick review. It would > be nice to see some more stuff explained there. Either way would be good, although perhaps putting it up on the website is a better idea, as suggested. (Probably the "quick review" would be a good idea!) > Additionally I've checked your project's website. It seems to be open > source so I'm thinking of checking it out. It would be easier to > actually see the problem than to write about it. I guess this isn't a > problem? This particular piece of code has not been published yet, of course. And in fact, I am working on reimplementing the underpinnings (i.e. rewriting the Message/Request/Response objects) at the moment, which will eventually make its way into the mainline. Of course, I'd love to get feedback on how I've done various things such as constructing custom forms, etc. e.g. in one form I present the Request as a TreeModel, with the request line and subsequent headers as top level nodes (root is hidden), and the ability to expand the requestLine to see/modify the values of any URL parameters, and similarly for any Cookie headers (which often have more than one cookie in a single header). You can browse the code using gitweb (http://dawes.za.net/gitweb.cgi?p=rogan/webscarab-ng/webscarab-ng.git) then follow the "tree" link). The "Request as a Tree" form is at: <http://dawes.za.net/gitweb.cgi?p=rogan/webscarab-ng/webscarab-ng.git;a=blob;f=src/main/java/org/owasp/webscarab/ui/rcp/forms/ParsedRequestForm.java;h=db2769a1c73ddb680cdf4bf0ce4b43a28e1076b3;hb=HEAD> if you want to see some seriously kludgy code :-) Suggestions much appreciated! Rogan |