You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by dg...@apache.org on 2003/11/16 00:43:01 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/action RequestProcessor.java

dgraham     2003/11/15 15:43:01

  Modified:    src/share/org/apache/struts/action RequestProcessor.java
  Log:
  Send HTTP 404 Not Found instead of 400 Bad Request when a request
  for an unmapped url is made.  PR# 24727
  
  Revision  Changes    Path
  1.39      +17 -16    jakarta-struts/src/share/org/apache/struts/action/RequestProcessor.java
  
  Index: RequestProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/RequestProcessor.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- RequestProcessor.java	10 Oct 2003 22:03:33 -0000	1.38
  +++ RequestProcessor.java	15 Nov 2003 23:43:01 -0000	1.39
  @@ -678,12 +678,11 @@
           }
   
           // No mapping can be found to process this request
  -        log.error(getInternal().getMessage("processInvalid", path));
  -        response.sendError(HttpServletResponse.SC_BAD_REQUEST,
  -                           getInternal().getMessage
  -                           ("processInvalid", path));
  -        return (null);
  -
  +        String msg = getInternal().getMessage("processInvalid", path);
  +        log.error(msg);
  +        response.sendError(HttpServletResponse.SC_NOT_FOUND, msg);
  +        
  +        return null;
       }
   
   
  @@ -764,13 +763,15 @@
           }
           String prefix = moduleConfig.getPrefix();
           if (!path.startsWith(prefix)) {
  -            log.error(getInternal().getMessage("processPath",
  -                                         request.getRequestURI()));
  -            response.sendError(HttpServletResponse.SC_BAD_REQUEST,
  -                               getInternal().getMessage
  -                               ("processPath", request.getRequestURI()));
  -            return (null);
  +            String msg =
  +                getInternal().getMessage("processPath", request.getRequestURI());
  +            
  +            log.error(msg);
  +            response.sendError(HttpServletResponse.SC_BAD_REQUEST, msg);
  +
  +            return null;
           }
  +        
           path = path.substring(prefix.length());
           int slash = path.lastIndexOf("/");
           int period = path.lastIndexOf(".");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org