ralscha / extdirectspring

Implementation of the Ext Direct protocol with Java and Spring
https://github.com/ralscha/extdirectspring/wiki
Apache License 2.0
123 stars 64 forks source link

Set Timeouts at Function Level #57

Closed JGSimko closed 11 years ago

JGSimko commented 11 years ago

Is there any support for setting timeouts at a function level?

Right now to increase the timeout for the whole application I'm doing the following:

Ext.app.REMOTING_API.timeout = 300000; Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);

It would be nice to be able to something like the following: @ExtDirectMethod( ExtDirectMethodType.SIMPLE, timeout = 30000 ) public void sample() { }

I'm kind of doubting that the Ext API supports that functionality... Do you know any more information on it?

Thanks,

ralscha commented 11 years ago

Hi

There is one thing you could try, although I'm not sure if it will work.

According to the documentation for addProviderhttp://docs.sencha.com/ext-js/4-1/#!/api/Ext.direct.Manager-method-addProvider the method accepts any number of Provider descriptions.

To create different provider descriptions you create different groups @ExtDirectMethod( value=ExtDirectMethodType.SIMPLE, group="fast" ) public void fast() { } @ExtDirectMethod( value=ExtDirectMethodType.SIMPLE, group="slow" ) public void slow() { }

Then add two script tags in the html

This creates two provider descriptions Ext.app.fastApi and Ext.app.slowApi

Ext.app.slowApi.timeout = 300000; Ext.app.fastApi.timeout = 1000; Ext.direct.Manager.addProvider(Ext.app.slowApi, Ext.app.fastApi );

Not sure if that works.

Ralph

JGSimko commented 11 years ago

That solution appears to work.

Thanks!

JGSimko commented 11 years ago

Do you have any ideas on how I could get a default api to work?

Every java function gets added to the api if I don't specify a group in .

Current setup:

This results in the functions with group set to "slow" getting called twice. I'd like to avoid having to add in an extra parameter to the @ExtDirectMethod when I want it in the default

ralscha commented 11 years ago

Right now there is support for that.But this looks like a useful addition. I will change the code to support an empty value for the group parameter.

<script src="api.js?group="> This will collect every method that has no group or an empty group attribute specified.

ralscha commented 11 years ago

Changed the code to support empty group. This script will now return every remote method that does not have a group attribute or does have a group attribute with an empty value <script src="api.js?group"> or <script src="api.js?group=">

Change in the latest 1.3.1-SNAPSHOT

JGSimko commented 11 years ago

Awesome,

I updated the .jar and the empty group parameter is working. Thanks for the quick build.

pavithra2303 commented 11 years ago

ralscha, can you please help me.. In extdirectspring demo, there is a js file named api-debug.js.. It contains the url called "demo/router". How can i get the router program to run in my localhost. Can you get me the zip file of router.

ralscha commented 11 years ago

The easiest way to run the demo application is by cloning the repository git clone git://github.com/ralscha/extdirectspring-demo.git

and then type in a shell/command prompt mvn tomcat7:run

This starts a Tomcat on port 8080.

On Tue, Feb 26, 2013 at 4:41 PM, pavithra2303 notifications@github.comwrote:

ralscha, can you please help me.. In extdirectspring demo, there is a js file named api-debug.js.. It contains the url called "demo/router". How can i get the router program to run in my localhost. Can you get me the zip file of router.

— Reply to this email directly or view it on GitHubhttps://github.com/ralscha/extdirectspring/issues/57#issuecomment-14121081 .

pavithra2303 commented 11 years ago

But the api-debug file is not present in "extdirectspring-demo-master\src\main\webapp\extjs41" so when i try to run for eg. named-arguments i'm getting the following error: GET http://localhost:8080/best/new/extdirectspring-demo-master/src/main/webapp/api-debug.js?group=named 404 (Not Found) named-arguments.html:8 can you help me in this?

ralscha commented 11 years ago

api-debug.js is dynamically generated. There is no file api-debug.js The url looks very weird. src/main/webapp is not part of the url because this is the root directory of your webapplication. If you deployed the application in the root context then the url should look like this http://localhost:8080/api-debug.js?group=namedhttp://localhost:8080/best/new/extdirectspring-demo-master/src/main/webapp/api-debug.js?group=named If you deployed the application in a context like 'test' then the url looks like this http://localhost:8080/test/api-debug.js?group=namedhttp://localhost:8080/best/new/extdirectspring-demo-master/src/main/webapp/api-debug.js?group=named

It all depends in what context you deployed the application in Tomcat or other servlet containers.

On Tue, Feb 26, 2013 at 4:54 PM, pavithra2303 notifications@github.comwrote:

