Giter Club home page Giter Club logo

Comments (11)

ralscha avatar ralscha commented on July 30, 2024

Hi

Yes it looks like it works. I made a quick test with this client code:

var values = {
aLotOfStrings: ['a', 'b', 'c'],
firstName: 'first',
lastName: 'last',
age: 27
};
namedService.showDetails(values, function(value){
Ext.example.msg('Server Response', value);
});

and this server code:

@ExtDirectMethod(value = ExtDirectMethodType.SIMPLE_NAMED, group = "named")
public String showDetails(List aLotOfStrings, String firstName,
String lastName, int age) {
for (String string : aLotOfStrings) {
System.out.println(string);
}
return String.format("Hi %s %s, you are %d years old.", firstName,
lastName, age);
}

Ralph

On Tue, Nov 20, 2012 at 1:38 PM, salamoun [email protected] wrote:

Is it possible to send array over simple named method??
For example:

@ExtDirectMethod(ExtDirectMethodType.SIMPLE_NAMED)
public void sendSomeData(List objects, int someId) {
...
}


Reply to this email directly or view it on GitHubhttps://github.com//issues/49.

from extdirectspring.

salamoun avatar salamoun commented on July 30, 2024

OK, but I'm not sending array of string. I have array of bussines objects.

var myObjects = [{id:1,name:'test'},{id:2,name:'test2}];

Is it possible too? Because I got spring conversion error in this case.

from extdirectspring.

ralscha avatar ralscha commented on July 30, 2024

Here the missing stacktrace:
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.util.LinkedHashMap to type ch.rasc.extdirectspring.demo.named.Business
at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:276) ~[spring-core-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:172) ~[spring-core-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.core.convert.support.CollectionToCollectionConverter.convert(CollectionToCollectionConverter.java:74) ~[spring-core-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:35) ~[spring-core-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:169) ~[spring-core-3.2.0.RC1.jar:3.2.0.RC1]
at ch.ralscha.extdirectspring.util.ParametersResolver.convertValue(ParametersResolver.java:241) ~[classes/:na]
at ch.ralscha.extdirectspring.util.ParametersResolver.resolveParameters(ParametersResolver.java:169) ~[classes/:na]
at ch.ralscha.extdirectspring.controller.RouterController.processRemotingRequest(RouterController.java:556) [classes/:na]
at ch.ralscha.extdirectspring.controller.RouterController.handleMethodCall(RouterController.java:462) [classes/:na]
at ch.ralscha.extdirectspring.controller.RouterController.handleMethodCallsSequential(RouterController.java:442) [classes/:na]
at ch.ralscha.extdirectspring.controller.RouterController.router(RouterController.java:393) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_09]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_09]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_09]
at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_09]
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219) [spring-web-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) [spring-web-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) [spring-webmvc-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745) [spring-webmvc-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686) [spring-webmvc-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) [spring-webmvc-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) [spring-webmvc-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) [spring-webmvc-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:917) [spring-webmvc-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:824) [spring-webmvc-3.2.0.RC1.jar:3.2.0.RC1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:798) [spring-webmvc-3.2.0.RC1.jar:3.2.0.RC1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) [spring-web-3.2.0.RC1.jar:3.2.0.RC1]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-3.2.0.RC1.jar:3.2.0.RC1]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) [urlrewritefilter-3.2.0.jar:3.2.0]
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) [urlrewritefilter-3.2.0.jar:3.2.0]
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) [urlrewritefilter-3.2.0.jar:3.2.0]
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381) [urlrewritefilter-3.2.0.jar:3.2.0]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585) [tomcat-embed-core-7.0.32.jar:7.0.32]
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) [tomcat-embed-core-7.0.32.jar:7.0.32]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_09]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_09]
at java.lang.Thread.run(Thread.java:722) [na:1.7.0_09]

from extdirectspring.

salamoun avatar salamoun commented on July 30, 2024

yes, i get exactly same error

from extdirectspring.

ralscha avatar ralscha commented on July 30, 2024

Found a solution that works with my simple test case. I try and integrate the fix into the 'next' branch (1.2.3-SNAPSHOT) tomorrow. I keep you posted.

from extdirectspring.

salamoun avatar salamoun commented on July 30, 2024

OK, thanks for help.

from extdirectspring.

ralscha avatar ralscha commented on July 30, 2024

Fix is now integrated in the lastest 1.2.3-SNAPSHOT Release.
https://oss.sonatype.org/content/repositories/snapshots/ch/ralscha/extdirectspring/1.2.3-SNAPSHOT/extdirectspring-1.2.3-20121121.035026-8.jar

Maybe you have time and test this release with your program.
If all goes planned I will release the 1.2.3 version end of November.

It's important that the business object has a default constructor. The jackson library needs this to deserialize the object. The method also has to use generics:
public void sendSomeData(List<BusinessObject> objects, int someId) {

If the method only has a raw list as parameter it will work but the list then contains a map with String key and Object values.
public void sendSomeData(List objects, int someId) {

from extdirectspring.

salamoun avatar salamoun commented on July 30, 2024

I test it and now works perfect with 1.2.3 version!

But it has side effect. I previously use version 1.1.1. When I switch to 1.2.3 I must update all my JSON annotations on business object, otherwise they were ignored.
From import org.codehaus.jackson.annotate.* to import com.fasterxml.jackson.annotation.*.
New versions of extdirectspring use com.fasterxml.jackson serialiazer?? Or I'm doing something wrong?

from extdirectspring.

ralscha avatar ralscha commented on July 30, 2024

Hi

We switched to Jackson 2 in version 1.2.0 and they changed the package
structure.
Is this a problem in your project? If yes I could try and add this fix in
version 1.1.x

Ralph

On Wed, Nov 21, 2012 at 10:53 AM, salamoun [email protected] wrote:

I test it and now works perfect with 1.2.3 version!

But it has side effect. I previously use version 1.1.1. When I switch to
1.2.3 I must update all my JSON annotations on business object, otherwise
they were ignored.
From import org.codehaus.jackson.annotate.* to import
com.fasterxml.jackson.annotation.*.
New versions of extdirectspring use com.fasterxml.jackson serialiazer?? Or
I'm doing something wrong?


Reply to this email directly or view it on GitHubhttps://github.com//issues/49#issuecomment-10591036.

from extdirectspring.

salamoun avatar salamoun commented on July 30, 2024

No, I change import to new packages and all code works fine. Thanks!

from extdirectspring.

ralscha avatar ralscha commented on July 30, 2024

Version 1.2.3 released

from extdirectspring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.