GWT 2.4.0. rc1 Could not find static method with a single parameter of a key type
Hi all, I have one entity Device that is stored in database and Two proxies for that entity, one EntityProxy and one ValueProxy. class Device { @Id private Long id; public Long getId(); public Integer getVersion(); public String getMac(); public void setMac(String mac); } The entity proxy for Device entity is: @ProxyFor(value = Device.class, locator = DeviceLocator.class) interface DeviceProxy extends EntityProxy { String getMac(); void setMac(String mac); } The value proxy for Device entity is: @ProxyFor(Device.class) public interface DeviceInfoProxy extends ValueProxy { String getMac(); } I load devices from server with methods: RequestListDeviceProxy getAllDevices(); RequestDeviceInfoProxy getDeviceWithMac(String mac); with version GWT 2.2.0 this works just fine. I migrate to version GWT 2.4.0 rc1 and when I try to load devices I receive error: com.google.web.bindery.requestfactory.server.UnexpectedException: Could not find static method with a single parameter of a key type at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.die(ServiceLayerDecorator.java:216) at com.google.web.bindery.requestfactory.server.ReflectiveServiceLayer.getFind(ReflectiveServiceLayer.java:253) at com.google.web.bindery.requestfactory.server.ReflectiveServiceLayer.getFind(ReflectiveServiceLayer.java:271) at com.google.web.bindery.requestfactory.server.ReflectiveServiceLayer.getFind(ReflectiveServiceLayer.java:271) at com.google.web.bindery.requestfactory.server.ReflectiveServiceLayer.isLive(ReflectiveServiceLayer.java:200) at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.isLive(ServiceLayerDecorator.java:116) at com.google.web.bindery.requestfactory.server.LocatorServiceLayer.doIsLive(LocatorServiceLayer.java:186) at com.google.web.bindery.requestfactory.server.LocatorServiceLayer.isLive(LocatorServiceLayer.java:85) at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.isLive(ServiceLayerDecorator.java:116) at com.google.web.bindery.requestfactory.server.ServiceLayerDecorator.isLive(ServiceLayerDecorator.java:116) at com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.createReturnOperations(SimpleRequestProcessor.java:270) ... and so on. So from the stack trace above I understand that for some reason, DeviceLocator for Device entity is not used and Request Factory tries to find static method findDevice in Device object, and when that method is not found throw exception. I debug and notice that in ServiceLayerCache in method getOrCache(), when methodMap is filled, for Device entity create Pair object with Device and BaseProxy, and in the map do not put any locator for Device entity. So I add DeviceLocator to DeviceInfoProxy (that is ValueProxy). This fixed the problem, but I do not understand what was the problem? why this fix the problem? and is this the right way to fix the problem? I do not have problem with another Entity objects or proxies in my project. I just have this problem only for Device entity and Device entity is the only one entity that have Two DTO (EntityProxy/ValueProxy) objects. Thanks, Lazo Apostolovski -- 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/-/m4yVVnGytC0J. 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.
GWT History Chrome encoding problem.
Hello I have an encoding issue with Chrome and history tokens that contains a cyrillic characters. Example: I set browser history as History.newItem(?query=кирилица); this should modify browser url to http://host:8080/#search;q=кирилица; in Mozilla browser works fine but when I use Chrome browser URL looks like this: http://host:8080/#search;q=%D0%BB%D0%B0%D0%B7%D0%BE; Any idea how this could be fixed? Thans. -- 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/-/QfqIPonFY_QJ. 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.
RequestContext method with enumeration parameter
Hi there, I use gwt request factory to load some object from server. I'll give an example code: https://gist.github.com/886743http://www.google.com/url?sa=Dq=https%3A%2F%2Fgist.github.com%2F886743 This code works just fine in GWT Hosted mode. But problem appears when I compile GWT code to JavaScript. For some reason, FooState enumeration can't be serialized. Java script throws: Uncaught java.lang.UnsupportedOperationException: com.google.gwt.core.client.JavaScriptObject$ And request factory does not send anything to the server. This bug appears only when I give enumeration as parameter in RequestContext method, in compiled JavaScript code. In hosted mode I dont have any problems with this. -- 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: RequestFactory Entity validation.
I make a workaround to support validating by groups. Because RequestFactory validation, validate each received object separately, validation groups have to be transported separated from payload. The workaround: In the client code I create one helper object called, ValidationHelper. This object have static methods and fields. With calling static method addGroups() I define sequence from validation groups, that will be used for validating all object transfered by payload. I override configureRequestBuilder() and send() methods in DefaultRequestTransport, and I make to add all validation group sequence to be added in the request header. On the server code I get this header from request, split groups to get group class name, and I use reflection to get proper group instances. I provide this groups in ServiceLayerDecorator class and get them every time when validate() method is called. Here is the example of how this thing work. https://gist.github.com/837364 Cheers. On Sun, Feb 20, 2011 at 11:22 AM, Lars lars...@gmail.com wrote: I'm also wondering about this. Another example would be if you want to use the User-bean for creation of users - as well as editing (different constraints). I guess there's no way to do this today? One possible way to implement this could perhaps be to allow annotations on the methods in the (extensions of) RequestContext. E.g: @ValidationGroup(value={group1, group2}) /Lars On Feb 7, 3:11 pm, Lazo Apostolovski lazo.apostolov...@gmail.com wrote: Hello group. I use GWT RequestFactory and Hibernate validation to make syntactic validation. I have one object who need to be validated, but in different cases I need validation on different fields. Short example: class User { @NotNull private String name; @NotNull private String nickName; } In one case I want to load User by name, and want to perform syntactic validation only by name field. In other case validation need to be performed by nickname. Is there any way to use Validating Groups? any other solution? -- 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. -- 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: FocusWidget fired repeats the event
How many times you add new ClickHandler? I think that you add more then one different handlers, who listening for click event. TextBox.addClickHandler(new ClickHandler(){}). Maybe when page reload or something. Try to debug how many different instances you are creating and adding. -- 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: Partial bean validation
Hello any body please? Its realized? Its not realized? Will be realized? Patch is needed? Cant be realized? Isn't planed? Any answer? -- 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: Partial bean validation
Is this somehow related with this issue? http://code.google.com/p/google-web-toolkit/issues/detail?id=5801 -- 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.
Partial bean validation
Hello group. I use request factory to transfer entity, from client side to server site. Transfered entity should be validate and persisted. For entity validation I use JSR303 validation. But in different cases I need to validate different properties of the entity. JSR303 validation give opportunity to use groups to make partial validation on the object. https://gist.github.com/816186http://www.google.com/url?sa=Dq=https%3A%2F%2Fgist.github.com%2F816186 I make a little exploration, on how the bean validation is performed by request factory servlet. I found that validation for each received object is performed by SimpleRequestProcessor on line 527. I use GWT-2.1.1 version. This code: 519: private ListViolationMessage validateEntities(RequestState source) { 520: ListViolationMessage errorMessages = new ArrayListViolationMessage(); 521: for (Map.EntrySimpleProxyId?, AutoBean? extends BaseProxy entry : source.beans.entrySet()) { 522: AutoBean? extends BaseProxy bean = entry.getValue(); 523: Object domainObject = bean.getTag(Constants.DOMAIN_OBJECT); 524: 525: // The object could have been deleted 526: if (domainObject != null) { 527: SetConstraintViolationObject errors = service.validate(domainObject); 528: if (errors != null !errors.isEmpty()) { 529: SimpleProxyId? id = entry.getKey(); RequestFactory allways use default group to make validation. Is there any way to make partial validation on a bean, by using groups? Any workaround? Any idea? Is there any way for validation groups to be implemented in gwt request factory in the future? Maybe the validation group (or group sequences) to be defined, before firing request? Example: RequestMyProxy request = RequestFactory.getMyProxyRequest(); request.checkGroup(MyGroup.class).fire(new ReceiverMyProxy(){...} -- 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: ScrollPanel not taking the full height (100%)
Wrap the child in g:HTMLPanel /g:HTMLPanel -- 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.
RequestFactory Entity validation.
Hello group. I use GWT RequestFactory and Hibernate validation to make syntactic validation. I have one object who need to be validated, but in different cases I need validation on different fields. Short example: class User { @NotNull private String name; @NotNull private String nickName; } In one case I want to load User by name, and want to perform syntactic validation only by name field. In other case validation need to be performed by nickname. Is there any way to use Validating Groups? any other solution? -- 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: RequestFactory strange behavior.
Anybody? is this a bug or I make something wrong? -- 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.
RequestFactory strange behavior.
WHAT I HAVE: I have a form who contains some ValueBoxEditorDecorator elements (who are text boxes). In one of that element's, customer write his private number. Customer private number is validated with JSR303 validation. I use gwt 2.1.1. I have 3 cases: 1. If customer number isn't valid, message is displayed near input box. 2. If number is valid and customer didn't exist in database, server throwsan exception and enable register customer button so customer can be registered in the system. 3. If customer is found, customer data is loaded in other fields and we are all happy :) The code who do the whole thing is: class CustomerEditorView extends Composite implements EditorCustomerProxy { interface Driver extends RequestFactoryEditorDriverCustomerProxy, CustomerEditorView{} Driver driver = GWT.create(Driver.class); @UiField ValueBoxEditorDecoratorString firstName; @UiField ValueBoxEditorDecoratorString surname; @UiField ValueBoxEditorDecoratorString code; CustomerRequest request; CustomerProxy customer; public CustomerEditorViewImpl() { initWidget(uiBinder.createAndBindUi(this)); driver.initialize(this); } public void edit(CustomerProxy customer) { // create request who will manage this proxy request = requestFactory.customerRequest(); // if customer is null create new empty proxy if (customer == null || Strings.empty(customer.getCode())) { customer = request.create(CustomerProxy.class); } if (this.customer != customer) { customer = CustomerProxyCopier.copy(customer, request); // create new proxy and make a deep copy } this.customer = customer; driver.initialize(this); driver.edit(this.customer, request); } // this method need to check if customer is registered in the system // if customer is registered then return customer data and fill another fields // if customer is not registered catch exception and enable register customer button. // if customer code isn't valid show validation error message public void onCheckCustomerButtomPressed(String code){ driver.flush(); request.getCustomerByCode(String code).fire(new ReceiverCustomerProxy(){ @Override public void onSuccess(CustomerProxy response) { edit(response); // calls upper method } @Override public void onFailure(ServerFailure error) { enableRegisterButton(); // adds customer to edit again BECAUSE // if not added again proxy is locked, cant be modified, // method driver.flush() can't be called // newly added customer information can't be loaded from editor to proxy display(customer); } @Override public void onViolation(SetViolation errors) { driver.setViolations(errors); } }); } } THE STORY: When the form is loaded for first time, CustomerEditorView.edit() method is called with null parameter. That method gets new Request, create new empty proxy and add proxy to the editor driver. Customer write his code in code field, and press check button. Check button calls method onCheckCustomerButtomPressed() and give customer code as parameter. Request factory send code to the server. But customer make a mistake and wrote wrong code. JSR303 validation validate the code and return validation error message Receiver.onViolation() method is called, and message is displayed on the screen. Customer see the error, make code correction and press check button. Now the code is valid and system check if user exists in database. When user doesn't exist, system throws exception and Receiver.onFailure() method is called. When this method is called, proxy is locked and can't be edited. So edit method is called again to create new proxy with which I can work with. Now customer fill another field's and press the registerbutton. However customer edit and his code and again the code validation fail. System return validation message and Receiver.onViolation() method is called again and driver.setViolations(errors); is executed again. THE PROBLEM: The problem is that when driver.setViolations(errors) is called, errors isn't displayed on the screen. In my investigation I get to: class AbstractRequestFactoryEditorDriver line 163-164 // Only attach the error to the first delegate in a co-editor chain. leafDelegates.get(0).recordError(error.getMessage(), null, error); in this code, the first element from leafDelagates is allways used to show violation errors. But when another object is given to the editor, he is added in leafDelegates array as second element. (or N element if user reusedriver N times driver.edit()). But when violation errors is loaded they are allwaysdispatched to first leafElement. The error isn't displayed because error is given to wrong delegate and proxy is different. I try to call driverInitialize before driver edit method but without efect. Does we allways need to get first element from leaf and give him errors? What if we get the last element, that one who is last added and proxy points to him? -- You received this message because you are subscribed to the
Receiver.onViolation() is called several times
Receiver.onViolation is called several times when there are validation errors after each request. interface Driver extends RequestFactoryEditorDriverItemProxy, ItemEditor{} private ItemRequest request; public void edit(...){ ... request = requestFactory.itemRequest(); ... } public void getItem() { request.getItemById(/*give id here*/ id).fire(new ReceiverItemProxy(){ @Override public void onSuccess(ItemProxy response) { // } @Override public void onFailure(ServerFailure error) { } @Override public void onViolation(SetViolation errors) { showErrors(errors); } }); When I call this method first time, and sending request fail with violations, method onViolation() is called only once. Its OK to this point. (call - getItem() = call - onViolation() ) The problem is: if I call this method second time and request fails again, method onViolations() is called two times in row. (call - getItem() = call - onViolation() - onViolation()) If I call this method third time, onViolations() is called three times in row. (call - getItem() = call - onViolation() - onViolation() - onViolation()) after N calls. (1 call - getItem() = call - onViolation() - onViolation() - N) -- 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.
Receiver.onViolation() is called several times
Receiver.onViolation is called several times when there are validation errors after each request. interface Driver extends RequestFactoryEditorDriverItemProxy, ItemEditor{} private ItemRequest request; public void edit(...){ ... request = requestFactory.itemRequest(); ... } public void getItem() { request.getItemById(/*give id here*/ id).fire(new ReceiverItemProxy(){ @Override public void onSuccess(ItemProxy response) { // } @Override public void onFailure(ServerFailure error) { } @Override public void onViolation(SetViolation errors) { showErrors(errors); } }); When I call this method first time, and sending request fail with violations, method onViolation() is called only once. Its OK to this point. (call - getItem() = call - onViolation() ) The problem is: if I call this method second time and request fails again, method onViolations() is called two times in row. (call - getItem() = call - onViolation() - onViolation()) If I call this method third time, onViolations() is called three times in row. (call - getItem() = call - onViolation() - onViolation() - onViolation()) after N calls. (1 call - getItem() = call - onViolation() - onViolation() - N) -- 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.
OnViolation method doesnt show error message.
When I execute the next code, and when onViolation() method is called, no error message is showed in the ValueBoxEditorDecorator. Any idea why? @UiField ValueBoxEditorDecoratorString itemName; public void onClick(){ ItemRequest request = requestFactory.ItemRequest(); ItemProxy proxy = request.create(ItemProxy.class); proxy.setItemName(name); request.getItemByName(name); driver.edit(proxy, request); driver.flush().fire(new ReceiverVoid(){ @Override public void onSuccess(Void response) { } @Override public void onViolation(SetViolation errors) { driver.setViolations(errors); } }); } -- 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.
How to set style on row in CellTableT
My question is simple. How to set style on specific row on CellTable? For example I want to show table with data for clients who paid, who not paid and who payment is processing, but each row need to be colored differently. I want to set green background color on row for clients who paid, yellow color background color for client who waiting for processing payment and red background color style for clients who not paid. How can I do this? Is there any method like addRowStyle()? Table prepare HTML string and then set it to the panel to make rendering faster but is there any way to set styles on rows for specified entity? Thx. -- 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-tool...@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: need to execute commands on windows machine from remote server
If I understand correct. You want to use GWT to start program on the client side when you send some event from server side. GWT Code is compiled to JavaScript. JavaScript is executed by the browser so browser security police don't give permition the code from javascript to be executed out of box (out of browser environment). So you can call even cd c:\user command on the client machine. The answer on your question is NO. sathya wrote: I need to execute command on client side.I have all clients username and passwords.So I need to login to client machine (windows) and execute commands On Oct 19, 1:00 pm, gwtfanb0y siegfried.b...@googlemail.com wrote: I dont exactly understand what you want. Do you want to execute a command on the client-side (the browser) or on the server-side (input coming from the client) ? On 19 Okt., 08:21, sathya sathyavik...@gmail.com wrote: I need to execute commands on windows machine (eg: c:\program files \outlook.exe) using java program. However java program will be running on remote server(tomcat server on other machine). So my job is to connect to windows machine from server and execute commads on client. Can you help in implementing this using java program? I believe I can do this using SSh or using https connection from server to windows machine. However I am not sure which the best method to do this is. Also I would like to know if they are any other methods to implement this. Thanks, Sathya.- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: need to execute commands on windows machine from remote server
Appendix: Fix on my message before I mean You can't call even cd c:\user on the client computer. You cant use GWT to remote access files or remote call any dos or other command on the client computer. :) Greetings! --~--~-~--~~~---~--~~ 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: how to send variables in form panel
Its probably a multipart message :S Try googling for how to accept multipart message on the server side here is some example but i don't know if you find usefull. public HashMapString, InputStream parseMultipartMessage( HttpServletRequest request) { mapWithStreams = new HashMapString, InputStream(); boolean isMultipart = ServletFileUpload.isMultipartContent(request); try { if (isMultipart) { FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); ListFileItem items = upload.parseRequest(request); for (FileItem item : items) { mapWithStreams.put(item.getFieldName(), item.getInputStream()); } } else { mapWithStreams.put(DEFAULT_KEY, request.getInputStream()); } } catch (FileUploadException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return mapWithStreams; In normal message (not multipart) data from the text fields come like the body of the message. If you try to transfer file in normal message then Stream is send like the body of the message. So you can transver only Parameters or only stream. If you want to transfer parameters and stream in same message you need to use multipart message. In multipart message InputStream come on server like a body of the message. If that input stream contain multipart message you need to parse that message. So in one part you will have values from input fields and in other part you will have Stream for uploaded file. Read about multipart messages on the wiki site. Code abowe will parse all input streams from multipart message and place them to the HasMap. The Key in HashMap is the File name. You can access to streams later when you need them. To the parameters you can access on the same way like you deed before: request.getParameter(parameterName); Good luck. YoeZ wrote: Hey abhiram, I still have a problem in server side,, can you tell me how to catch variable from client. Let say I have a textbox in client. Textbox txtComment = new Textbox; txtComment.setName(txtComment); txtComment .setText(hello); in server side: I've tried: String varXXX = (String) request.getParameter(txtComment); but that's not working. :( and I've also tried like this : try { List items = upload.parseRequest(request); Iterator it = items.iterator(); while (it.hasNext()) { FileItem item = (FileItem) it.next(); if (item.isFormField()) { String name = item.getFieldName(); if (name.equals(txtComment)) { ret = item.getString(); } return ret; } } } catch (FileUploadException e) { return null; } but still null return. can you tell me how to catch it. regards On Oct 21, 12:32 am, abhiram wuntakal abhir...@gmail.com wrote: Hey Yoez, Not sure if it helps. But i have a workaround solution for this. Make it a two-step process. First use a RemoteServiceServlet to pass across your variables to the server side and then save these values into some variables on the server side. Then you can use a HTTPServlet to pass across your file contents to the server side. Now you have the file as well as the variables. HTH, Cheers, Abhiram On Mon, Oct 19, 2009 at 6:12 PM, YoeZ juz...@gmail.com wrote: thanks ian,, but i'm using GWT and tried to uploadfile which is must using FormPanel. I have successfully upload my file to server with UploadFile widget, but I have another textboxes too. and dunno how to catch inside FormPanel. On Oct 19, 7:15 pm, Ian Bambury ianbamb...@gmail.com wrote: You'll stand more chance of an answer if you ask that question in a Java forum. This is a GWT group. Ian http://examples.roughian.com 2009/10/19 YoeZ juz...@gmail.com hello... please help On Oct 18, 12:31 am, YoeZ juz...@gmail.com wrote: Hi. I have 1 form panel with some textboxes and file upload. the question is, how to get variables from client/form panel in servlet? i created DTO/Pojo object to hold variables in client, but i donk know how to catch in servlet.. please help thanks --~--~-~--~~~---~--~~ 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: Is there a way to block until a server response is available?
Maybe this will help you. You can use Command pattern to send request after server responde to previous request. The idea is. You have one callback, that callback is given to another callback who in onSuccess() method call the next command and then give that callback to the finall callback. So to be more clear, create one interface Command who have only one method execute. public interface Command { abstract void execute(); } Create interface Loader who have two methods add(Command command) and execute(). public interface Loader { void add(Command command); void execute(); } Create implementation for that interface for example ChainLoader who have one collection ListCommand command and method add(Command command) add elements in that collection. The method execute check if the collection contain any command and if size is 0 return. If size is not 0 Get first command from the commands, call execute method and remove that command from the list. public class ChainLoader implements Loader{ ListCommand commands = new ArrayListCommand(); @Override public void add(Command command){ commands.add(command); } @Override public void execute(){ if(commands.size() == 0){ return; } Command command = commands.get(0); command.execute(); if(commands.size() 0){ commands.remove(0); } } } Create one CommandChain who implements your AsyncCallback interface, and in constructor receiveAsyncCallback and Loader. public class CommandChainT implements AsyncCallbackT{ private AsyncCallbackT callback; private Loader loader; public CommandChain(AsyncCallbackT callback, Loader loader) { this.callback = callback; this.loader = loader; } @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } @Override public void onSuccess(T result) { callback.onSuccess(result); loader.execute(); } } Finaly create CommandChain what you will use to make the chain. public abstract class EntityCommandT implements Command { private AsyncCallbackT callback; public EntityCommand(AsyncCallbackT callback) { this.callback = callback; } @Override public void execute(){ proceed(callback); } public abstract void proceed(AsyncCallbackT callback); } How you probably say WTF? :) The use is really simple for example i write one test you can modify in your code: @Test public void test(){ AsyncCallbackString callback0 = new AsyncCallbackString() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(String result) { doSomeStuff(result); } }; AsyncCallbackString callback1 = new AsyncCallbackString() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(String result) { doSomeStuff(result); } }; Loader loader = new ChainLoader(); CommandChainString chain1 = new CommandChainString(callback0, loader); CommandString command1 = new CommandString(chain1) { @Override public void proceed(AsyncCallbackString callback) { asyncService.sendRequest(callback); } }; loader.add(command1); CommandChainString chain2 = new CommandChainString(callback1, loader); CommandString command2 = new CommandString(chain2) { @Override public void proceed(AsyncCallbackString callback) { asyncService.sendRequest(callback); } }; loader.add(command2); loader.execute(); } Good luck ;) Shawn Pearce wrote: On Thu, Oct 15, 2009 at 15:48, AndiMullaraj andimulla...@gmail.com wrote: There are cases when blocking calls to server are indispensable (agreed, assync calls are the way to go for 99% of the cases). I scanned the client API and cannot find a way on how to do this. If not through a direct API call, is there a way on how to achieve this? (Like having a wait/process_events loop going until the response comes from the server). No. Most browsers are single threaded. They can't send an HTTP request or parse an HTTP response while they are also executing JavaScript. So GWT assumes that is the case and requires you to return control to the browser. Which means blocking calls are not supported. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the
Re: Is there a way to block until a server response is available?
Just a little change. You need to remove command from list before call execute(); On Oct 16, 1:48 am, AndiMullaraj andimulla...@gmail.com wrote: There are cases when blocking calls to server are indispensable (agreed, assync calls are the way to go for 99% of the cases). I scanned the client API and cannot find a way on how to do this. If not through a direct API call, is there a way on how to achieve this? (Like having a wait/process_events loop going until the response comes from the server). Thanks for you attention, --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---