Re: force precompilation of JSPs

2003-08-14 Thread Stephan Wiesner
This reminds me of a script I have written. It deletes the work 
directory for a given context and precompiles the JSPs. No need to fight 
with JSPC :-)

I have attached it, simple but effective.
Stephan


Amit Kirdatt wrote:

Different servlet containers have different ways of doing it, but the
following method is part of the spec:
http://your-server-name/MyPage.jsp?jsp_precompile

-Original Message-
From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 10:53 AM
To: 'Struts Users Mailing List'
Subject: RE: force precompilation of JSPs
Yes.

:-)

-Original Message-
From: Ionel Gardais [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 2:48 AM
To: Struts Users Mailing List
Subject: force precompilation of JSPs
Hi,

I am experiencing a slow down when I access a JSP page for the first 
time after I deploy e web app.
Is there a way to force precompilation of these files as soon as the web 
app is deployed ?

Thanks,
ionel
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified that
any dissemination, distribution or copying of this e-mail is prohibited. If
you have received this e-mail in error, please notify the sender by replying
to this message and delete this e-mail immediately.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

package tools;

import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
import java.util.Properties;

/**
   Deletes the work directory of the Tomcat for a given context and
   precompiles all provided JSPs. Note that the JSPs have to be provided
   in the (hardcoded) configuration file. br /
   bSuggested usage:/b
   pre
  try 
  {
 Precompiler pc = new Precompiler();
 File f = new File(pc.getProperty(workDir));
 pc.delete(f);
 pc.precompile();
 } catch(Exception ex) { System.err.println(Error: + ex);}   
   /pre
   
   Configuration file:
   pre
   server=http://127.0.0.1:8080/shop8/
   workDir=c:/tomcat/work/Standalone/localhost/shop8
  
   u1=index.jsp   
   u2=view/Kunde.jsp   
   /pre
   @version 1.0
   @author [EMAIL PROTECTED]
*/
public class Precompiler
{
   Properties props = new Properties();
   java.util.logging.Logger logger = LoggerInitiator.getLogger();
   
   public Precompiler() throws IOException
   {
  logger.info(Precompiler());
  DataInputStream in = new DataInputStream( new BufferedInputStream( 
 new FileInputStream(resources/urls.properties)));
  props.load(in); 
   }
   
   
   public String getProperty(String value)
   {  return props.getProperty(value);   }
   
   
   /**
  recursively deletes all files (NOT! the directories) in the given
  directory.
   */
   public void delete(File dir) throws IOException
   {
  logger.info(Precompiler.delete());  
  File[] files = dir.listFiles();
  logger.info(have  + files.length +  files);
  for(int i = 0; i  files.length; i++)
  {
 if (files[i].isDirectory())
 {
delete(files[i]);
 }
 else
 {
logger.info(Deleting: + files[i].getAbsolutePath() + = 
+ files[i].delete());
 }
  }
   }
   
   
   
   /**
  Precompiles the provided JSPs. Call delete first, if you want ALL
  JSPs to be recompiled.
   */
   public void precompile() throws Exception
   {
  logger.info(Precompiler.precompile());
  String server = props.getProperty(server);
  for(int i = 1; i  props.size() - 1; i++)
  {
 String jsp = server + props.getProperty(u + i) + ?jsp_precompile;
 System.out.println(Loading: + jsp);
 URL url = new URL(jsp);
 url.openConnection().getInputStream();
  }
   }

   
   public static void main(String args[])
   {
  try 
  {
 Precompiler pc = new Precompiler();
 File f = new File(pc.getProperty(workDir));
 pc.delete(f);
 pc.precompile();
 } catch(Exception ex) { System.err.println(Error: + ex);}
  
   }
}
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

RE: force precompilation of JSPs

2003-08-10 Thread Kamholz, Keith (corp-staff) USX
Yes.

:-)


