Hi Devs;

I build the war from the trunk and try to deploy that, everything works
fine. However when I try to list the services it gave me the following
error. I think  this has something to do with the changes that Andreas
did.

javax.servlet.ServletException: http is forbidden
        at
org.apache.axis2.transport.http.AxisServlet.preprocessRequest(AxisServlet.java:628)
        at
org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:246)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
     

As I can see this is a big issues (unless I have something done wrong).

I just went though the source code and found few issues with that, so we
need to fix those;  Following code in AxisServlet is not correct.


            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.");
            }


Why do we need to call the following method for each request ?

private void preprocessRequest(HttpServletRequest req) throws
ServletException {
        initContextRoot(req);

        TransportInDescription transportInDescription =
                req.isSecure()?
this.axisConfiguration.getTransportIn(Constants.TRANSPORT_HTTP) :
                       
this.axisConfiguration.getTransportIn(Constants.TRANSPORT_HTTPS);

        if (transportInDescription == null){
            throw new ServletException(req.getScheme() + " is forbidden");
        } else {
            if (transportInDescription.getReceiver() instanceof
AxisServletListener){
                AxisServletListener listner = (AxisServletListener)
transportInDescription.getReceiver();
                // Autodetect the port number if necessary
                if (listner.getPort() == -1){
                    listner.setPort(req.getServerPort());
                }
            }
        }
       
    }


As I can see something is really broken, please fix it (or else I might
have to revert to the original AxisServlet code).

Thanks,
Deepal

Reply via email to