Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 9285 invoked from network); 24 Aug 2009 08:34:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Aug 2009 08:34:07 -0000 Received: (qmail 54612 invoked by uid 500); 24 Aug 2009 08:34:25 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 54517 invoked by uid 500); 24 Aug 2009 08:34:25 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 54508 invoked by uid 99); 24 Aug 2009 08:34:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2009 08:34:25 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of amilasuriarachchi@gmail.com designates 74.125.92.150 as permitted sender) Received: from [74.125.92.150] (HELO qw-out-1920.google.com) (74.125.92.150) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Aug 2009 08:34:17 +0000 Received: by qw-out-1920.google.com with SMTP id 4so2278695qwk.28 for ; Mon, 24 Aug 2009 01:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=BgRTlC6qL0QU3tJ26cSID0SbGiltAmt0nGoiALW9GWI=; b=t1d6O5DONib1MTeYAEQEQ+8P97ypY5JiilV93Bz/XNwyvfup+XsLQU798acT/zO1Kv LCvwuZQVSUNOowq80vuWKhipj+45a2TqLzVbcLh2RBhCUVBlHSCXrs96xlHUR5aKAHo2 vuiBtKsa9pq/m1ZgwFYgth9n31RfKBrgY7Ppw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=mzpdazv8G5H4AFu1AaCCvfjEmztD9pcDmld0rXqM1GJl1Ob2vNTnx/OhHimG3y7r// yD5FNyOrea10UnE7FgeldVkwiKT82/8gUTtvJW5PsAc16nImXCp0wW1LGx80woH1V75P cLd27q9Vk0fbU8thJ9BTFgXFfX9Dt4HBP+DOA= MIME-Version: 1.0 Received: by 10.229.119.152 with SMTP id z24mr816001qcq.97.1251102836121; Mon, 24 Aug 2009 01:33:56 -0700 (PDT) In-Reply-To: References: <9b85c45f0908200433w73bbe4c9h703726b06e8e14af@mail.gmail.com> <9b85c45f0908200445p42bd7720ja4f4d0613d853804@mail.gmail.com> <558af1840908200544u1dd2052bs68a76e371165f31b@mail.gmail.com> <60708f4b0908210253ue45915bg4538100fad1fd997@mail.gmail.com> <4A8F6BA2.4060808@gmail.com> <60708f4b0908232356m5184694cr7172756983a4bddf@mail.gmail.com> Date: Mon, 24 Aug 2009 14:03:55 +0530 Message-ID: <60708f4b0908240133y5b90f847x839804f44602c08c@mail.gmail.com> Subject: Re: Please revert API changes done as per AXIS2-4465 From: Amila Suriarachchi To: axis-dev@ws.apache.org Content-Type: multipart/alternative; boundary=000e0cd5cc521fe15b0471df147b X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd5cc521fe15b0471df147b Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Mon, Aug 24, 2009 at 12:44 PM, Andreas Veithen wrote: > Amila, > > If you use your own TransportListener implementations, how do you > implement getEPRsForService such that it returns URIs with the correct > port numbers? See here[1]. I think this is not relevant here. What I try to say is any one can implement a Transport listener in the way they need. We need to provide the support for that. And also I think this code is not necessary as well. httpListener = getAxisServletListener(Constants.TRANSPORT_HTTP); httpsListener = getAxisServletListener(Constants.TRANSPORT_HTTPS); if (httpListener == null && httpsListener == null) { log.warn("No transportReceiver for " + AxisServletListener.class.getName() + " found. An instance for HTTP will be configured automatically. " + "Please update your axis2.xml file!"); httpListener = new AxisServletListener(); TransportInDescription transportInDescription = new TransportInDescription( Constants.TRANSPORT_HTTP); transportInDescription.setReceiver(httpListener); axisConfiguration.addTransportIn(transportInDescription); } else if (httpListener != null && httpsListener != null && httpListener.getPort() == -1 && httpsListener.getPort() == -1) { log.warn("If more than one transportReceiver for " + AxisServletListener.class.getName() + " exists, then all instances " + "must be configured with a port number. WSDL generation will be " + "unreliable."); } if we go ahead with this approach we need to have two axis2.xml. 1. shift with standalone distribution which has the SimpleHttp trnasport listener 2. shift with web distribution with new Axis2Servlet listeners. At run time, if the axis2.xml (which is inside the war file) does not contain AxisServletListner, this means they have done their own listener extending the transprotListner. So let them handle it in that way. We don't need to initialize new things. thanks, Amila. [1] https://wso2.org/repos/wso2/trunk/carbon/org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/transports/http/HttpTransportListener.java > > > Andreas > > On Mon, Aug 24, 2009 at 08:56, Amila > Suriarachchi wrote: > > hi, > > > > I had time to go through your comment and I think what you suggest is the > > correct way to address the problem. > > So +1 for that. > > > > Then I looked into the our code and found that we have also done the same > > technique with separate two > > Transport listeners :). > > > > Because we have our own two transport listeners this code gives us > problems, > > > > // This method should not be part of the public API. In particular we > must > > not allow subclasses > > // to override this method because we don't make any guarantees as to > > when exactly this method > > // is called. > > private void preprocessRequest(HttpServletRequest req) throws > > ServletException { > > initContextRoot(req); > > > > AxisServletListener listener = req.isSecure() ? httpsListener : > > httpListener; > > if (listener == null) { > > throw new ServletException(req.getScheme() + " is > forbidden"); > > } else { > > // Autodetect the port number if necessary > > if (listener.getPort() == -1) { > > listener.setPort(req.getServerPort()); > > } > > } > > } > > > > Here you assume anyone use Axis2 as a library has used AxisServletListner > > and kept it as a private variable in Axis2Servlet. > > > > Instead of I would like to implement this method like this, > > > > > > // This method should not be part of the public API. In particular we > must > > not allow subclasses > > // to override this method because we don't make any guarantees as to > > when exactly this method > > // is called. > > private void preprocessRequest(HttpServletRequest req) throws > > ServletException { > > initContextRoot(req); > > > > TransportInDescription transportInDescription = > > req.isSecure() ? > > this.axisConfiguration.getTransportIn(Constants.TRANSPORT_HTTPS) : > > > > this.axisConfiguration.getTransportIn(Constants.TRANSPORT_HTTP); > > if (transportInDescription == null) { > > throw new ServletException(req.getScheme() + " is > forbidden"); > > } else { > > if (transportInDescription.getReceiver() instanceof > > AxisServletListener) { > > AxisServletListener listener = (AxisServletListener) > > transportInDescription.getReceiver(); > > if (listener.getPort() == -1) { > > listener.setPort(req.getServerPort()); > > } > > } > > } > > } > > > > In this way we do not keep the Axis2Specific listener and take it from > the > > axis configuration and check for port only if it is an Axis2Servlet > > listener. > > > > WDYT? > > > > thanks, > > Amila. > > > > > > > > On Sat, Aug 22, 2009 at 12:45 PM, Srinath Perera > wrote: > >> > >> > I am not sure whether clearly understand the difference between how > >> > AxisServelet works and how SimpleHTTPServer works. In the case of > >> > AxisServlet, we first start AxisServlet and then we start Axis2, so > when > >> > we start Axis2 we already have HTTP listener running (and hence > >> > TransportInDec). So once the system start we just create a > >> > TransportInDec using servlet and set that as the HTTP TransportDec > (and > >> > of course we replace what is in axis2.xml for HTTP with this > >> > transportInDec, and we must do that). Whereas in SimpleHTTPServer, we > >> > first start Axis2 and then we use transport in axis2.xml to configure > >> > the system, so we use the tarnporInDec to configure the > >> > SimpleHTTPServer. > >> > >> Yep, this is right. One reason it is there is that to allow both > >> simple HTTP server and servlet share the same axis2.xml which is not > >> required, rather a convenience. In a servlet case transport receiver > >> is not initialized at all (I do not think it has changed). > >> > >> Thanks > >> Srinath > >> > >> -- > >> ============================ > >> Srinath Perera, Ph.D. > >> WSO2 Inc. http://wso2.com > >> Blog: http://srinathsview.blogspot.com/ > > > > > > > > -- > > Amila Suriarachchi > > WSO2 Inc. > > blog: http://amilachinthaka.blogspot.com/ > > > -- Amila Suriarachchi WSO2 Inc. blog: http://amilachinthaka.blogspot.com/ --000e0cd5cc521fe15b0471df147b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Mon, Aug 24, 2009 at 12:44 PM, Andrea= s Veithen <andreas.veithen@gmail.com> wrote:
Amila,

