+ add setter for servlet minor version to MockServletContext
This commit is contained in:
Costin Leau
2009-11-09 11:51:30 +00:00
parent 7ec9f1506a
commit 9a111e504f
3 changed files with 41 additions and 8 deletions

View File

@@ -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);
}
}
}
}