Frühling: Einfügen von Cookies in eine REST -CALL -Antwort

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Frühling: Einfügen von Cookies in eine REST -CALL -Antwort

by Anonymous » 03 Jun 2025, 17:41

Ich implementiere REST -API -Endpunkte mit Spring MVC . Ich versuche, eine HTTP -Antwort mit einem Cookie -Wert zurückzuschicken.
Dies ist das Äquivalent zu dem, was ich in Ruby Sinatra tun muss: < /p>

response.set_cookie('heroku-nav-data', :value => params['nav-data'], :path => '/')
< /code>

Das habe ich bisher ausprobiert, aber das hat nicht funktioniert: < /p>

@RequestMapping(value = "/login", method = RequestMethod.POST)
public ResponseEntity single_sign_on(@RequestBody String body_sso) {

String[] tokens = body_sso.split("&");
String nav_data=tokens[3].substring(9);
String id = tokens[2].substring(3);
String time_param = tokens[0].substring(10);
long timestamp= Long.valueOf(time_param).longValue();

String pre_token = id+':'+HEROKU_SSO_SALT+':'+time_param;
String token = DigestUtils.shaHex(pre_token);
long lDateTime = new Date().getTime()/1000;
if (!((token.equals(tokens[4].substring(6))) && ((lDateTime-timestamp)

Top