-Original Message-
From: Ionel Gardais [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 2:48 AM
To: Struts Users Mailing List
Subject: force precompilation of JSPs


Hi,

I am experiencing a slow down when I access a JSP page for the first 
time after I deploy e web app.
Is there a way to force precompilation of these files as soon as the web 
app is deployed ?

Thanks,
ionel


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: force precompilation of JSPs

2003-08-06 Thread Alen Ribic
If you are using Tomcat.
%TOMCAT_HOME%/bin/jspc can do this.
read your Tomcat documentation for instructions.

For other look at vendor specific documentation for clues.

--Alen


- Original Message - 
From: Ionel Gardais [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 8:48 AM
Subject: force precompilation of JSPs


 Hi,
 
 I am experiencing a slow down when I access a JSP page for the first 
 time after I deploy e web app.
 Is there a way to force precompilation of these files as soon as the web 
 app is deployed ?
 
 Thanks,
 ionel
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: force precompilation of JSPs

2003-08-05 Thread thirumalai . veeraswamy
I am using iPlanet where I use the following ant target to rebuild the
jsps

target name=compile.jsps depends=init,splash
description=Compile the jsp file for faster access
  jspc
 destdir=${webserver.cache.folder}
 srcdir=${build.home}
 compiler=jasper41
 webapp basedir=${build.home}/
 classpath refid=jspc.classpath/
  include name=**/*.jsp/
  /jspc
  javac
 srcdir=${webserver.cache.folder}
 destdir=${webserver.cache.folder}
 debug=${compile.debug}
 optimize=${compile.optimize}
 deprecation=${compile.deprecation}
 classpath refid=jspc.classpath/
  /javac
/target

or you can use this to do for each one

   exec executable=jspc.cmd
 arg line=${webserver.jspengine.jar} ${webserver.cache.folder}
${compile.jsp.file}/
   /exec
  javac
 srcdir=${webserver.cache.folder}
 destdir=${webserver.cache.folder}
 debug=${compile.debug}
 optimize=${compile.optimize}
 deprecation=${compile.deprecation}
 classpath refid=jspc.classpath/
  /javac

jspc.bat

@echo off
java -classpath jar files org.apache.jasper.JspC -d %2 -v0 -die9 %3

jspengine.jar should be in classpath

best regards
Thiru

 -Original Message-
 From: Ionel Gardais [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, August 05, 2003 12:18 PM
 To: Struts Users Mailing List
 Subject: force precompilation of JSPs
 
 Hi,
 
 I am experiencing a slow down when I access a JSP page for the first
 time after I deploy e web app.
 Is there a way to force precompilation of these files as soon as the
web
 app is deployed ?
 
 Thanks,
 ionel

This e-Mail may contain proprietary and confidential information and is sent for the 
intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you 
are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, 
copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment 
other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: force precompilation of JSPs

2003-08-05 Thread Nagendra Kumar O V S








  hi,
  yes, u can precompile all your jsp pages in to servlets using the app 
  server jsp compiler.. and give the corresponding servlet name and path in 
  the web.xml..
  
  -- nagi
  
  ---Original Message---
  
  
  From: Struts Users Mailing 
  List
  Date: Tuesday, August 
  05, 2003 12:24:05 PM
  To: Struts Users Mailing 
  List
  Subject: force 
  precompilation of JSPs
  Hi,I am experiencing a slow down when I access a 
  JSP page for the first time after I deploy e web app.Is there a 
  way to force precompilation of these files as soon as the web app is 
  deployed 
  ?Thanks,ionel-To 
  unsubscribe, e-mail: [EMAIL PROTECTED]For 
  additional commands, e-mail: [EMAIL PROTECTED].





	
	
	
	
	
	
	




 IncrediMail - 
Email has finally evolved - Click 
Here



RE: force precompilation of JSPs

2003-08-05 Thread Amit Kirdatt
Different servlet containers have different ways of doing it, but the
following method is part of the spec:

http://your-server-name/MyPage.jsp?jsp_precompile

-Original Message-
From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 10:53 AM
To: 'Struts Users Mailing List'
Subject: RE: force precompilation of JSPs


Yes.

:-)


-Original Message-
From: Ionel Gardais [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 05, 2003 2:48 AM
To: Struts Users Mailing List
Subject: force precompilation of JSPs


Hi,

I am experiencing a slow down when I access a JSP page for the first 
time after I deploy e web app.
Is there a way to force precompilation of these files as soon as the web 
app is deployed ?

Thanks,
ionel


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified that
any dissemination, distribution or copying of this e-mail is prohibited. If
you have received this e-mail in error, please notify the sender by replying
to this message and delete this e-mail immediately.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]