Hi guys,
I've read up on the forums and haven't found a simple solution to this problem,
I'm using a custom javascript form builder script for front-end users to create their own form,
I render the form with javascript and after a user builds their form and clicks the save button, a JSON string is created and I pass that JSON string via REST to my database, and then when a user opens the created form, the JSON string is pulled via REST into the Javascript script to get rendered.
The problem is, whenever I run a REST call the session times out, is there a workaround to this problem?
Thanks a million in advance .
Session Timeout after REST Call [Solved]
-
- Posts: 33
- Joined: Sun Jul 16, 2017 11:53 pm
- Location: Mongolia, Ulaanbaatar
Session Timeout after REST Call [Solved]
Last edited by Pomegranate on Tue Nov 09, 2021 8:43 am, edited 1 time in total.
Re: Session Timeout after REST Call
I tried to do this 2 years ago.
I wanted javascript inside a form's html cell to call my existing system and get a JSON response.
I got a timeout - the 2nd connection to Tomcat is re-issuing a new SESSIONID, thereby invalidating the 1st one.
He said the way I was doing it was incorrect - that I should be utilizing what amounted to 'undocumented insider knowledge' to query aware to get what i needed - but this was something i'd have to pay for. SO, since the JSON data was inside MS SQL, I made a simple node.js server and I call it from javascript. I still get the same JSON back and my script runs.
SO, easy way is to get something other than aware to give you the JSON.
More expensive way is to hire Vlad to teach you some internals.
here is my original thread and related thread here.
Jaymer...
I wanted javascript inside a form's html cell to call my existing system and get a JSON response.
I got a timeout - the 2nd connection to Tomcat is re-issuing a new SESSIONID, thereby invalidating the 1st one.
He said the way I was doing it was incorrect - that I should be utilizing what amounted to 'undocumented insider knowledge' to query aware to get what i needed - but this was something i'd have to pay for. SO, since the JSON data was inside MS SQL, I made a simple node.js server and I call it from javascript. I still get the same JSON back and my script runs.
SO, easy way is to get something other than aware to give you the JSON.
More expensive way is to hire Vlad to teach you some internals.
here is my original thread and related thread here.
Jaymer...
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 33
- Joined: Sun Jul 16, 2017 11:53 pm
- Location: Mongolia, Ulaanbaatar
Re: Session Timeout after REST Call
Thanks Jaymer, its good to hear from you.
I was afraid of setting up a third-party service for something like this, I'll give it a go I guess, thanks again for your help .
I was afraid of setting up a third-party service for something like this, I'll give it a go I guess, thanks again for your help .
-
- Posts: 197
- Joined: Fri Jun 17, 2016 7:10 am
- Location: Brisbane Australia
- Contact:
Re: Session Timeout after REST Call
We’ve continued to use what I describe at
viewtopic.php?f=1&t=10570&p=51512#p51512
Works perfectly for us.
viewtopic.php?f=1&t=10570&p=51512#p51512
Works perfectly for us.
AWS Linux, Windows Server, AIM 8.4 & 8.6
Re: Session Timeout after REST Call
Hey Dave
I see how that might work for me now, but the "extra" work of doing a node server was good learning for me.
There are pros and cons.
Its nice that my solution is outside of aware, and I can modify that JS code without having to republish. Of course I don't NEED to do this, but I've added other JSON routes (for other needs) and can do so without bothering online users.
But for those who'd want an all-aware solution yours fits the bill. I'll def. keep this in mind for the next issue.
JaymerTip --> CORS, REST timeout when calling Aware's service
I see how that might work for me now, but the "extra" work of doing a node server was good learning for me.
There are pros and cons.
Its nice that my solution is outside of aware, and I can modify that JS code without having to republish. Of course I don't NEED to do this, but I've added other JSON routes (for other needs) and can do so without bothering online users.
But for those who'd want an all-aware solution yours fits the bill. I'll def. keep this in mind for the next issue.
JaymerTip --> CORS, REST timeout when calling Aware's service
Last edited by Jaymer on Mon Nov 01, 2021 3:48 am, edited 1 time in total.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 33
- Joined: Sun Jul 16, 2017 11:53 pm
- Location: Mongolia, Ulaanbaatar
Re: Session Timeout after REST Call
Hey Dave,
Thank you so much for you advise, setting up an Alias and pointing to it works,
But I had some hurdles which I figured out in the end, my CORS configuration is as follows if anyone needs it in the future.
Thank you so much for you advise, setting up an Alias and pointing to it works,
But I had some hurdles which I figured out in the end, my CORS configuration is as follows if anyone needs it in the future.
Code: Select all
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>http://localhost:8080</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
<param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
<param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
</init-param>
<init-param>
<param-name>cors.exposed.headers</param-name>
<param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
</init-param>
<init-param>
<param-name>cors.support.credentials</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>cors.preflight.maxage</param-name>
<param-value>10</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>