filter needs to be backward compatible
This commit is contained in:
1 parent
fd212a2a2a
commit
e714d4f724
4 files changed
+17
-57
No files matched your search
@@ -61,7 +61,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.spec.javax.servlet</groupId>
|
||||
<artifactId>jboss-servlet-api_3.1_spec</artifactId>
|
||||
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.spec.javax.servlet</groupId>
|
||||
<artifactId>jboss-servlet-api_3.1_spec</artifactId>
|
||||
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
+7
-55
@@ -23,7 +23,6 @@ import org.keycloak.adapters.spi.KeycloakAccount;
|
||||
import org.keycloak.common.util.Encode;
|
||||
import org.keycloak.common.util.MultivaluedHashMap;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -172,60 +171,13 @@ public class FilterSessionStore implements AdapterSessionStore {
|
||||
|
||||
@Override
|
||||
public ServletInputStream getInputStream() throws IOException {
|
||||
|
||||
if (needRequestRestore && body != null) {
|
||||
return new ServletInputStream() {
|
||||
private int lastIndex = 0;
|
||||
private ReadListener readListener = null;
|
||||
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return lastIndex == body.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadListener(ReadListener readListener) {
|
||||
this.readListener = readListener;
|
||||
if (!isFinished()) {
|
||||
try {
|
||||
readListener.onDataAvailable();
|
||||
} catch (IOException e) {
|
||||
readListener.onError(e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
readListener.onAllDataRead();
|
||||
} catch (IOException e) {
|
||||
readListener.onError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
int i = -1;
|
||||
if (!isFinished()) {
|
||||
i = body[lastIndex];
|
||||
lastIndex++;
|
||||
if (isFinished() && readListener != null) {
|
||||
try {
|
||||
readListener.onAllDataRead();
|
||||
} catch (IOException e) {
|
||||
readListener.onError(e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
};
|
||||
}
|
||||
return super.getInputStream();
|
||||
final ByteArrayInputStream is = new ByteArrayInputStream(body);
|
||||
return new ServletInputStream() {
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return is.read();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -65,6 +65,8 @@
|
||||
<jboss.spec.javax.xml.bind.jboss-jaxb-api_2.2_spec.version>1.0.4.Final</jboss.spec.javax.xml.bind.jboss-jaxb-api_2.2_spec.version>
|
||||
<log4j.version>1.2.16</log4j.version>
|
||||
<resteasy.version>3.0.14.Final</resteasy.version>
|
||||
<!-- KEEP Servlet 3.0!!! We need to keep some adapters like Filter backwards compatible -->
|
||||
<servlet.api.30.version>1.0.2.Final</servlet.api.30.version>
|
||||
<servlet.api.31.version>1.0.0.Final</servlet.api.31.version>
|
||||
<slf4j.version>1.7.7</slf4j.version>
|
||||
<sun.istack.version>2.21</sun.istack.version>
|
||||
@@ -301,6 +303,12 @@
|
||||
<artifactId>jackson-jaxrs-base</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<!-- KEEP Servlet 3.0! Some adapters need to remain backward compatible and can't let stuff creep in -->
|
||||
<dependency>
|
||||
<groupId>org.jboss.spec.javax.servlet</groupId>
|
||||
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
|
||||
<version>${servlet.api.30.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.spec.javax.servlet</groupId>
|
||||
<artifactId>jboss-servlet-api_3.1_spec</artifactId>
|
||||
|
||||
Reference in new issue
Block a user