Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 54613 invoked from network); 9 Feb 2005 08:46:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 9 Feb 2005 08:46:46 -0000 Received: (qmail 69691 invoked by uid 500); 9 Feb 2005 08:46:45 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 69663 invoked by uid 500); 9 Feb 2005 08:46:45 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 69639 invoked by uid 99); 9 Feb 2005 08:46:45 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 09 Feb 2005 00:46:44 -0800 Received: (qmail 54581 invoked by uid 65534); 9 Feb 2005 08:46:43 -0000 Message-ID: <20050209084643.54580.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: svnmailer-1.0.0-dev Date: Wed, 09 Feb 2005 08:46:43 -0000 Subject: svn commit: r153039 - in webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis: clientapi/ engine/ impl/handlers/ impl/providers/ impl/transport/http/ impl/transport/tcp/ impl/utils/ To: axis-cvs@ws.apache.org From: hemapani@apache.org X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Author: hemapani Date: Wed Feb 9 00:46:39 2005 New Revision: 153039 URL: http://svn.apache.org/viewcvs?view=3Drev&rev=3D153039 Log: cleaning up the code Removed: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/utils/ Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/clientapi/AbstractCall.java webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/clientapi/Call.java webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/clientapi/Invoker.java webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/engine/AxisEngine.java webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/handlers/AbstractHandler.java webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/providers/RawXMLProvider.java webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/transport/http/SimpleHTTPReceiver.java webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/transport/tcp/TCPTransportReceiver.java Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/a= pache/axis/clientapi/AbstractCall.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/= prototype2/src/java/org/apache/axis/clientapi/AbstractCall.java?view=3Ddiff= &r1=3D153038&r2=3D153039 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/clientapi/AbstractCall.java (original) +++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/clientapi/AbstractCall.java Wed Feb 9 00:46:39 2005 @@ -15,26 +15,27 @@ */ package org.apache.axis.clientapi; =20 +import java.io.InputStream; +import java.io.InputStreamReader; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + import org.apache.axis.context.MessageContext; -import org.apache.axis.engine.AxisEngine; import org.apache.axis.engine.AxisFault; +import org.apache.axis.engine.EngineRegistry; import org.apache.axis.impl.llom.builder.StAXBuilder; import org.apache.axis.impl.llom.builder.StAXSOAPModelBuilder; import org.apache.axis.om.OMFactory; import org.apache.axis.om.SOAPEnvelope; =20 -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import java.io.InputStream; -import java.io.InputStreamReader; - =20 public abstract class AbstractCall { - public MessageContext createIncomingMessageContext(InputStream in, Axi= sEngine engine) throws AxisFault { + public MessageContext createIncomingMessageContext(InputStream in, Eng= ineRegistry reg) throws AxisFault { MessageContext msgContext; try { - msgContext =3D new MessageContext(engine.getRegistry()); + msgContext =3D new MessageContext(reg); InputStreamReader isr =3D new InputStreamReader(in); XMLStreamReader reader =3D XMLInputFactory.newInstance().creat= eXMLStreamReader(isr); StAXBuilder builder =3D new StAXSOAPModelBuilder(OMFactory.new= Instance(), reader); Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/a= pache/axis/clientapi/Call.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/= prototype2/src/java/org/apache/axis/clientapi/Call.java?view=3Ddiff&r1=3D15= 3038&r2=3D153039 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/clientapi/Call.java (original) +++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/clientapi/Call.java Wed Feb 9 00:46:39 2005 @@ -122,7 +122,7 @@ =20 //todo dose the 202 response come throgh the same connection //This is purely HTTP specific. - MessageContext response =3D createIncomingMessageContext(urlCo= nnect.getInputStream(), engine); + MessageContext response =3D createIncomingMessageContext(urlCo= nnect.getInputStream(), registry); response.setServerSide(false); engine.receive(response); =20 @@ -151,7 +151,7 @@ msgctx.setTo(targetEPR); engine.send(msgctx); =20 - MessageContext response =3D createIncomingMessageContext(urlCo= nnect.getInputStream(), engine); + MessageContext response =3D createIncomingMessageContext(urlCo= nnect.getInputStream(), registry); response.setServerSide(false); engine.receive(response); =20 @@ -183,7 +183,7 @@ // only the transport blocked , client dose not hang if(blocked){ //TODO This shoudld be taken from a pool of inovkers. - Invoker invoker =3D new Invoker(msgctx,engine,callback); + Invoker invoker =3D new Invoker(msgctx,engine,registry,cal= lback); Thread th =3D new Thread(invoker); th.start(); } else { Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/a= pache/axis/clientapi/Invoker.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/= prototype2/src/java/org/apache/axis/clientapi/Invoker.java?view=3Ddiff&r1= =3D153038&r2=3D153039 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/clientapi/Invoker.java (original) +++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/clientapi/Invoker.java Wed Feb 9 00:46:39 2005 @@ -13,6 +13,7 @@ =20 import org.apache.axis.context.MessageContext; import org.apache.axis.engine.AxisEngine; +import org.apache.axis.engine.EngineRegistry; =20 import java.io.OutputStream; import java.net.URL; @@ -21,15 +22,17 @@ public class Invoker extends AbstractCall implements Runnable { =20 private AxisEngine engine =3D null; + private EngineRegistry registry =3D null; =20 private MessageContext reqMsgContext =3D null; =20 private Callback callback =3D null; =20 - public Invoker(MessageContext msgContext, AxisEngine engine, Callback = callback) { + public Invoker(MessageContext msgContext, AxisEngine engine,EngineRegi= stry reg, Callback callback) { this.engine =3D engine; this.reqMsgContext =3D msgContext; this.callback =3D callback; + this.registry =3D reg; =20 } =20 @@ -49,7 +52,7 @@ correlator.addCorrelationInfo(reqMsgContext.getMessageID(), ca= llback); =20 MessageContext resMsgContext =3D createIncomingMessageContext( - urlConnect.getInputStream(), engine); + urlConnect.getInputStream(), registry); resMsgContext.setServerSide(false); engine.receive(resMsgContext); =20 Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/a= pache/axis/engine/AxisEngine.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/= prototype2/src/java/org/apache/axis/engine/AxisEngine.java?view=3Ddiff&r1= =3D153038&r2=3D153039 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/engine/AxisEngine.java (original) +++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/engine/AxisEngine.java Wed Feb 9 00:46:39 2005 @@ -138,17 +138,17 @@ handleFault(context, error); } } - /** - * @return Returns the registry. - */ - public EngineRegistry getRegistry() { - return registry; - } - - /** - * @param registry The registry to set. - */ - public void setRegistry(EngineRegistry registry) { - this.registry =3D registry; - } +// /** +// * @return Returns the registry. +// */ +// public EngineRegistry getRegistry() { +// return registry; +// } +// +// /** +// * @param registry The registry to set. +// */ +// public void setRegistry(EngineRegistry registry) { +// this.registry =3D registry; +// } } Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/a= pache/axis/impl/handlers/AbstractHandler.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/= prototype2/src/java/org/apache/axis/impl/handlers/AbstractHandler.java?view= =3Ddiff&r1=3D153038&r2=3D153039 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/handlers/AbstractHandler.java (original) +++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/handlers/AbstractHandler.java Wed Feb 9 00:46:39 2005 @@ -20,15 +20,14 @@ import org.apache.axis.description.Parameter; import org.apache.axis.engine.AxisFault; import org.apache.axis.engine.Handler; -import org.apache.axis.impl.utils.Constants; - import javax.xml.namespace.QName; =20 public abstract class AbstractHandler implements Handler { + private static HandlerMetaData EMPTY_HANDLER_METADATA =3D new HandlerM= etaData(); protected HandlerMetaData handlerDesc; =20 public AbstractHandler(){ - handlerDesc =3D Constants.EMPTY_HANDLER_METADATA; + handlerDesc =3D EMPTY_HANDLER_METADATA; } =20 public QName getName() { Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/a= pache/axis/impl/providers/RawXMLProvider.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/= prototype2/src/java/org/apache/axis/impl/providers/RawXMLProvider.java?view= =3Ddiff&r1=3D153038&r2=3D153039 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/providers/RawXMLProvider.java (original) +++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/providers/RawXMLProvider.java Wed Feb 9 00:46:39 2005 @@ -16,6 +16,10 @@ =20 package org.apache.axis.impl.providers; =20 +import java.lang.reflect.Method; + +import javax.xml.namespace.QName; + import org.apache.axis.context.MessageContext; import org.apache.axis.context.SessionContext; import org.apache.axis.engine.AxisFault; @@ -29,10 +33,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; =20 -import javax.xml.namespace.QName; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - /** * This is a Simple java Provider. */ @@ -121,36 +121,12 @@ msgContext1.setEnvelope(envelope); =20 return msgContext1; - } catch (SecurityException e) { - throw AxisFault.makeFault(e); - } catch (IllegalArgumentException e) { - throw AxisFault.makeFault(e); - } catch (IllegalAccessException e) { - throw AxisFault.makeFault(e); - } catch (InvocationTargetException e) { - throw AxisFault.makeFault(e); } catch (Exception e) { throw AxisFault.makeFault(e); - } + }=20 } =20 public void revoke(MessageContext msgContext) { log.info("I am Speaking Provider revoking :)"); } - - - /** - * @return - */ - public ClassLoader getClassLoader() { - return classLoader; - } - - /** - * @param loader - */ - public void setClassLoader(ClassLoader loader) { - classLoader =3D loader; - } - } Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/a= pache/axis/impl/transport/http/SimpleHTTPReceiver.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/= prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.= java?view=3Ddiff&r1=3D153038&r2=3D153039 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/transport/http/SimpleHTTPReceiver.java (original) +++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/transport/http/SimpleHTTPReceiver.java Wed Feb 9 00:46:39 2005 @@ -16,62 +16,60 @@ =20 package org.apache.axis.impl.transport.http; =20 +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.ServerSocket; + +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; + import org.apache.axis.addressing.AddressingConstants; import org.apache.axis.addressing.EndpointReference; import org.apache.axis.context.MessageContext; -import org.apache.axis.deployment.DeploymentEngine; -import org.apache.axis.deployment.DeploymentException; import org.apache.axis.engine.AxisEngine; import org.apache.axis.engine.AxisFault; import org.apache.axis.engine.EngineRegistry; +import org.apache.axis.engine.EngineRegistryFactory; import org.apache.axis.engine.TransportSenderLocator; import org.apache.axis.impl.llom.builder.StAXBuilder; import org.apache.axis.impl.llom.builder.StAXSOAPModelBuilder; import org.apache.axis.om.OMFactory; import org.apache.axis.om.SOAPEnvelope; -import org.apache.axis.phaseresolver.PhaseException; import org.apache.axis.transport.AbstractTransportReceiver; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; =20 -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.ServerSocket; - - -public class SimpleHTTPReceiver extends AbstractTransportReceiver implemen= ts Runnable { +public class SimpleHTTPReceiver + extends AbstractTransportReceiver + implements Runnable { protected static Log log =3D - LogFactory.getLog(SimpleHTTPReceiver.class.getName()); + LogFactory.getLog(SimpleHTTPReceiver.class.getName()); =20 protected static String transportName =3D "SimpleHTTP"; - =20 - =20 // Standard MIME headers for XML payload protected static byte XML_MIME_STUFF[] =3D - ("\r\nContent-Type: text/xml; charset=3Dutf-8\r\n" + - "Content-Length: ").getBytes(); + ("\r\nContent-Type: text/xml; charset=3Dutf-8\r\n" + "Content-Leng= th: ") + .getBytes(); =20 // Standard MIME headers for HTML payload protected static byte HTML_MIME_STUFF[] =3D - ("\r\nContent-Type: text/html; charset=3Dutf-8\r\n" + - "Content-Length: ").getBytes(); + ("\r\nContent-Type: text/html; charset=3Dutf-8\r\n" + "Content-Len= gth: ") + .getBytes(); =20 // Mime/Content separator protected static byte SEPARATOR[] =3D "\r\n\r\n".getBytes(); =20 // Tiddly little response -// protected static final String responseStr =3D -// "SimpleAxisServer" + -// "

