0

I have a java web application with jsp frontend. I want to use Dart as frontend instead of jsp.

I made Dart invoke java through a Jersey web service. I had success calling the java web service and display java data in the browser through Dart HttpRequest.

In java/jsp I'm using the session to store some information. The next step, where I'm stuck, is session management with Dart. I cannot manage to keep the java session from Dart HttpRequest.

Is there a way to maintain the java session from Dart HttpRequest? I cannot remove the dependency from the java session and implement a REST service.

Jako
  • 2,489
  • 3
  • 28
  • 38

2 Answers2

1

At Browser Side, Session is just another cookie. If you want to manipulate cookies at Browser side you should see this library:

cookie 0.0.4

Furthermore look in this answer where is explained why restful services shouldn't have sessions:

https://stackoverflow.com/a/20311981/2117440

Community
  • 1
  • 1
Luis Vargas
  • 2,466
  • 2
  • 15
  • 32
  • Thankyou for pointing me to cookie library. About REST, I know it's motives; I've stated that my application cannot remove session management. Aside of that it will have 3 or 4 client at most. – Jako Mar 30 '14 at 20:20
  • The JSESSIONID cookie is not accessible, it is always null; looks like response header of HttpRequest does not affect the document – Jako Mar 30 '14 at 20:30
1

I solved without the use of the cookies:

  • I created a java web service to create/return the jsessionid string
  • from Dart I call the previous web service and store the jsessionid in a local variable
  • all the following Dart HttpRequest have the jsessionid in the url like "http://server/app/wsxyz;jsessionid=14F5FA9836512AF"
Jako
  • 2,489
  • 3
  • 28
  • 38