You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because the id is specified in the URI template, and because JSON is our default media type, we will be able to do:
@Get("/{id}")
conditional Cart getCart(String id)
... or even:
@Get("/{id}")
conditional Cart getCart(Int id)
(In the latter case, there is some question as to how to report the error if the value is not an integer.)
Similarly, the Session and Request objects are always assumed to be available, so if JK had needed them within the method, the method could simply have those as params:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Extending on from JK's sock shop port to Ecstasy ...
Because the
id
is specified in the URI template, and because JSON is our default media type, we will be able to do:... or even:
(In the latter case, there is some question as to how to report the error if the value is not an integer.)
Similarly, the
Session
andRequest
objects are always assumed to be available, so if JK had needed them within the method, the method could simply have those as params:They're also available as properties on the web service containing the method (but the properties are of the nullable
Session?
andRequest?
types, so the code wouldn't be quite as clean.)Beta Was this translation helpful? Give feedback.
All reactions