diff --git a/pom.xml b/pom.xml index 48ae44ca..3cb2a61e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.primeframework prime-mvc - 5.1.1 + 5.2.0 jar FusionAuth App diff --git a/src/main/java/org/primeframework/mvc/action/DefaultActionMappingWorkflow.java b/src/main/java/org/primeframework/mvc/action/DefaultActionMappingWorkflow.java index 865b4536..2353aabe 100644 --- a/src/main/java/org/primeframework/mvc/action/DefaultActionMappingWorkflow.java +++ b/src/main/java/org/primeframework/mvc/action/DefaultActionMappingWorkflow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2024, Inversoft Inc., All Rights Reserved + * Copyright (c) 2001-2025, Inversoft Inc., All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import io.fusionauth.http.server.HTTPRequest; import io.fusionauth.http.server.HTTPResponse; import org.primeframework.mvc.NotAllowedException; +import org.primeframework.mvc.NotImplementedException; import org.primeframework.mvc.http.HTTPTools; import org.primeframework.mvc.http.Status; import org.primeframework.mvc.parameter.fileupload.annotation.FileUpload; @@ -93,7 +94,15 @@ public void perform(WorkflowChain chain) throws IOException { if (actionInvocation.action != null && actionInvocation.method == null) { Class actionClass = actionInvocation.configuration.actionClass; logger.debug("The action class [{}] does not have a valid execute method for the HTTP method [{}]", actionClass.getCanonicalName(), method); - throw new NotAllowedException(); + + // Differentiate between not allowed for this action, vs not-implemented (supported by prime-mvc). + if (HTTPMethod.StandardMethods.containsKey(method.name())) { + throw new NotAllowedException(); + } + + // Note that the DefaultActionConfigurationBuilder will only resolve executeMethods for methods named in StandardMethods. + // See HTTPMethod.StandardMethods and DefaultActionConfigurationBuilder.findExecuteMethods + throw new NotImplementedException(); } // Handle multipart file configuration diff --git a/src/test/java/org/primeframework/mvc/GlobalTest.java b/src/test/java/org/primeframework/mvc/GlobalTest.java index 16b112c2..40f9f580 100644 --- a/src/test/java/org/primeframework/mvc/GlobalTest.java +++ b/src/test/java/org/primeframework/mvc/GlobalTest.java @@ -1465,7 +1465,11 @@ public void notAllowed() { public void notImplemented() { simulator.test("/not-allowed") .method("POTATO") - .assertStatusCode(405) // Not allowed since we can handle any name but the action doesn't have that method + // We currently only map out execute methods in the action that are named by a method + // defined in the HTTPMethod.StandardMethods. If an action does not define a standard HTTP + // method, a 405 will be returned. If you ask for a non-standard method that is not implemented + // by prime-mvc, you will receive a 501. + .assertStatusCode(501) .assertHeaderContains("Cache-Control", "no-cache"); }