Re: Handling authorization exception from server to client

2011-10-28 Thread André Salvati
Ok Thomas, understood.

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/qLLwHk25_3gJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Handling authorization exception from server to client

2011-10-27 Thread André Salvati

So, wasn't it supposed to enter the code bellow on
AbstractRequestContext? Is not it a general failure?? Maybe this is
an issue with RequestFactory...

if (response.getGeneralFailure() != null) {
ServerFailureMessage failure = response.getGeneralFailure();
ServerFailure fail =
new ServerFailure(failure.getMessage(),
failure.getExceptionType(), failure
.getStackTrace(), failure.isFatal());

fail(receiver, fail);
return;
  }



On Oct 26, 11:15 am, Thomas Broyer t.bro...@gmail.com wrote:
 F is present in I, meaning one particular invocation (service method
 call) failed, not the whole batch request (well, actually, S:[false]
 says the one and only invocation failed, then the object in I gives
 information about the failure).

 FYI, the response format is defined by the
 com.google.web.bindery.requestfactory.shared.messages.ResponseMessage
 AutoBean.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Handling authorization exception from server to client

2011-10-27 Thread Thomas Broyer
No, it's not a general failure, it's only a failure for one invocation. 
Look at few lines down in AbstractRequestContext:

  SetThrowable causes = null;
  for (int i = 0, j = invocations.size(); i  j; i++) {
try {
  if (response.getStatusCodes().get(i)) {

invocations.get(i).onSuccess(response.getInvocationResults().get(i));
  } else {
ServerFailureMessage failure = AutoBeanCodex.decode(
MessageFactoryHolder.FACTORY, ServerFailureMessage.class,
response.getInvocationResults().get(i)).as();
invocations.get(i).onFail(
new ServerFailure(failure.getMessage(),
failure.getExceptionType(), failure.getStackTrace(),
failure.isFatal()));
  }

response.getStatusCodes().get(i) reads from the S (in your case, returns 
'false', for i==0), and response.getInvocationResults().get(i) reads from 
the I (in your case, a ServerFailureMessage).

To be crystal clear:
requestContext.myMethod(arguments).to(new ReceiverX() {
@Override
public void onSuccess(X response) {
// won't get here
}
@Override
public void onFailure(ServerFailureMessage error) {
// will get there: the myMethod invocation failed; its Receiver's 
onFailure is called
}
});
requestContext.fire(new ReceiverVoid() {
@Override
public void onSuccess(Void response) {
// will get there: the myMethod invocation failed, but the whole 
batch succeeded: the context could have had other invocations that 
succeeded
}
});

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/R-fuY5miJ0oJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Handling authorization exception from server to client

2011-10-26 Thread André Salvati
Hi,

I've been working with GWT 2.4 and trying to send an authorization
exception from server to client whitout success.

1) Server:

A - Raise ReportableException throught report() on my
ServiceLayerDecorator.

B – Send the following JSON to the client:

{S:[false],I:[{F:true,M:Não
autorizado,X:com.google.web.bindery.requestfactory.server.ReportableException}]}

2) Client:

AbstractRequestContext doesn't enter on processPayload() → if
(response.getGeneralFailure() != null) because it doesn't find key
“F” (but “F” is there, isn't??)


What is wrong?

Is it the right way to treat this kind of exception?

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Handling authorization exception from server to client

2011-10-26 Thread Thomas Broyer
F is present in I, meaning one particular invocation (service method 
call) failed, not the whole batch request (well, actually, S:[false] 
says the one and only invocation failed, then the object in I gives 
information about the failure).

FYI, the response format is defined by the 
com.google.web.bindery.requestfactory.shared.messages.ResponseMessage 
AutoBean.

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/5JioRng87REJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.