But the api-debug file is not present in "extdirectspring-demo-master\src\main\webapp\extjs41" so when i try to run for eg. named-arguments i'm getting the following error: GET http://localhost:8080/best/new/extdirectspring-demo-master/src/main/webapp/api-debug.js?group=named404 (Not Found) named-arguments.html:8 can you help me in this?

— Reply to this email directly or view it on GitHubhttps://github.com/ralscha/extdirectspring/issues/57#issuecomment-14121929 .

pavithra2303 commented 11 years ago

Thanks ralscha!!! I can see api-debug file.. but how about demo/router???

ralscha commented 11 years ago

Normally the router is located in the same location as api-debug.js When the url of api is http://localhost:8080/test/api-debug.js then the router url is http://localhost:8080/test/router

The router is also not a file it's a Spring MVC controller ch.ralscha.extdirectspring.controller.RouterController

On Tue, Feb 26, 2013 at 5:18 PM, pavithra2303 notifications@github.comwrote:

Thanks ralscha!!! I can see api-debug file.. but how about demo/router???

— Reply to this email directly or view it on GitHubhttps://github.com/ralscha/extdirectspring/issues/57#issuecomment-14123392 .

pavithra2303 commented 11 years ago

i could see the api-debug.js in the location you said.. still i'm getting 404 error wen i try to deploy it on tomcat6... Can you explain me clearly where should i place my RouterController.class?? i'm getting 404 error wen i use dis http://localhost:8080/test/router..

ralscha commented 11 years ago

The RouterController.class is part of the extdirectspring.jar that is in the WEB-INF/lib folder. But maven takes care of that and in your case it is there because api.js works. Normally when api.js works then router also works. router only listens for POST requests, so you can not enter the url http://localhost..../router in the address field of a browser.

On Tue, Feb 26, 2013 at 5:29 PM, pavithra2303 notifications@github.comwrote:

i could see the api-debug.js in the location you said.. still i'm getting 404 error wen i try to deploy it on tomcat6... Can you explain me clearly where should i place my RouterController.class?? i'm getting 404 error wen i use dis http://localhost:8080/test/router..

— Reply to this email directly or view it on GitHubhttps://github.com/ralscha/extdirectspring/issues/57#issuecomment-14123991 .

pavithra2303 commented 11 years ago

my hierarchy is -test -named-arguments.html -named-arguments.js -WEB-INF -lib -extdirectspring-1.3.0-nodep

Is it correct ralscha???

pavithra2303 commented 11 years ago

api-debug.js is not getting generated dynamically..

dilbertside commented 11 years ago

Dear Pavithra,

You may want to reread the specification which is at the foundation of this library http://www.sencha.com/products/extjs/extdirect/

Specifically the Server Platforms part. This library hide the cumbersome process to generate the API and provide a router with Spring magic to ensure the proper handling of remote server-side methods. It is a kind of RPC/Corba for Extjs, called Ext Direct.

There are not yet a ExtDirectSpring in Action to simplify and details concepts behind the offering of this library. Manning ExtJs in Action and Spring in Action might be a good start to patch some knowledge gaps.

You are left to study the wiki and the fairly extensive examples provided and read other libraries implementation for comparison.

Kind regards,

Disclaimer: this mail doesn't reflect the ideas of this library owner so called ralscha

On 02/27/2013 01:12 AM, pavithra2303 wrote:

api-debug.js is not getting generated dynamically..

— Reply to this email directly or view it on GitHub https://github.com/ralscha/extdirectspring/issues/57#issuecomment-14126674.

pavithra2303 commented 11 years ago

Thank you!!! I read it... all the examples in the sencha were written in PHP... But i dont want to use PHP in my project. Thats why i'm in trouble i think

ralscha commented 11 years ago

Did you solve your problem?

Maybe this archetype helps you. This sets up a simple project with all the necessary libraries

mvn archetype:generate -DarchetypeArtifactId=eds-starter-simple-archetype -DarchetypeGroupId=ch.rasc -DarchetypeVersion=1.0.9 -DarchetypeRepository= http://repository.rasc.ch -DgroupId=com.mycompany -DartifactId=mynewapp -Dversion=0.0.1

On Tue, Feb 26, 2013 at 6:03 PM, pavithra2303 notifications@github.comwrote:

my hierarchy is -test -named-arguments.html -named-arguments.js -WEB-INF -lib -extdirectspring-1.3.0-nodep

Is it correct ralscha???

— Reply to this email directly or view it on GitHubhttps://github.com/ralscha/extdirectspring/issues/57#issuecomment-14126194 .

pavithra2303 commented 11 years ago

Thanks for your help ralscha!! i solved the problem!!

pavithra2303 commented 11 years ago

How to create Area chart from dynamically created grid data??? Can anyone please help me!!

ralscha commented 11 years ago

A github issue is not the right place for such a question. The Sencha Forum is a better place for this question