Skip to content
This repository was archived by the owner on Mar 20, 2021. It is now read-only.

Commit 85776ff

Browse files
committed
[2.3.x] Further Mapper changes for Servlet 4.0 support. Patch provided by edburns 'at' java.net.
1 parent 8fce630 commit 85776ff

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Diff for: modules/http-server/src/main/java/org/glassfish/grizzly/http/server/util/Mapper.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,7 @@ private void internalMapWrapper(Context context, CharChunk path,
11321132
mappingData.pathInfo.setString("/");
11331133
mappingData.mappingType = MappingData.CONTEXT_ROOT;
11341134
mappingData.descriptorPath = "/";
1135+
mappingData.matchedPath = "/";
11351136
}
11361137
}
11371138

@@ -1277,6 +1278,7 @@ private void internalMapWrapper(Context context, CharChunk path,
12771278
mappingData.wrapperPath.setString(pathStr);
12781279
mappingData.mappingType = MappingData.DEFAULT;
12791280
mappingData.descriptorPath = "/";
1281+
mappingData.matchedPath = "/";
12801282
}
12811283
}
12821284
}
@@ -1331,8 +1333,9 @@ private void internalMapWrapper(Context context, CharChunk path,
13311333
(path.getBuffer(), path.getStart(), path.getEnd());
13321334
mappingData.wrapperPath.setChars
13331335
(path.getBuffer(), path.getStart(), path.getEnd());
1334-
mappingData.mappingType = MappingData.DEFAULT;
1336+
mappingData.mappingType = MappingData.CONTEXT_ROOT;
13351337
mappingData.descriptorPath = "/";
1338+
mappingData.matchedPath = "/";
13361339
}
13371340
// Redirection to a folder
13381341
char[] buf = path.getBuffer();
@@ -1399,8 +1402,12 @@ private void internalMapWrapper(Context context, CharChunk path,
13991402
mappingData.wrapperPath.setString(wrappers[pos].name);
14001403
mappingData.wrapper = wrappers[pos].object;
14011404
mappingData.servletName = wrappers[pos].servletName;
1402-
mappingData.mappingType = MappingData.EXACT;
14031405
mappingData.descriptorPath = wrappers[pos].path;
1406+
mappingData.matchedPath = path.toString();
1407+
mappingData.mappingType =
1408+
(("/".equals(mappingData.matchedPath))
1409+
? MappingData.DEFAULT
1410+
: MappingData.EXACT);
14041411
}
14051412
}
14061413

@@ -1454,6 +1461,7 @@ private void internalMapWrapper(Context context, CharChunk path,
14541461
mappingData.jspWildCard = wrappers[pos].jspWildCard;
14551462
mappingData.mappingType = MappingData.PATH;
14561463
mappingData.descriptorPath = wrappers[pos].path;
1464+
mappingData.matchedPath = path.toString();
14571465
}
14581466
}
14591467
}
@@ -1499,6 +1507,7 @@ private void internalMapWrapper(Context context, CharChunk path,
14991507
}
15001508
path.setStart(servletPath);
15011509
path.setEnd(pathEnd);
1510+
mappingData.matchedPath = path.toString();
15021511
}
15031512
}
15041513
}

Diff for: modules/http-server/src/main/java/org/glassfish/grizzly/http/server/util/MappingData.java

+3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public class MappingData {
8080
public Object wrapper = null;
8181
public String servletName = null;
8282
public String descriptorPath = null;
83+
public String matchedPath = null;
8384
public boolean jspWildCard = false;
8485
// START GlassFish 1024
8586
public boolean isDefaultContext = false;
@@ -108,6 +109,7 @@ public void recycle() {
108109
isDefaultContext = false;
109110
// END GlassFish 1024
110111
descriptorPath = null;
112+
matchedPath = null;
111113
}
112114

113115
@Override
@@ -124,6 +126,7 @@ public String toString() {
124126
sb.append("\nredirectPath: ").append(redirectPath);
125127
sb.append("\nmappingType: ").append(getMappingDescription());
126128
sb.append("\ndescriptorPath: ").append(descriptorPath);
129+
sb.append("\nmatchedPath: ").append(matchedPath);
127130
return sb.toString();
128131
}
129132

0 commit comments

Comments
 (0)