Skip to content

Commit a3264f1

Browse files
committed
[chore] Drop deprecated jruby.rack.filter.* properties; replaced by init parameters.
1 parent 4521c2a commit a3264f1

File tree

3 files changed

+8
-25
lines changed

3 files changed

+8
-25
lines changed

History.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Drop deprecated `Rack::Handler::Servlet::Env` and `Rack::Handler::Servlet::LazyEnv` types (replaced by `DefaultEnv`)
1111
- Drop undocumented and deprecated jruby-rack 1.0 backwards compat properties `jruby.runtime.timeout.sec`, `jruby.runtime.initializer.threads`, `jruby.init.serial`, `jruby.rack.request.size.threshold.bytes`
1212
- Drop deprecated `jruby.rack.ignore.env` property, replaced long ago by `jruby.runtime.env` and optional `jruby.runtime.env.rubyopt`
13+
- Drop deprecated `jruby.rack.filter.*` properties, replaced long ago by init parameters `addsHtmlToPathInfo` and `verifiesHtmlResource`
1314
- Drop deprecated `JRuby::Rack::RailsFileSystemLayout` alias for `JRuby::Rack::FileSystemLayout`
1415
- Drop deprecated `JRuby::Rack::Errors` alias for `JRuby::Rack::ErrorApp`
1516
- Drop deprecated `org.jruby.rack.RackInput` alias for `org.jruby.rack.ext.Input` class

README.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,14 @@ using is `org.jruby.rack.RackFilter`, the filter supports the following
144144
gets reset (accepts values "true", "false" and "buffer" to reset the buffer
145145
only), by default "true"
146146
- **addsHtmlToPathInfo** controls whether the .html suffix is added to the URI
147-
when checking if the request is for a static page
147+
when checking if the request is for a static page. The default behavior for
148+
Rails and many other Ruby applications is to add an *.html* extension to the
149+
resource and attempt to handle it before serving a dynamic request on the
150+
original URI. However, this behavior may confuse other servlets in your
151+
application that have a wildcard mapping. Defaults to true.
148152
- **verifiesHtmlResource** used with the previous parameter to make sure the
149-
requested static resource exists before adding the .html request URI suffix
153+
requested static resource exists before adding the .html request URI suffix.
154+
Defaults to false.
150155

151156
The application can also be configured to dispatch through a servlet instead of
152157
a filter, the servlet class name is `org.jruby.rack.RackServlet`.
@@ -245,20 +250,6 @@ as context init parameters in web.xml or as VM-wide system properties.
245250
been previously read this leads to a limitation (Rack won't see the POST paras).
246251
Thus an alternate pure 'servlet' env "conversion" is provided that maps servlet
247252
parameters (and cookies) directly to Rack params, avoiding Rack's input parsing.
248-
- `jruby.rack.filter.adds.html`:
249-
**deprecated** use `addsHtmlToPathInfo` filter config init parameter.
250-
The default behavior for Rails and many other Ruby applications is to add an
251-
*.html* extension to the resource and attempt to handle it before serving a
252-
dynamic request on the original URI.
253-
However, this behavior may confuse other servlets in your application that
254-
have a wildcard mapping. Defaults to true.
255-
- `jruby.rack.filter.verify.resource.exists`:
256-
**deprecated** use `verifiesHtmlResource` filter config init parameter.
257-
If `jruby.rack.filter.adds.html` is true, then this setting, when true, adds
258-
an additional check using `ServletContext#getResource` to verify that the
259-
*.html* resource exists. Default is false.
260-
(Note that apparently some servers may not implement `getResource` in the way
261-
that is expected here, so in that case this setting won't matter.)
262253

263254
## Initialization
264255

src/main/java/org/jruby/rack/RackFilter.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,12 @@ public RackFilter(RackDispatcher dispatcher, RackContext context) {
5757
@Override
5858
public void init(FilterConfig config) throws ServletException {
5959
super.init(config);
60-
initializeFromConfig(); // configure init parameters the "old" way
61-
62-
// filter init params are preffered and override context params :
6360
String value = config.getInitParameter("addsHtmlToPathInfo");
6461
if ( value != null ) setAddsHtmlToPathInfo(Boolean.parseBoolean(value));
6562
value = config.getInitParameter("verifiesHtmlResource");
6663
if ( value != null ) setVerifiesHtmlResource(Boolean.parseBoolean(value));
6764
}
6865

69-
private void initializeFromConfig() {
70-
final RackConfig rackConfig = getContext().getConfig(); // backward compatibility :
71-
addsHtmlToPathInfo = rackConfig.getBooleanProperty("jruby.rack.filter.adds.html", true);
72-
verifiesHtmlResource = rackConfig.getBooleanProperty("jruby.rack.filter.verifies.resource", false);
73-
}
74-
7566
@Override
7667
protected void doFilterInternal(
7768
final RequestCapture requestCapture,

0 commit comments

Comments
 (0)