Repository navigation
COG-1156: AccountController + HomeController @RequestMapping → @GetMapping/@PostMapping - #343
Open
patrickbradley-cog wants to merge 1 commit into
Conversation
…apping/@PostMapping Co-Authored-By: patrick.bradley <patrick.bradley@cognition.ai>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
COG-1156 — W1 forward-compatible refactor on Boot 1.5.4 (no Boot/Java bump). In
AccountControllerandHomeController, every method-level@RequestMappingbecomes@GetMapping/@PostMapping; the unusedRequestMethodimport is dropped (andRequestMappinginHomeController, which no longer uses it). The class-level@RequestMapping("/account")onAccountControllerstays. Only annotations and imports change.Merge behind the W0 smoke suite (#106, #108, #109 / COG-1141). Those aren't on
masteryet, so this was checked with the existing test,mvn verifyand manual runs against MySQL (below).Mappings that had no
method(these now accept fewer verbs)The ticket says to check callers rather than default these to GET. I checked, and every caller uses GET:
GET /signup.htmlCancel linkth:href="@{/}";signupPostreturnsredirect:/GET /indexloginPage("/index")redirects andfailureUrl("/index?error")/logoutSuccessUrl("/index?logout");home()returnsredirect:/index.POST /indexis the form-login processing URL. Bothindex.htmland AdminPortallogin.service.tspost to it, andUsernamePasswordAuthenticationFilterhandles it beforeDispatcherServlet, so the controller method never saw a POSTGET /userFrontdefaultSuccessUrl("/userFront")redirect;header.htmlHome link;redirect:/userFrontin Account/Transfer/Appointment controllersGET /account/primaryAccount<a th:href>links inuserFront.htmlandcommon/header.htmlGET /account/savingsAccount<a th:href>links inuserFront.htmlandcommon/header.htmlAdminPortal calls only
/index(POST, handled by the security filter),/logoutand/api/**. It never calls the routes above. CORS preflightOPTIONSis answered byRequestFilterand never reaches these controllers.So the only change in behaviour: POST/PUT/DELETE on these five routes now return 405 instead of rendering the page or redirecting. No caller sends those verbs. GET and HEAD are unchanged.
Verification
Environment: Temurin 8 (
1.8), MySQL 5.7 in docker. The Boot 1.5.4 connectormysql-connector-java 5.1.42cannot talk to MySQL 8.SPRING_DATASOURCE_URL=...?useSSL=falseis needed because current Temurin 8 turns off the TLS versions that the 5.1 connector negotiates. Both are environment problems and would hitmasterthe same way.Behavioural probe: build the jar, start it against a fresh DB, sign up, log in, then send each verb to each route with a fresh login before every request. After that, deposit 100, withdraw 40, check the balance and render the primary account page. I ran it on
master(before) and on this branch (after):before (master)
after (this branch)
diff before.txt after.txt, which shows only the verb narrowing described above:Signup (POST
/signup), login (POST/index→/userFront), deposit/withdraw POSTs (→redirect:/userFront, primary balance 60.00) and the GET pages behave the same before and after.No CI is configured on this repo. AdminPortal was not touched.
Link to Devin session: https://app.devin.ai/sessions/74e7c201a8f24a65ac8390dbae253389
Open in Devin Desktop: https://app.devin.ai/desktop/session/74e7c201a8f24a65ac8390dbae253389?variant=devin
Requested by: @patrickbradley-cog
Devin Review