SimpleAxisServer

" + -// Messages.getEnvelope("reachedServer00") + -// ""; -// protected static byte cannedHTMLResponse[] =3D responseStr.getBytes(= ); + // protected static final String responseStr =3D + // "SimpleAxisServer" + + // "

SimpleAxisServer

" + + // Messages.getEnvelope("reachedServer00") + + // ""; + // protected static byte cannedHTMLResponse[] =3D responseStr.getBy= tes(); =20 // ASCII character mapping to lower case protected static final byte[] toLower =3D new byte[256]; @@ -94,11 +92,13 @@ protected static final int lenLen =3D lenHeader.length; =20 // mime header for content type - protected static final byte typeHeader[] =3D (HTTPConstants.HEADER_CON= TENT_TYPE.toLowerCase() + ": ").getBytes(); + protected static final byte typeHeader[] =3D + (HTTPConstants.HEADER_CONTENT_TYPE.toLowerCase() + ": ").getBytes(= ); protected static final int typeLen =3D typeHeader.length; =20 // mime header for content location - protected static final byte locationHeader[] =3D (HTTPConstants.HEADER= _CONTENT_LOCATION.toLowerCase() + ": ").getBytes(); + protected static final byte locationHeader[] =3D + (HTTPConstants.HEADER_CONTENT_LOCATION.toLowerCase() + ": ").getBy= tes(); protected static final int locationLen =3D locationHeader.length; =20 // mime header for soap action @@ -129,38 +129,30 @@ // "Basic" auth string protected static final byte basicAuth[] =3D "basic ".getBytes(); =20 - /** * @param myAxisServer */ public SimpleHTTPReceiver(EngineRegistry reg) { super(reg); } - =20 + public SimpleHTTPReceiver(String dir) throws AxisFault { + EngineRegistry er =3D EngineRegistryFactory.createEngineRegistry(d= ir); try { - DeploymentEngine deploymentEngine =3D new DeploymentEngine(dir= ); - EngineRegistry er =3D deploymentEngine.start(); - try { - Thread.sleep(2000); - } catch (InterruptedException e1) { - throw new AxisFault("Thread interuptted",e1); - } - this.engineReg =3D er; - } catch (PhaseException e) { - throw AxisFault.makeFault(e); - } catch (DeploymentException e) { - throw AxisFault.makeFault(e); - } catch (XMLStreamException e) { - throw AxisFault.makeFault(e); + Thread.sleep(2000); + } catch (InterruptedException e1) { + throw new AxisFault("Thread interuptted", e1); } + this.engineReg =3D er; + } =20 /** * The main workhorse method. */ =20 - protected void invokeMethodFromGet(String methodName, String args) thr= ows Exception { + protected void invokeMethodFromGet(String methodName, String args) + throws Exception { =20 } =20 @@ -177,18 +169,19 @@ * @param cookie2 second cookie header (if doSessions) * @return Content-Length */ - protected int parseHeaders(NonBlockingBufferedInputStream is, - byte buf[], - StringBuffer contentType, - StringBuffer contentLocation, - StringBuffer soapAction, - StringBuffer httpRequest, - StringBuffer fileName, - StringBuffer cookie, - StringBuffer cookie2, - StringBuffer authInfo) -// MimeHeaders headers) - throws java.io.IOException { + protected int parseHeaders( + NonBlockingBufferedInputStream is, + byte buf[], + StringBuffer contentType, + StringBuffer contentLocation, + StringBuffer soapAction, + StringBuffer httpRequest, + StringBuffer fileName, + StringBuffer cookie, + StringBuffer cookie2, + StringBuffer authInfo) + // MimeHeaders headers) + throws java.io.IOException { int n; int len =3D 0; =20 @@ -223,12 +216,14 @@ fileName.append(c); } } else { - throw new java.io.IOException("Cannot handle non-GET, non-POST= request"); + throw new java.io.IOException( + "Cannot handle non-GET, non-POST request"); } =20 while ((n =3D readLine(is, buf, 0, buf.length)) > 0) { =20 - if ((n <=3D 2) && (buf[0] =3D=3D '\n' || buf[0] =3D=3D '\r') &= & (len > 0)) break; + if ((n <=3D 2) && (buf[0] =3D=3D '\n' || buf[0] =3D=3D '\r') &= & (len > 0)) + break; =20 // RobJ gutted the previous logic; it was too hard to extend f= or more headers. // Now, all it does is search forwards for ": " in the buf, @@ -237,7 +232,8 @@ =20 // First, search forwards for ": " int endHeaderIndex =3D 0; - while (endHeaderIndex < n && toLower[buf[endHeaderIndex]] !=3D= headerEnder[0]) { + while (endHeaderIndex < n + && toLower[buf[endHeaderIndex]] !=3D headerEnder[0]) { endHeaderIndex++; } endHeaderIndex +=3D 2; @@ -254,10 +250,10 @@ while ((++i < n) && (buf[i] >=3D '0') && (buf[i] <=3D '9')= ) { len =3D (len * 10) + (buf[i] - '0'); } -// headers.addHeader(HTTPConstants.HEADER_CONTENT_LENGTH, S= tring.valueOf(len)); + // headers.addHeader(HTTPConstants.HEADER_C= ONTENT_LENGTH, String.valueOf(len)); =20 - } else if (endHeaderIndex =3D=3D actionLen - && matches(buf, actionHeader)) { + } else if ( + endHeaderIndex =3D=3D actionLen && matches(buf, actionHead= er)) { =20 soapAction.delete(0, soapAction.length()); // skip initial '"' @@ -265,39 +261,47 @@ while ((++i < n) && (buf[i] !=3D '"')) { soapAction.append((char) (buf[i] & 0x7f)); } -// headers.addHeader(HTTPConstants.HEADER_SOAP_ACTION, "\""= + soapAction.toString() + "\""); + // headers.addHeader(HTTPConstants.HEADER_S= OAP_ACTION, "\"" + soapAction.toString() + "\""); =20 } else if (endHeaderIndex =3D=3D authLen && matches(buf, authH= eader)) { if (matches(buf, endHeaderIndex, basicAuth)) { i +=3D basicAuth.length; while (++i < n && (buf[i] !=3D '\r') && (buf[i] !=3D '= \n')) { - if (buf[i] =3D=3D ' ') continue; + if (buf[i] =3D=3D ' ') + continue; authInfo.append((char) (buf[i] & 0x7f)); } -// headers.addHeader(HTTPConstants.HEADER_AUTHORIZATION= , new String(basicAuth) + authInfo.toString()); + // headers.addHeader(HTTPConstants.= HEADER_AUTHORIZATION, new String(basicAuth) + authInfo.toString()); } else { - throw new java.io.IOException("Bad authentication type= (I can only handle \"Basic\")"); + throw new java.io.IOException( + "Bad authentication type (I can only handle \"Basi= c\")"); } - } else if (endHeaderIndex =3D=3D locationLen && matches(buf, l= ocationHeader)) { + } else if ( + endHeaderIndex =3D=3D locationLen + && matches(buf, locationHeader)) { while (++i < n && (buf[i] !=3D '\r') && (buf[i] !=3D '\n')= ) { - if (buf[i] =3D=3D ' ') continue; + if (buf[i] =3D=3D ' ') + continue; contentLocation.append((char) (buf[i] & 0x7f)); } -// headers.addHeader(HTTPConstants.HEADER_CONTENT_LOCATION,= contentLocation.toString()); + // headers.addHeader(HTTPConstants.HEADER_C= ONTENT_LOCATION, contentLocation.toString()); } else if (endHeaderIndex =3D=3D typeLen && matches(buf, typeH= eader)) { while (++i < n && (buf[i] !=3D '\r') && (buf[i] !=3D '\n')= ) { - if (buf[i] =3D=3D ' ') continue; + if (buf[i] =3D=3D ' ') + continue; contentType.append((char) (buf[i] & 0x7f)); } -// headers.addHeader(HTTPConstants.HEADER_CONTENT_TYPE, con= tentLocation.toString()); + // headers.addHeader(HTTPConstants.HEADER_C= ONTENT_TYPE, contentLocation.toString()); } else { - String customHeaderName =3D new String(buf, 0, endHeaderIn= dex - 2); + String customHeaderName =3D + new String(buf, 0, endHeaderIndex - 2); StringBuffer customHeaderValue =3D new StringBuffer(); while (++i < n && (buf[i] !=3D '\r') && (buf[i] !=3D '\n')= ) { - if (buf[i] =3D=3D ' ') continue; + if (buf[i] =3D=3D ' ') + continue; customHeaderValue.append((char) (buf[i] & 0x7f)); } -// headers.addHeader(customHeaderName, customHeaderValue.to= String()); + // headers.addHeader(customHeaderName, cust= omHeaderValue.toString()); } =20 } @@ -336,7 +340,7 @@ * @param value Integer value to be written. */ protected void putInt(byte buf[], OutputStream out, int value) - throws java.io.IOException { + throws java.io.IOException { int len =3D 0; int offset =3D buf.length; =20 @@ -372,8 +376,12 @@ * @param off starting offset into the byte array * @param len maximum number of bytes to read */ - protected int readLine(NonBlockingBufferedInputStream is, byte[] b, in= t off, int len) - throws java.io.IOException { + protected int readLine( + NonBlockingBufferedInputStream is, + byte[] b, + int off, + int len) + throws java.io.IOException { int count =3D 0, c; =20 while ((c =3D is.read()) !=3D -1) { @@ -381,26 +389,31 @@ b[off++] =3D (byte) c; count++; } - if (count =3D=3D len) break; + if (count =3D=3D len) + break; if ('\n' =3D=3D c) { - int peek =3D is.peek(); //If the next line begins with tab= or space then this is a continuation. - if (peek !=3D ' ' && peek !=3D '\t') break; + int peek =3D is.peek(); + //If the next line begins with tab or space then this is a= continuation. + if (peek !=3D ' ' && peek !=3D '\t') + break; } } return count > 0 ? count : -1; } =20 - protected MessageContext parseTheTransport(AxisEngine engine, - InputStream in) throws Axis= Fault { + protected MessageContext parseTheTransport( + AxisEngine engine, + InputStream in) + throws AxisFault { byte buf[] =3D new byte[BUFSIZ]; // create an Axis server =20 - MessageContext msgContext =3D new MessageContext(engine.getRegistr= y()); + MessageContext msgContext =3D new MessageContext(this.engineReg); msgContext.setServerSide(true); =20 // Reusuable, buffered, content length controlled, InputStream NonBlockingBufferedInputStream is =3D - new NonBlockingBufferedInputStream(); + new NonBlockingBufferedInputStream(); =20 // buffers for the headers we care about StringBuffer soapAction =3D new StringBuffer(); @@ -429,10 +442,18 @@ // read headers is.setInputStream(in); // parse all headers into hashtable - int contentLength =3D parseHeaders(is, buf, contentType, - contentLocation, soapAction, - httpRequest, fileName, - cookie, cookie2, authInfo); + int contentLength =3D + parseHeaders( + is, + buf, + contentType, + contentLocation, + soapAction, + httpRequest, + fileName, + cookie, + cookie2, + authInfo); is.setContentLength(contentLength); =20 int paramIdx =3D fileName.toString().indexOf('?'); @@ -441,7 +462,6 @@ String params =3D fileName.substring(paramIdx + 1); fileName.setLength(paramIdx); =20 - if ("wsdl".equalsIgnoreCase(params)) doWsdl =3D true; =20 @@ -450,9 +470,9 @@ } } =20 - String filePart =3D fileName.toString(); - msgContext.setTo(new EndpointReference(AddressingConstants.WSA= _TO,filePart)); + msgContext.setTo( + new EndpointReference(AddressingConstants.WSA_TO, filePart= )); =20 if (httpRequest.toString().equals("GET")) { throw new UnsupportedOperationException("GET not supported= "); @@ -462,16 +482,19 @@ // for now, do not complain if no SOAPAction at all String soapActionString =3D soapAction.toString(); if (soapActionString !=3D null) { - msgContext.setProperty(MessageContext.SOAP_ACTION, soa= pActionString); + msgContext.setProperty( + MessageContext.SOAP_ACTION, + soapActionString); } =20 - InputStreamReader isr =3D new InputStreamReader(is); - XMLStreamReader reader =3D XMLInputFactory.newInstance().c= reateXMLStreamReader(isr); - StAXBuilder builder =3D new StAXSOAPModelBuilder(OMFactory= .newInstance(), reader); - msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentE= lement()); + XMLStreamReader reader =3D + XMLInputFactory.newInstance().createXMLStreamReader(is= r); + StAXBuilder builder =3D + new StAXSOAPModelBuilder(OMFactory.newInstance(), read= er); + msgContext.setEnvelope( + (SOAPEnvelope) builder.getDocumentElement()); =20 - EngineRegistry reg =3D engine.getRegistry(); return msgContext; } } catch (IOException e) { @@ -481,12 +504,11 @@ } } =20 - /* (non-Javadoc) * @see org.apache.axis.impl.transport.AbstractTransportReceiver#store= OutputInfo(org.apache.axis.context.MessageContext, java.io.OutputStream) */ - protected void storeOutputInfo(MessageContext msgContext, - OutputStream out) throws AxisFault { + protected void storeOutputInfo(MessageContext msgContext, OutputStream= out) + throws AxisFault { try { // Send it on its way... out.write(HTTPConstants.HTTP); @@ -495,34 +517,33 @@ log.info("status written"); //We do not have any Addressing Headers to put //let us put the information about incoming transport - msgContext.setProperty(MessageContext.TRANSPORT_TYPE, - TransportSenderLocator.TRANSPORT_HTTP); + msgContext.setProperty( + MessageContext.TRANSPORT_TYPE, + TransportSenderLocator.TRANSPORT_HTTP); msgContext.setProperty(MessageContext.TRANSPORT_DATA, out); } catch (IOException e) { throw AxisFault.makeFault(e); } } =20 -=20 - =20 - public static void main(String[] args) throws Exception{ - if(args.length !=3D 2){ - System.out.println("SimpeHttpReciver repositoryLocation port"); - } - SimpleHTTPReceiver reciver =3D new SimpleHTTPReceiver(args[0]); - =09 - ServerSocket serverSoc =3D null; - serverSoc =3D new ServerSocket(Integer.parseInt(args[1])); - reciver.setServerSocket(serverSoc); - Thread thread =3D new Thread(reciver); - thread.setDaemon(true); - - try { - thread.start(); - System.in.read(); - } finally { - reciver.stop(); - =09 - } + public static void main(String[] args) throws Exception { + if (args.length !=3D 2) { + System.out.println("SimpeHttpReciver repositoryLocation port"); + } + SimpleHTTPReceiver reciver =3D new SimpleHTTPReceiver(args[0]); + + ServerSocket serverSoc =3D null; + serverSoc =3D new ServerSocket(Integer.parseInt(args[1])); + reciver.setServerSocket(serverSoc); + Thread thread =3D new Thread(reciver); + thread.setDaemon(true); + + try { + thread.start(); + System.in.read(); + } finally { + reciver.stop(); + + } } } Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/a= pache/axis/impl/transport/tcp/TCPTransportReceiver.java URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/= prototype2/src/java/org/apache/axis/impl/transport/tcp/TCPTransportReceiver= .java?view=3Ddiff&r1=3D153038&r2=3D153039 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/transport/tcp/TCPTransportReceiver.java (original) +++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/= axis/impl/transport/tcp/TCPTransportReceiver.java Wed Feb 9 00:46:39 2005 @@ -46,13 +46,12 @@ InputStream in) throws AxisFault { try { - MessageContext msgContext =3D new MessageContext(engine.getReg= istry()); + MessageContext msgContext =3D new MessageContext(this.engineRe= g); InputStreamReader isr =3D new InputStreamReader(in); XMLStreamReader reader =3D XMLInputFactory.newInstance().creat= eXMLStreamReader(isr); StAXBuilder builder =3D new StAXSOAPModelBuilder(OMFactory.new= Instance(), reader); msgContext.setEnvelope((SOAPEnvelope) builder.getDocumentEleme= nt()); =20 - EngineRegistry reg =3D engine.getRegistry(); return msgContext; } catch (XMLStreamException e) { throw AxisFault.makeFault(e);