SPR-6194
+ add setter for servlet minor version to MockServletContext
This commit is contained in:
@@ -97,6 +97,7 @@ public class MockServletContext implements ServletContext {
|
||||
|
||||
private String servletContextName = "MockServletContext";
|
||||
|
||||
private int minorVersion = 5;
|
||||
|
||||
/**
|
||||
* Create a new MockServletContext, using no base path and a
|
||||
@@ -181,7 +182,7 @@ public class MockServletContext implements ServletContext {
|
||||
}
|
||||
|
||||
public int getMinorVersion() {
|
||||
return 5;
|
||||
return this.minorVersion;
|
||||
}
|
||||
|
||||
public String getMimeType(String filePath) {
|
||||
@@ -340,6 +341,11 @@ public class MockServletContext implements ServletContext {
|
||||
return this.servletContextName;
|
||||
}
|
||||
|
||||
public void setMinorVersion(int minorVersion) {
|
||||
if (minorVersion <3 || minorVersion > 5)
|
||||
throw new IllegalArgumentException("Only Servlet minor versions between 3 and 5 are supported");
|
||||
this.minorVersion = minorVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inner factory class used to just introduce a Java Activation Framework
|
||||
@@ -351,5 +357,4 @@ public class MockServletContext implements ServletContext {
|
||||
return FileTypeMap.getDefaultFileTypeMap().getContentType(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user