axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/transport/http AxisServlet.java
Date Wed, 20 Nov 2002 20:10:45 GMT
stevel      2002/11/20 12:10:45

  Modified:    java/src/org/apache/axis/transport/http AxisServlet.java
  Log:
  adding helper message for GET on JWS, not by working out whether there is a jws file there
(which could be done, I suppose), but by pointing the user at the WSDL file. Also implemented
the WS-I basic profile recommendation for what to send on a bad request.
  
  Note that all responses have been pretty much teased out into their own methods. We still
have a 'monolithic servlet' architecture, but the monolith is now structured. In a webapp
intended to be hosted by real appservers only all the responses would next be moved into JSP
pages and redirected to in the servlet.
  
  Revision  Changes    Path
  1.151     +45 -10    xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
  
  Index: AxisServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
  retrieving revision 1.150
  retrieving revision 1.151
  diff -u -r1.150 -r1.151
  --- AxisServlet.java	31 Oct 2002 23:40:46 -0000	1.150
  +++ AxisServlet.java	20 Nov 2002 20:10:44 -0000	1.151
  @@ -309,14 +309,13 @@
   
                           SOAPService s = engine.getService(serviceName);
                           if (s == null) {
  -                            // no such service....
  -                            response.setStatus(java.net.HttpURLConnection.HTTP_NOT_FOUND);
  -                            response.setContentType("text/html");
  -                            writer.println("<h2>" +
  -                                           Messages.getMessage("error00") + "</h2>");
  -                            writer.println("<p>" +
  -                                           Messages.getMessage("noService06") +
  -                                           "</p>");
  +                            //no service: report it
  +                            if(isJWSPage) {
  +                                reportCantGetJWSService(request, response, writer);
  +                            } else {
  +                                reportCantGetAxisService(request, response, writer);
  +                            }
  +
                           } else {
                               //print a snippet of service info.
                               reportServiceInfo(response, writer, s, serviceName);
  @@ -376,7 +375,8 @@
   
       /**
        * scan through the request for parameters, invoking the endpoint
  -     * if we get a method param.
  +     * if we get a method param. If there was no method param then the
  +     * response is set to a 400 Bad Request and some error text
        * @param msgContext current message
        * @param request incoming requests
        * @param response response to generate
  @@ -403,7 +403,7 @@
   
           if (method == null) {
               response.setContentType("text/html");
  -            //TODO: what error code should we send back for no method?
  +            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
               writer.println("<h2>" +
                              Messages.getMessage("error00") +
                              ":  " +
  @@ -635,6 +635,41 @@
           }
           writer.println("</ul>");
       }
  +
  +    /**
  +     * generate the error response to indicate that there is apparently no endpoint there
  +     * @param request the request that didnt have an edpoint
  +     * @param response response we are generating
  +     * @param writer open writer for the request
  +     */
  +    protected void reportCantGetAxisService(HttpServletRequest request, HttpServletResponse
response, PrintWriter writer) {
  +        // no such service....
  +        response.setStatus(HttpURLConnection.HTTP_NOT_FOUND);
  +        response.setContentType("text/html");
  +        writer.println("<h2>" +
  +                Messages.getMessage("error00") + "</h2>");
  +        writer.println("<p>" +
  +                Messages.getMessage("noService06") +
  +                "</p>");
  +    }
  +
  +    /**
  +     * indicate that there may be a JWS page, and that the user should look
  +     * at the WSDL to se
  +     * @param request the request that didnt have an edpoint
  +     * @param response response we are generating
  +     * @param writer open writer for the request
  +     */
  +    protected void reportCantGetJWSService(HttpServletRequest request, HttpServletResponse
response, PrintWriter writer) {
  +        // no such service....
  +        response.setStatus(HttpURLConnection.HTTP_OK);
  +        response.setContentType("text/html");
  +        String urltext= Messages.getMessage("noService08");
  +        String url=request.getRequestURI();
  +        writer.println(Messages.getMessage("noService07") + "<p>");
  +        writer.println("<a href='"+url+"?wsdl'>"+urltext+"</a>");
  +    }
  +
   
       /**
        * Process a POST to the servlet by handing it off to the Axis Engine.
  
  
  

Mime
View raw message