Renamed 'rx' package to 'reactive'
This commit is contained in:
2
spring-web-reactive/.gitignore
vendored
2
spring-web-reactive/.gitignore
vendored
@@ -6,3 +6,5 @@ target
|
||||
/.idea/
|
||||
bin
|
||||
.gradle
|
||||
tomcat*
|
||||
build
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.rx.io;/*
|
||||
package org.springframework.reactive.io;/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -20,7 +20,7 @@ import java.io.InputStream;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
import org.springframework.rx.util.BlockingSignalQueue;
|
||||
import org.springframework.reactive.util.BlockingSignalQueue;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.springframework.rx.io;
|
||||
package org.springframework.reactive.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -6,7 +6,7 @@ import java.util.Arrays;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
import org.springframework.rx.util.BlockingSignalQueue;
|
||||
import org.springframework.reactive.util.BlockingSignalQueue;
|
||||
|
||||
/**
|
||||
* {@code OutputStream} implementation that stores all written bytes, to be retrieved
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.util;
|
||||
package org.springframework.reactive.util;
|
||||
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.util;
|
||||
package org.springframework.reactive.util;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.util;
|
||||
package org.springframework.reactive.util;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.util;
|
||||
package org.springframework.reactive.util;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.util;
|
||||
package org.springframework.reactive.util;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.web.servlet;
|
||||
package org.springframework.reactive.web;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.web.servlet;
|
||||
package org.springframework.reactive.web.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.web.servlet;
|
||||
package org.springframework.reactive.web.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.servlet.AsyncContext;
|
||||
@@ -26,6 +26,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
import org.springframework.reactive.web.HttpHandler;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.web.servlet;
|
||||
package org.springframework.reactive.web.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
@@ -14,10 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.web.servlet;
|
||||
package org.springframework.reactive.web.servlet;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.WriteListener;
|
||||
|
||||
@@ -41,7 +40,7 @@ public class ResponseBodySubscriber implements WriteListener, Subscriber<byte[]>
|
||||
|
||||
private byte[] buffer;
|
||||
|
||||
private AtomicBoolean complete = new AtomicBoolean(false);
|
||||
private volatile boolean subscriberComplete = false;
|
||||
|
||||
public ResponseBodySubscriber(AsyncContextSynchronizer synchronizer) {
|
||||
this.synchronizer = synchronizer;
|
||||
@@ -72,7 +71,9 @@ public class ResponseBodySubscriber implements WriteListener, Subscriber<byte[]>
|
||||
public void onComplete() {
|
||||
logger.debug("Complete buffer: " + (buffer == null));
|
||||
|
||||
if (complete.compareAndSet(false, true) && buffer == null) {
|
||||
this.subscriberComplete = true;
|
||||
|
||||
if (buffer == null) {
|
||||
this.synchronizer.writeComplete();
|
||||
}
|
||||
}
|
||||
@@ -84,20 +85,22 @@ public class ResponseBodySubscriber implements WriteListener, Subscriber<byte[]>
|
||||
boolean ready = output.isReady();
|
||||
logger.debug("Output: " + ready + " buffer: " + (buffer == null));
|
||||
|
||||
if (this.buffer != null && ready) {
|
||||
output.write(this.buffer);
|
||||
this.buffer = null;
|
||||
if (ready) {
|
||||
if (this.buffer != null) {
|
||||
output.write(this.buffer);
|
||||
this.buffer = null;
|
||||
|
||||
if (!complete.get()) {
|
||||
this.subscription.request(1);
|
||||
if (!subscriberComplete) {
|
||||
this.subscription.request(1);
|
||||
}
|
||||
else {
|
||||
this.synchronizer.writeComplete();
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.synchronizer.writeComplete();
|
||||
this.subscription.request(1);
|
||||
}
|
||||
}
|
||||
else if (this.buffer == null && ready) {
|
||||
this.subscription.request(1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,7 +108,4 @@ public class ResponseBodySubscriber implements WriteListener, Subscriber<byte[]>
|
||||
logger.error("ResponseBodySubscriber error", t);
|
||||
}
|
||||
|
||||
|
||||
private void complete() {
|
||||
}
|
||||
}
|
||||
@@ -14,14 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.io;
|
||||
package org.springframework.reactive.io;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.rx.util.BlockingSignalQueue;
|
||||
import org.springframework.reactive.util.BlockingSignalQueue;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.util;
|
||||
package org.springframework.reactive.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.util;
|
||||
package org.springframework.reactive.util;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.web.servlet;
|
||||
package org.springframework.reactive.web;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -51,7 +51,6 @@ public class CountingHttpHandler implements HttpHandler {
|
||||
@Override
|
||||
public void onError(Throwable t) {
|
||||
logger.error("CountingHttpHandler Error", t);
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.web.servlet;
|
||||
package org.springframework.reactive.web;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.web.servlet;
|
||||
package org.springframework.reactive.web.servlet;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Random;
|
||||
@@ -62,7 +62,7 @@ public abstract class AbstractHttpHandlerServletIntegrationTestCase {
|
||||
assertEquals(body, response.getBody());
|
||||
}
|
||||
|
||||
private static String url() {
|
||||
protected static String url() {
|
||||
return "http://localhost:" + port + "/rx";
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.web.servlet;
|
||||
package org.springframework.reactive.web.servlet;
|
||||
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
@@ -23,7 +23,7 @@ import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import org.springframework.util.SocketUtils;
|
||||
import org.springframework.reactive.web.EchoHandler;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
@@ -37,7 +37,6 @@ public class HttpHandlerServletJettyIntegrationTests
|
||||
public static void startServer() throws Exception {
|
||||
jettyServer = new Server();
|
||||
ServerConnector connector = new ServerConnector(jettyServer);
|
||||
port = SocketUtils.findAvailableTcpPort();
|
||||
connector.setPort(port);
|
||||
ServletContextHandler handler = new ServletContextHandler(jettyServer, "", false, false);
|
||||
HttpHandlerServlet servlet = new HttpHandlerServlet();
|
||||
@@ -53,4 +52,10 @@ public class HttpHandlerServletJettyIntegrationTests
|
||||
jettyServer.stop();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
startServer();
|
||||
System.out.println("Jetty running at: " + url());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.rx.web.servlet;
|
||||
package org.springframework.reactive.web.servlet;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -24,6 +24,8 @@ import org.apache.catalina.startup.Tomcat;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import org.springframework.reactive.web.EchoHandler;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
@@ -52,4 +54,10 @@ public class HttpHandlerServletTomcatIntegrationTests extends AbstractHttpHandle
|
||||
tomcatServer.stop();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
startServer();
|
||||
System.out.println("Tomcat running at: " + url());
|
||||
tomcatServer.getServer().await();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user