Skip to content

Instantly share code, notes, and snippets.

@aruld
Created January 7, 2013 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aruld/4478148 to your computer and use it in GitHub Desktop.
Save aruld/4478148 to your computer and use it in GitHub Desktop.
Patch for JERSEY-1641 (Upgrade to Simple 5.0.4 in Jersey 1.x)
Index: contribs/jersey-simple-server/src/main/java/com/sun/jersey/simple/impl/container/SimpleContainer.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- contribs/jersey-simple-server/src/main/java/com/sun/jersey/simple/impl/container/SimpleContainer.java (revision 5823)
+++ contribs/jersey-simple-server/src/main/java/com/sun/jersey/simple/impl/container/SimpleContainer.java (revision )
@@ -65,7 +65,7 @@
* This is the container that handles all HTTP requests. Requests are adapted
* for the enclosed {@link WebApplication} instances. This container can
* service both HTTP and HTTPS traffic transparently, when created using the
- * factory methods of {@link com.sun.jersey.api.simple.container.SimpleServerFactory}
+ * factory methods of {@link com.sun.jersey.simple.container.SimpleServerFactory}
* or when instantiating it and making a direct connection to the container.
*
* @author Marc.Hadley@Sun.Com
@@ -93,14 +93,14 @@
String method = request.getMethod();
response.setCode(code);
- response.setText(text);
+ response.setDescription(text);
if (!method.equalsIgnoreCase("HEAD") && contentLength != -1 && contentLength < Integer.MAX_VALUE) {
response.setContentLength((int)contentLength);
}
for (Map.Entry<String, List<Object>> e : cResponse.getHttpHeaders().entrySet()) {
for (Object value : e.getValue()) {
- response.add(e.getKey(), ContainerResponse.getHeaderValue(value));
+ response.setValue(e.getKey(), ContainerResponse.getHeaderValue(value));
}
}
return response.getOutputStream();
Index: contribs/jersey-simple-server/src/main/java/com/sun/jersey/simple/container/SimpleServerFactory.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- contribs/jersey-simple-server/src/main/java/com/sun/jersey/simple/container/SimpleServerFactory.java (revision 5823)
+++ contribs/jersey-simple-server/src/main/java/com/sun/jersey/simple/container/SimpleServerFactory.java (revision )
@@ -48,6 +48,8 @@
import javax.net.ssl.SSLContext;
import org.simpleframework.http.core.Container;
+import org.simpleframework.http.core.ContainerServer;
+import org.simpleframework.transport.Server;
import org.simpleframework.transport.connect.Connection;
import org.simpleframework.transport.connect.SocketConnection;
@@ -493,7 +495,8 @@
port = defaultPort;
}
SocketAddress listen = new InetSocketAddress(port);
- Connection connection = new SocketConnection(container);
+ Server server = new ContainerServer(container);
+ Connection connection = new SocketConnection(server);
connection.connect(listen, context);
Index: contribs/jersey-simple-server/pom.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- contribs/jersey-simple-server/pom.xml (revision 5823)
+++ contribs/jersey-simple-server/pom.xml (revision )
@@ -55,7 +55,7 @@
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple</artifactId>
- <version>4.1.20</version>
+ <version>5.0.4</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
Index: contribs/jersey-simple-server/src/test/java/com/sun/jersey/server/simple/impl/container/AbstractSimpleServerTester.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- contribs/jersey-simple-server/src/test/java/com/sun/jersey/server/simple/impl/container/AbstractSimpleServerTester.java (revision 5823)
+++ contribs/jersey-simple-server/src/test/java/com/sun/jersey/server/simple/impl/container/AbstractSimpleServerTester.java (revision )
@@ -48,6 +48,8 @@
import junit.framework.TestCase;
import org.simpleframework.http.core.Container;
+import org.simpleframework.http.core.ContainerServer;
+import org.simpleframework.transport.Server;
import org.simpleframework.transport.connect.Connection;
import org.simpleframework.transport.connect.SocketConnection;
@@ -103,7 +105,8 @@
}
try {
SocketAddress listen = new InetSocketAddress(port);
- connection = new SocketConnection(container);
+ Server server = new ContainerServer(container);
+ connection = new SocketConnection(server);
connection.connect(listen);
} catch (Exception e) {
throw new RuntimeException(e);
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment