hi,
We have a simple workflow application created using the LabKey javascript API.
Till now we've used a nightly cron job that executes a jar file to query this workflow data to populate PDF survey files.
Our process, however, has changed.
Now, we need to generate the surveys right when the user completes the workflow process... insert data and then export file.
So, does this mean I will need to create a Java module? Could I create a standalone servlet that the javascript could invoke? Are there other possibilities I've overlooked?
Thanks for your help and insight. |
|
jeckels responded: |
2013-07-25 14:33 |
Hello,
I think you're on the right track here - you want to have some Java code running on the server that the JavaScript can poke via a HTTP request. I'd recommend creating a small Java module with a single controller class and a single action class that handles the request.
I think this will be easier to maintain compared to a standalone servlet because you won't need to modify the core deployment descriptors to register the servlet and map it to a URL. It also makes it easier to do security checks and other validation because you'll be handed context about the current user, container, etc.
Thanks,
Josh |
|
bront responded: |
2013-07-25 14:37 |
Josh,
Thanks for verifying that the Java module is the way to go.
cheers,
bront |
|
bront responded: |
2013-08-20 13:52 |
|
|
jeckels responded: |
2013-08-21 13:31 |
Hi Bront,
Since you need to have Java code running in the server, you won't be able to do it solely as a file-based or simple module. However, we've done a lot of work to make it so that modules can mix and match Java and non-Java resources.
So, you'll need to include Java code and use an Ant build.xml file to get it compiled, but you can still use .html, .sql, .query.xml, and other file-based resources within the same module.
I hope that helps.
Thanks,
Josh |
|
bront responded: |
2013-08-21 13:47 |
Josh,
Yes, I think it does.
thanks,
bront |
|
bront responded: |
2013-08-22 11:40 |
Josh,
I have 2 further questions about building modules.
First, I used create_module to create "TestModule."
When I run TestModule's build.xml Ant script, it reports no errors, but there is no TestModule.module file.
Instead I see:
TestModule/jspTempDir
TestModule/classes
TestModule/explodedModule
I am curious about the explodedModule.
Second, when I place the TestModule directory on the server and restart Tomcat, TestModule becomes an optional folder type (I have not added code to make it available as a web part).
I would, however, expect to see the hello.jsp when I navigate to the following URL, but I don't. I see "Unable to find action 'begin' to handle request in controller 'testmodule'."
/testmodule/sampleFolder/co-investigators/admin/begin.view?
I really appreciate your help.
Many thanks,
bront |
|
jeckels responded: |
2013-08-23 09:13 |
Hi Bront,
If the build is working, the assembled .module should be copied into <LABKEY_ROOT>/build/deploy/modules. Do you see one there?
From your description, it sounds like either the build isn't compiling your Java classes, or the .module isn't ending up in a place where the server can find it at startup. Can you post the output from doing an "ant clean" and then an "ant build" for your module? That may help track down problems if the Java classes aren't being built correctly.
Thanks,
Josh |
|
bront responded: |
2013-08-23 10:20 |
Josh,
I did a build_all and miraculously the build/deploy/modules/test.module appeared... and it worked worked when I loaded it to the server and restarted Tomcat.
Thank you for your help, suggestions and patience.
bront |
|
|
|