If you use your own TransportListener implementations, how do you
implement getEPRsForService such that it returns URIs with the correct
port numbers?

See here[1]. I think this is not relevan= t here. What I try to say is any one can implement a Transport listener in = the way they need. We need to provide the support for that.

And also= I think this code is not necessary as well.

httpListener =3D getAxisServletListener(Constants.TRANSPORT_HTTP);
= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 httpsListener =3D getAxisServletListener(= Constants.TRANSPORT_HTTPS);
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0
=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 if (httpListener =3D=3D null && httpsLi= stener =3D=3D null) {
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 log.warn("No transportRe= ceiver for " + AxisServletListener.class.getName() +
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 " found. An = instance for HTTP will be configured automatically. " +
=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "Please u= pdate your axis2.xml file!");
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 httpListener =3D new AxisServ= letListener();
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 TransportIn= Description transportInDescription =3D new TransportInDescription(
=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Constant= s.TRANSPORT_HTTP);
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 transpo= rtInDescription.setReceiver(httpListener);
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 axisConfiguration.addTranspor= tIn(transportInDescription);

=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 } els= e if (httpListener !=3D null && httpsListener !=3D null
=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 && httpListener= .getPort() =3D=3D -1 && httpsListener.getPort() =3D=3D -1) {
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 log.warn("If more than o= ne transportReceiver for " +
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 AxisServletListener.class.getName() + &qu= ot; exists, then all instances " +
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "must be configured with a por= t number. WSDL generation will be " +
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "= ;unreliable.");
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }

