Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how do i use the cookies??

 
Derick Potgieter
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Urlybird 1.1.2
I`m generating a new cookie in my lock and then returning it to the caller.

but in my update or delete method it wants the cookie value specified.
now problem
[CODE]
public void update(int recNo, String[] data, long lockCookie) throws
RecordNotFoundException, SecurityException{


1. should i write an adapter class where i would say
data.lock(1);
data.update(1,data(array),cookie);
data.unlock(1,cookie

2. how do you compare the two cookies.
i created a map object in my data class, giving 1 the recNo and
2 the cookie value.

but you have to send it as a Long and long, so when i cant to
compare the two they differ? any suggestions??
 
Jon Entwistle
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

1. should i write an adapter class


It is one solution - as long as you state your reasons and the options you should be fine.


2. how do you compare the two cookies.
i created a map object in my data class, giving 1 the recNo and
2 the cookie value.

but you have to send it as a Long and long, so when i cant to
compare the two they differ? any suggestions??


I am not sure I see what you are driving at . You would only ever compare keys to keys (Integer to Integer for recNo in your case) and values to values (Long to Long) - both of these classes overide the equals method in object to return true when two instances represent the same number.

To compare a long to a Long, just convert the long value into a Long object and compare.


Hope this helps....


Jon
[ May 27, 2004: Message edited by: Jon Entwistle ]
 
Serkan Yazici
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Derickll,

Shouldn't your lock return the cookie it generated, which you can just
use with update/unlock:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic