You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2007/04/06 04:12:25 UTC
svn commit: r526026 [2/2] - in
/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http:
./ server/
Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/HttpFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/HttpFactory.java?view=diff&rev=526026&r1=526025&r2=526026
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/HttpFactory.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/HttpFactory.java Thu Apr 5 19:12:24 2007
@@ -29,11 +29,8 @@
package org.apache.axis2.transport.http.server;
-import edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue;
-import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService;
-import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue;
-import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor;
-import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
+import java.io.IOException;
+
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.context.ConfigurationContext;
@@ -56,7 +53,11 @@
import org.apache.http.protocol.ResponseDate;
import org.apache.http.protocol.ResponseServer;
-import java.io.IOException;
+import edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue;
+import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService;
+import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue;
+import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor;
+import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
/**
* Factory used to configure and create the various instances required in http transports.
@@ -244,17 +245,15 @@
/**
* Create the listener for request connections
*/
- public IOProcessor newRequestConnectionListener(HttpConnectionFactory factory,
- HttpConnectionManager manager, int port)
- throws IOException {
- return new DefaultConnectionListener(port, factory, manager);
- }
-
- /**
- * Create a request connection
- */
- public HttpConnectionFactory newRequestConnectionFactory(HttpParams params) {
- return new DefaultHttpConnectionFactory(params);
+ public IOProcessor newRequestConnectionListener(
+ int port,
+ final HttpConnectionManager manager,
+ final HttpParams params) throws IOException {
+ return new DefaultConnectionListener(
+ port,
+ manager,
+ new DefaultConnectionListenerFailureHandler(),
+ params);
}
/**
@@ -320,7 +319,7 @@
httpProcessor.addInterceptor(new ResponseContent());
httpProcessor.addInterceptor(new ResponseConnControl());
httpProcessor.addInterceptor(new ResponseSessionCookie());
- return new LoggingProcessorDecorator(httpProcessor);
+ return httpProcessor;
}
public ConnectionReuseStrategy newConnStrategy() {
Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java?view=diff&rev=526026&r1=526025&r2=526026
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/HttpServiceProcessor.java Thu Apr 5 19:12:24 2007
@@ -33,10 +33,8 @@
import org.apache.commons.logging.LogFactory;
import org.apache.http.ConnectionClosedException;
import org.apache.http.HttpException;
-import org.apache.http.HttpServerConnection;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.HttpExecutionContext;
-import org.apache.http.protocol.HttpService;
import java.io.IOException;
import java.net.SocketException;
@@ -53,13 +51,13 @@
private volatile boolean terminated;
- private final HttpService httpservice;
- private final HttpServerConnection conn;
+ private final AxisHttpService httpservice;
+ private final AxisHttpConnection conn;
private final IOProcessorCallback callback;
public HttpServiceProcessor(
- final HttpService httpservice,
- final HttpServerConnection conn,
+ final AxisHttpService httpservice,
+ final AxisHttpConnection conn,
final IOProcessorCallback callback) {
super();
this.httpservice = httpservice;
Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/HttpUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/HttpUtils.java?view=diff&rev=526026&r1=526025&r2=526026
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/HttpUtils.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/HttpUtils.java Thu Apr 5 19:12:24 2007
@@ -29,7 +29,6 @@
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.http.Header;
-import org.apache.http.HttpRequest;
import java.net.InetAddress;
import java.net.NetworkInterface;
@@ -41,7 +40,7 @@
private HttpUtils() {
}
- public static String getSoapAction(final HttpRequest request) {
+ public static String getSoapAction(final AxisHttpRequest request) {
if (request == null) {
return null;
}
Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/LoggingProcessorDecorator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/LoggingProcessorDecorator.java?view=diff&rev=526026&r1=526025&r2=526026
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/LoggingProcessorDecorator.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/LoggingProcessorDecorator.java Thu Apr 5 19:12:24 2007
@@ -1,84 +0,0 @@
-/*
-* $HeadURL$
-* $Revision$
-* $Date$
-*
-* ====================================================================
-*
-* Copyright 1999-2004 The Apache Software Foundation
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ====================================================================
-*
-* This software consists of voluntary contributions made by many
-* individuals on behalf of the Apache Software Foundation. For more
-* information on the Apache Software Foundation, please see
-* <http://www.apache.org/>.
-*/
-package org.apache.axis2.transport.http.server;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.Header;
-import org.apache.http.HttpException;
-import org.apache.http.HttpRequest;
-import org.apache.http.HttpResponse;
-import org.apache.http.protocol.HttpContext;
-import org.apache.http.protocol.HttpProcessor;
-
-import java.io.IOException;
-
-/**
- * This class wraps an arbitrary {@link HttpProcessor} and extends it with
- * an additional request / response debugging service
- */
-public class LoggingProcessorDecorator implements HttpProcessor {
-
- private static final Log HEADERLOG =
- LogFactory.getLog("org.apache.axis2.transport.http.server.wire");
-
- final private HttpProcessor httpProcessor;
-
- public LoggingProcessorDecorator(final HttpProcessor httpProcessor) {
- super();
- if (httpProcessor == null) {
- throw new IllegalArgumentException("HTTP processor may not be null");
- }
- this.httpProcessor = httpProcessor;
- }
-
- public void process(final HttpRequest request, final HttpContext context)
- throws HttpException, IOException {
- this.httpProcessor.process(request, context);
- if (HEADERLOG.isDebugEnabled()) {
- HEADERLOG.debug(">> " + request.getRequestLine().toString());
- Header[] headers = request.getAllHeaders();
- for (int i = 0; i < headers.length; i++) {
- HEADERLOG.debug(">> " + headers[i].toString());
- }
- }
- }
-
- public void process(final HttpResponse response, final HttpContext context)
- throws HttpException, IOException {
- this.httpProcessor.process(response, context);
- if (HEADERLOG.isDebugEnabled()) {
- HEADERLOG.debug("<< " + response.getStatusLine().toString());
- Header[] headers = response.getAllHeaders();
- for (int i = 0; i < headers.length; i++) {
- HEADERLOG.debug("<< " + headers[i].toString());
- }
- }
- }
-
-}
Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/OutputBuffer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/OutputBuffer.java?view=diff&rev=526026&r1=526025&r2=526026
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/OutputBuffer.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/OutputBuffer.java Thu Apr 5 19:12:24 2007
@@ -1,152 +0,0 @@
-/*
-* $HeadURL$
-* $Revision$
-* $Date$
-*
-* ====================================================================
-*
-* Copyright 1999-2004 The Apache Software Foundation
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-* ====================================================================
-*
-* This software consists of voluntary contributions made by many
-* individuals on behalf of the Apache Software Foundation. For more
-* information on the Apache Software Foundation, please see
-* <http://www.apache.org/>.
-*/
-package org.apache.axis2.transport.http.server;
-
-import org.apache.axis2.transport.OutTransportInfo;
-import org.apache.http.Header;
-import org.apache.http.HttpEntity;
-import org.apache.http.message.BasicHeader;
-import org.apache.http.protocol.HTTP;
-import org.apache.http.util.ByteArrayBuffer;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public class OutputBuffer implements OutTransportInfo, HttpEntity {
-
- private final ByteArrayBuffer buffer;
- private String contentType;
- private boolean chunked;
-
- public OutputBuffer(int initialCapacity) {
- super();
- this.buffer = new ByteArrayBuffer(initialCapacity);
- this.contentType = "text/xml";
- }
-
- public OutputBuffer() {
- this(1024);
- }
-
- public OutputStream getOutputStream() {
- return new BufferOutputStream(this.buffer);
- }
-
- public InputStream getContent() throws IOException, IllegalStateException {
- return new ByteArrayInputStream(this.buffer.toByteArray());
- }
-
- public void setContentType(final String contentType) {
- this.contentType = contentType;
- }
-
- public Header getContentType() {
- return new BasicHeader(HTTP.CONTENT_TYPE, this.contentType);
- }
-
- public void consumeContent() throws IOException {
- }
-
- public Header getContentEncoding() {
- return null;
- }
-
- public long getContentLength() {
- return this.buffer.length();
- }
-
- public boolean isChunked() {
- return this.chunked;
- }
-
- public void setChunked(boolean b) {
- this.chunked = b;
- }
-
- public boolean isRepeatable() {
- return true;
- }
-
- public boolean isStreaming() {
- return false;
- }
-
- public void writeTo(final OutputStream outstream) throws IOException {
- outstream.write(this.buffer.buffer(), 0, this.buffer.length());
- }
-
- public String toString() {
- return new String(this.buffer.buffer(), 0, this.buffer.length());
- }
-
- private static class BufferOutputStream extends OutputStream {
-
- private final ByteArrayBuffer buffer;
- private boolean closed = false;
-
- public BufferOutputStream(final ByteArrayBuffer buffer) {
- super();
- this.buffer = buffer;
- }
-
- public void close() throws IOException {
- this.closed = true;
- }
-
- private void ensureNotClosed() {
- if (this.closed) {
- throw new IllegalStateException("Stream closed");
- }
- }
-
- public void write(byte[] b, int off, int len) throws IOException {
- ensureNotClosed();
- if (b == null) {
- return;
- }
- this.buffer.append(b, off, len);
- }
-
- public void write(byte[] b) throws IOException {
- ensureNotClosed();
- if (b == null) {
- return;
- }
- this.buffer.append(b, 0, b.length);
- }
-
- public void write(int b) throws IOException {
- ensureNotClosed();
- this.buffer.append(b);
- }
-
- }
-
-}
Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java?view=diff&rev=526026&r1=526025&r2=526026
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java Thu Apr 5 19:12:24 2007
@@ -27,7 +27,6 @@
*
*/
-
package org.apache.axis2.transport.http.server;
import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService;
@@ -56,7 +55,6 @@
private IOProcessor listener = null;
private ExecutorService listenerExecutor = null;
private HttpConnectionManager connmanager = null;
- private HttpConnectionFactory connfactory = null;
private ExecutorService requestExecutor = null;
public SimpleHttpServer(ConfigurationContext configurationContext, WorkerFactory workerFactory,
@@ -77,8 +75,7 @@
connmanager =
httpFactory.newRequestConnectionManager(requestExecutor, workerFactory, params);
listenerExecutor = httpFactory.newListenerExecutor(port);
- connfactory = httpFactory.newRequestConnectionFactory(params);
- listener = httpFactory.newRequestConnectionListener(connfactory, connmanager, port);
+ listener = httpFactory.newRequestConnectionListener(port, connmanager, params);
}
public void destroy() throws IOException, InterruptedException {
Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/Worker.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/Worker.java?view=diff&rev=526026&r1=526025&r2=526026
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/Worker.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/server/Worker.java Thu Apr 5 19:12:24 2007
@@ -29,14 +29,12 @@
import org.apache.axis2.context.MessageContext;
import org.apache.http.HttpException;
-import org.apache.http.HttpRequest;
-import org.apache.http.HttpResponse;
import java.io.IOException;
public interface Worker {
- void service(HttpRequest request, HttpResponse response, MessageContext msgContext)
+ void service(AxisHttpRequest request, AxisHttpResponse response, MessageContext msgContext)
throws HttpException, IOException;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org