Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.savant
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ logbackVersion = "1.5.13"
slf4jVersion = "2.0.13"
testngVersion = "7.8.0"

project(group: "org.primeframework", name: "prime-mvc", version: "5.3.0", licenses: ["ApacheV2_0"]) {
project(group: "org.primeframework", name: "prime-mvc", version: "5.3.1", licenses: ["ApacheV2_0"]) {
workflow {
fetch {
// Dependency resolution order:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.primeframework</groupId>
<artifactId>prime-mvc</artifactId>
<version>5.3.0</version>
<version>5.3.1</version>
<packaging>jar</packaging>

<name>FusionAuth App</name>
Expand Down
40 changes: 40 additions & 0 deletions src/test/java/org/example/action/meta/RefreshAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
package org.example.action.meta;

import org.primeframework.mvc.ErrorException;
import org.primeframework.mvc.action.annotation.Action;
import org.primeframework.mvc.action.result.annotation.Forward;

/**
* @author Daniel DeGroff
*/
@Action
@Forward.List({
@Forward(code = "input-lc", page = "/meta/refresh-lc.ftl"),
@Forward(code = "input-uc", page = "/meta/refresh-uc.ftl")
})
public class RefreshAction {
public String test = "lc";

public String get() {
if (test == null || !(test.equals("lc") || test.equals("uc"))) {
throw new ErrorException("error");
}

return "input-" + test;
}
}
28 changes: 28 additions & 0 deletions src/test/java/org/example/action/meta/TargetAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*/
package org.example.action.meta;

import org.primeframework.mvc.action.annotation.Action;

/**
* @author Daniel DeGroff
*/
@Action
public class TargetAction {
public String get() {
return "input";
}
}
24 changes: 24 additions & 0 deletions src/test/java/org/primeframework/mvc/GlobalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,30 @@ public void flash_scope_compatibility() throws Exception {
;
}

@Test
public void follow_meta_refresh() throws Exception {
// use upper case Refresh and URL, and lower case refresh and url
test.forEach("uc", "uc")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here. I think this should be ("uc", "lc")

Copy link
Member Author

@robotdan robotdan Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uh.. how did I miss that? 🤷 I know I tested both.. maybe I fat fingered it while cleaning it up. Thank you.

.test(param -> test
.simulate(() -> simulator
.test("/meta/refresh")
.withURLParameter("test", param)
.get()
.assertStatusCode(200)
.assertBodyContains("""
<meta http-equiv="{refresh}" content="0; {url}=/meta/target">
"""
.replace("{refresh}", param.equals("uc") ? "Refresh" : "refresh")
.replace("{url}", param.equals("uc") ? "URL" : "url"))

.followMetaRefresh(result -> result
.assertStatusCode(200)
.assertBody("""
We made it!
""")))
);
}

@Test
public void get() throws Exception {
// Not called yet
Expand Down
7 changes: 4 additions & 3 deletions src/test/java/org/primeframework/mvc/test/RequestResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -1892,13 +1892,14 @@ private RequestResult handleFollowMetaRefresh(ThrowingConsumer<RequestResult> re
if (element.hasAttr("http-equiv")) {
String value = element.attr("http-equiv");
// Never null
if (value.equals("refresh")) {
if (value.equalsIgnoreCase("refresh")) {
String content = element.attr("content");
// Handle this
String[] parts = content.split(";");
for (String part : parts) {
if (part.startsWith("URL=")) {
String uri = part.substring(4);
String trimmedPart = part.trim();
if (trimmedPart.toLowerCase(Locale.ROOT).startsWith("url=")) {
String uri = trimmedPart.substring(4);
if (uri.startsWith("'")) {
uri = uri.substring(1, uri.length() - 1);
}
Expand Down
8 changes: 8 additions & 0 deletions src/test/web/templates/meta/refresh-lc.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html lang="en_US">
[#-- Note that refresh and URL are intentionally lowercase--]
<head>
<meta http-equiv="refresh" content="0; url=/meta/target">
<title>Refresh please</title>
</head>
<body></body>
</html>
8 changes: 8 additions & 0 deletions src/test/web/templates/meta/refresh-uc.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<html lang="en_US">
[#-- Note that refresh and URL are intentionally lowercase--]
<head>
<meta http-equiv="Refresh" content="0; URL=/meta/target">
<title>Refresh please</title>
</head>
<body></body>
</html>
1 change: 1 addition & 0 deletions src/test/web/templates/meta/target.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
We made it!