Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support versions of type 2.2.3.qualifier #1741

Merged
merged 1 commit into from
Oct 19, 2014
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public Action inspect(final AtmosphereResource ar) {

if (enforceAtmosphereVersion) {
String javascriptVersion = request.getHeader(HeaderConfig.X_ATMOSPHERE_FRAMEWORK);
int version = Integer.valueOf(javascriptVersion.split("-")[0].replace(".", ""));
int version = parseVersion(javascriptVersion.split("-")[0]);
if (version < 221) {
logger.error("Invalid Atmosphere Version {}", javascriptVersion);
response.setStatus(501);
Expand Down Expand Up @@ -170,6 +170,12 @@ public void onSuspend(AtmosphereResourceEvent event) {
return Action.CONTINUE;
}

private static int parseVersion(String version) {
// Remove any qualifier if the version is 1.2.3.qualifier
String[] parts = version.split("\\.");
return Integer.valueOf(parts[0] + parts[1] + parts[2]);
}

public String wsDelimiter() {
return wsDelimiter;
}
Expand All @@ -192,4 +198,4 @@ public JavaScriptProtocol enforceAtmosphereVersion(boolean enforceAtmosphereVers
public String toString() {
return "Atmosphere JavaScript Protocol";
}
}
}