tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
Date Tue, 22 Jul 2003 21:04:47 GMT
luehe       2003/07/22 14:04:47

  Modified:    jasper2/src/share/org/apache/jasper JspC.java Options.java
                        EmbeddedServletOptions.java
               jasper2/src/share/org/apache/jasper/compiler Generator.java
               jasper2/src/share/org/apache/jasper/servlet JspServlet.java
               jasper2/src/share/org/apache/jasper/resources
                        messages.properties
  Log:
  Moved X-Powered-By property for servlets from Host/Context to
  CoyoteConnector.  If property is set to TRUE, CoyoteAdapter adds
  X-Powered-By response header with value "Servlet/2,4".
  
  Turned X-Powered-By property for JSPs into a configurable Jasper compilation
  option. If set to TRUE, the generated servlet will add X-Powered-By
  response header with value "JSP/2.0".
  
  Revision  Changes    Path
  1.49      +11 -3     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java
  
  Index: JspC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- JspC.java	6 Jul 2003 22:56:54 -0000	1.48
  +++ JspC.java	22 Jul 2003 21:04:44 -0000	1.49
  @@ -143,6 +143,7 @@
       private static final String SWITCH_WEBAPP_INC = "-webinc";
       private static final String SWITCH_WEBAPP_XML = "-webxml";
       private static final String SWITCH_MAPPED = "-mapped";
  +    private static final String SWITCH_XPOWERED_BY = "-xpoweredBy";
       private static final String SWITCH_DIE = "-die";
       private static final String SHOW_SUCCESS ="-s";
       private static final String LIST_ERRORS = "-l";
  @@ -163,6 +164,7 @@
       private String classPath = null;
       private URLClassLoader loader = null;
       private boolean largeFile = false;
  +    private boolean xpoweredBy;
       private boolean mappedFile = false;
       private File scratchDir;
       private String ieClassId = DEFAULT_IE_CLASS_ID;
  @@ -280,6 +282,8 @@
                   }
               } else if (tok.equals(SWITCH_MAPPED)) {
                   mappedFile = true;
  +            } else if (tok.equals(SWITCH_XPOWERED_BY)) {
  +                xpoweredBy = true;
               } else if (tok.startsWith(SWITCH_DIE)) {
                   try {
                       dieLevel = Integer.parseInt(
  @@ -322,6 +326,10 @@
   
       public boolean isPoolingEnabled() {
           return true;
  +    }
  +
  +    public boolean isXpoweredBy() {
  +        return xpoweredBy;
       }
   
       public int getTagPoolSize() {
  
  
  
  1.15      +8 -3      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java
  
  Index: Options.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Options.java	26 Apr 2003 01:15:24 -0000	1.14
  +++ Options.java	22 Jul 2003 21:04:45 -0000	1.15
  @@ -191,6 +191,11 @@
       public JspConfig getJspConfig();
   
       /**
  +     * Is generation of X-Powered-By response header enabled/disabled?
  +     */
  +    public boolean isXpoweredBy();
  +
  +    /**
        * Obtain a Tag Plugin Manager
        */
       public TagPluginManager getTagPluginManager();
  
  
  
  1.4       +31 -3     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbeddedServletOptions.java
  
  Index: EmbeddedServletOptions.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbeddedServletOptions.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EmbeddedServletOptions.java	26 Apr 2003 01:15:24 -0000	1.3
  +++ EmbeddedServletOptions.java	22 Jul 2003 21:04:45 -0000	1.4
  @@ -205,6 +205,11 @@
        */
       private String javaEncoding = "UTF8";
   
  +    /*
  +     * Is generation of X-Powered-By response header enabled/disabled?
  +     */
  +    private boolean xpoweredBy;
  +
       public String getProperty(String name ) {
           return settings.getProperty( name );
       }
  @@ -319,6 +324,13 @@
       }
   
       /**
  +     * Is generation of X-Powered-By response header enabled/disabled?
  +     */
  +    public boolean isXpoweredBy() {
  +        return xpoweredBy;
  +    }
  +
  +    /**
        * Compiler to use.
        */
       public String getCompiler() {
  @@ -589,6 +601,22 @@
               } else {
   		if (log.isWarnEnabled()) {
   		    log.warn(Localizer.getMessage("jsp.warning.fork"));
  +		}
  +	    }
  +        }
  +
  +        /*
  +         * X-Powered-By
  +         */
  +        String xpoweredBy = config.getInitParameter("xpoweredBy"); 
  +        if (xpoweredBy != null) {
  +            if (xpoweredBy.equalsIgnoreCase("true")) {
  +                this.xpoweredBy = true;
  +            } else if (xpoweredBy.equalsIgnoreCase("false")) {
  +                this.xpoweredBy = false;
  +            } else {
  +		if (log.isWarnEnabled()) {
  +		    log.warn(Localizer.getMessage("jsp.warning.xpoweredBy"));
   		}
   	    }
           }
  
  
  
  1.192     +7 -3      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java
  
  Index: Generator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v
  retrieving revision 1.191
  retrieving revision 1.192
  diff -u -r1.191 -r1.192
  --- Generator.java	21 Jul 2003 21:52:51 -0000	1.191
  +++ Generator.java	22 Jul 2003 21:04:46 -0000	1.192
  @@ -571,6 +571,10 @@
   	out.print  (quote(pageInfo.getContentType()));
   	out.println(");");
   
  +        if (ctxt.getOptions().isXpoweredBy()) {
  +            out.printil("response.addHeader(\"X-Powered-By\", \"JSP/2.0\");");
  +	}
  +
   	out.printil("pageContext = _jspxFactory.getPageContext(this, request, response,");
   	out.printin("\t\t\t");
   	out.print  (quote(pageInfo.getErrorPage()));
  
  
  
  1.28      +3 -11     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java
  
  Index: JspServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- JspServlet.java	21 Jul 2003 19:06:35 -0000	1.27
  +++ JspServlet.java	22 Jul 2003 21:04:46 -0000	1.28
  @@ -238,14 +238,6 @@
                   }
   	    }
   
  -	    /*
  -	     * Add X-Powered-By header for JSP, if Catalina already added a
  -	     * corresponding header for servlets
  -	     */
  -	    if (response.containsHeader("X-Powered-By")) {
  -		response.addHeader("X-Powered-By", "JSP/2.0");
  -	    }
  -
               serviceJspFile(request, response, jspUri, null, precompile);
   	} catch (RuntimeException e) {
   	    throw e;
  
  
  
  1.126     +3 -1      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties
  
  Index: messages.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v
  retrieving revision 1.125
  retrieving revision 1.126
  diff -u -r1.125 -r1.126
  --- messages.properties	22 Jul 2003 00:46:36 -0000	1.125
  +++ messages.properties	22 Jul 2003 21:04:46 -0000	1.126
  @@ -140,6 +140,7 @@
   jsp.error.setproperty.arrayVal=setProperty: can't set array property {0} through a string
constant value
   jsp.warning.keepgen=Warning: Invalid value for the initParam keepgenerated. Will use the
default value of \"false\"
   jsp.warning.largeFile=Warning: Invalid value for the initParam largeFile. Will use the
default value of \"true\"
  +jsp.warning.xpoweredBy=Warning: Invalid value for the initParam xpoweredBy. Will use the
default value of \"false\"
   jsp.warning.enablePooling=Warning: Invalid value for the initParam enablePooling. Will
use the default value of \"true\"
   jsp.warning.invalidTagPoolSize=Warning: Invalid value for the init parameter named tagPoolSize.
Will use default size of {0}
   jsp.warning.mappedFile=Warning: Invalid value for the initParam mappedFile. Will use the
default value of \"false\"
  @@ -224,6 +225,7 @@
   \    -webinc <file>     Creates a partial servlet mappings in the file\n\
   \    -webxml <file>     Creates a complete web.xml in the file\n\
   \    -ieplugin <clsid>  Java Plugin classid for Internet Explorer\n\
  +\    -xpoweredBy        Add X-Powered-By response header\n\
   
   jspc.webxml.header=<?xml version="1.0" encoding="ISO-8859-1"?>\n\
   \n\
  
  
  

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


Mime
View raw message