if we go= ahead with this approach we need to have two axis2.xml.
1. shift with s= tandalone distribution which has the SimpleHttp trnasport listener
2. shift with web distribution with new Axis2Servlet listeners.

At = run time, if the axis2.xml (which is inside the war file)=A0 does not conta= in AxisServletListner, this means they have done their own listener extendi= ng the transprotListner. So let them handle it in that way. We don't ne= ed to initialize new things.

thanks,
Amila.

[1] https://wso2.org/repos/wso2/trunk/carbon= /org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/transports/http/Ht= tpTransportListener.java


Andreas

On Mon, Aug 24, 2009 at 08:56, Amila
Suriarachchi<amilasuriara= chchi@gmail.com> wrote:
> hi,
>
> I had time to go through your comment and I think what you suggest is = the
> correct way to address the problem.
> So +1 for that.
>
> Then I looked into the our code and found that we have also done the s= ame
> technique with separate two
> Transport listeners :).
>
> Because we have our own two transport listeners this code gives us pro= blems,
>
> // This method should not be part of the public API. In particular we = must
> not allow subclasses
> =A0=A0=A0 // to override this method because we don't make any gua= rantees as to
> when exactly this method
> =A0=A0=A0 // is called.
> =A0=A0=A0 private void preprocessRequest(HttpServletRequest req) throw= s
> ServletException {
> =A0=A0=A0=A0=A0=A0=A0 initContextRoot(req);
>
> =A0=A0=A0=A0=A0=A0=A0 AxisServletListener listener =3D req.isSecure() = ? httpsListener :
> httpListener;
> =A0=A0=A0=A0=A0=A0=A0 if (listener =3D=3D null) {
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 throw new ServletException(req.getSc= heme() + " is forbidden");
> =A0=A0=A0=A0=A0=A0=A0 } else {
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // Autodetect the port number if nec= essary
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (listener.getPort() =3D=3D -1) {<= br> > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 listener.setPort(req.get= ServerPort());
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
> =A0=A0=A0=A0=A0=A0=A0 }
> =A0=A0=A0 }
>
> Here you assume anyone use Axis2 as a library has used AxisServletList= ner
> and kept it as a private variable in Axis2Servlet.
>
> Instead of I would like to implement this method like this,
>
>
> // This method should not be part of the public API. In particular we = must
> not allow subclasses
> =A0=A0=A0 // to override this method because we don't make any gua= rantees as to
> when exactly this method
> =A0=A0=A0 // is called.
> =A0=A0=A0 private void preprocessRequest(HttpServletRequest req) throw= s
> ServletException {
> =A0=A0=A0=A0=A0=A0=A0 initContextRoot(req);
>
> =A0=A0=A0=A0=A0=A0=A0 TransportInDescription transportInDescription = =3D
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 req.isSecure() ?
> this.axisConfiguration.getTransportIn(Constants.TRANSPORT_HTTPS) :
>
> this.axisConfiguration.getTransportIn(Constants.TRANSPORT_HTTP);
> =A0=A0=A0=A0=A0=A0=A0 if (transportInDescription =3D=3D null) {
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 throw new ServletException(req.getSc= heme() + " is forbidden");
> =A0=A0=A0=A0=A0=A0=A0 } else {
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (transportInDescription.getReceiv= er() instanceof
> AxisServletListener) {
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 AxisServletListener list= ener =3D (AxisServletListener)
> transportInDescription.getReceiver();
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (listener.getPort() = =3D=3D -1) {
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 listener.set= Port(req.getServerPort());
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
> =A0=A0=A0=A0=A0=A0=A0 }
> =A0=A0=A0 }
>
> In this way we do not keep the Axis2Specific listener and take it from= the
> axis configuration and check for port only if it is an Axis2Servlet > listener.
>
> WDYT?
>
> thanks,
> Amila.
>
>
>
> On Sat, Aug 22, 2009 at 12:45 PM, Srinath Perera <hemapani@gmail.com> wrote:
>>
>> > I am not sure whether clearly understand the difference betwe= en how
>> > AxisServelet works and how SimpleHTTPServer works. In the cas= e of
>> > AxisServlet, we first start AxisServlet and then we start Axi= s2, so when
>> > we start Axis2 we already have HTTP listener running (and hen= ce
>> > TransportInDec). So once the system start we just create a >> > TransportInDec using servlet and set that as the HTTP Transpo= rtDec (and
>> > of course we replace what is in axis2.xml for HTTP with this<= br> >> > transportInDec, and we must do that). Whereas in SimpleHTTPSe= rver, we
>> > first start Axis2 and then we use transport in axis2.xml to c= onfigure
>> > the system, so we use the tarnporInDec to configure the
>> > SimpleHTTPServer.
>>
>> Yep, this is right. One reason it is there is that to allow both >> simple HTTP server and servlet share the same axis2.xml which is n= ot
>> required, rather a convenience. In a servlet case transport receiv= er
>> is not initialized at all (I do not think it has changed).
>>
>> Thanks
>> Srinath
>>
>> --
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D
>> Srinath Perera, Ph.D.
>> =A0 WSO2 Inc. http:/= /wso2.com
>> =A0 Blog: http://srinathsview.blogspot.com/
>
>
>
> --
> Amila Suriarachchi
> WSO2 Inc.
> blog: http://amilachinthaka.blogspot.com/
>



--
Amila Suria= rachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/
--000e0cd5cc521fe15b0471df147b--