RE: How to do the precompilation on jsp

2006-08-14 Thread Wang, Hansen
Download Tomcat Deployer and play with it. There is straightforward 
documentation and example in the deployer. 

Regards,
Hansen
-Original Message-
From: Raju Balugu [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 09, 2006 11:42 PM
To: Tomcat Users List
Subject: Re: How to do the precompilation on jsp

Hi All,

I have a basic doubt on precompilation .I am doing precompilation using the
scripts(jspc.sh) .
Its giving the Exception in thread main java.lang.NoClassDefFoundError:
org/apache/tools/ant/util/FileUtils
at org.apache.jasper.JspC.resolveFile(JspC.java:1395)
at org.apache.jasper.JspC.setUriroot(JspC.java:686)
at org.apache.jasper.JspC.setArgs(JspC.java:283)
at org.apache.jasper.JspC.main(JspC.java:241)

I could see the FileUtils.class in ant.jar but I dont have ant.jar in 
tomcat/common/lib.

Is it possible to compile jsps without ant.jar ?(actually i am calling the 
JspC( org.apache.jasper.JspC $@) it requires FileUtils) Shell I call  
org.apache.jasper.compiler.Compiler $@

Please share your experience?

Thanks in advance

Regards
Raju
On 8/8/06, Raju Balugu [EMAIL PROTECTED] wrote:


 Thanks Subir ,

 I didn't find the jspc.sh script in tomcat5.5.17..Could you please 
 point me to that location?

 Thanks in advance

 Regards
 Raju

  On 8/5/06, Subir Sengupta [EMAIL PROTECTED] wrote:
 
  Use the jspc.sh script to precompile your jsp's.
 
  -Original Message-
  From: Sameer Acharya [mailto: [EMAIL PROTECTED]
  Sent: Thursday, August 03, 2006 3:43 AM
  To: Tomcat Users List
  Subject: Re: How to do the precompilation on jsp
 
  My understanding is that you need to pre-compile jsp's from your 
  build before you start using the application right ?
  You can write a simple script to hit all your jsp's ( need to start 
  tomcat first), this will precompile your jsp's.
  -Sameer
 
  Raju Balugu [EMAIL PROTECTED] wrote: Hi All,
 
  We are using the clearcase for version control(vob).My requirement 
  is like..I need to do the precompilation before going to ran a 
  build?is there any utilities in  tomcat  end or third partys.(as the 
  jasper-compiler is so fast we are palning to do this).please share 
  your experience on precompile the jsp files
 
  Thanks in advance.
 
  Regards
  Raju
 
 
 
  -
  Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  
  Great rates starting at 1ยข/min.
 
  
  - To start a new topic, e-mail: users@tomcat.apache.org To 
  unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [5.5] path specified in context.xml not being used

2006-03-31 Thread Wang, Hansen
The following links are related to the topic:

http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html

Hansen

-Original Message-
From: Phil Wilson [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 31, 2006 7:09 AM
To: Tomcat Users List
Subject: Re: [5.5] path specified in context.xml not being used

 see also my other post in *Setting the context path for expanded
WARs* 
 
 On 24/03/06, Wang, Hansen [EMAIL PROTECTED] wrote:
 The path is ignored when you deploy webapps this way. Tomcat will use

 the basename of the war file as the context path. If you want to use 
 something different than that, you can create a context.xml and put 
 in under the virtual host's conf direction (e.g.
 CATALINA_HOME/conf/Catalina/localhost). In this context.xml, you can 
 specify the context path and docBase.

Hi Nic and Hansen, thanks for this info, it's really useful.

Is this actually documented on the Tomcat site? I couldn't find anything
about it (in particular the renaming of context.xml to
my#nested#path.xml)

Cheers,

Phil Wilson

-
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: session GC

2006-03-31 Thread Wang, Hansen
If you would like something simple and intuitive, you can create a class
and overwrite the finalized() method to print out simple log. Then,
create a separate object of your class for each httpsession and add it
as an attribute of the httpsession. Of cause you want to make sure that
you do not keep other references to this object and keep the log simple.

Hansen

-Original Message-
From: John Powers [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 31, 2006 4:07 PM
To: Tomcat Users List
Subject: session GC

How do you know when a session is garbage collected?
You can write a sessionlistener for when it gets deleted out of tomcat,
but after that, when do you know if its garbage collected?

I currently do not think my sessions are being collected.   Within a day
500M of memory get eaten up and I can't collect them manually even.  So
I want to know when/if the sessions are being collected.

If I wrote a subclass to httpsession, how could get tomcat to use it?


-
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: security-constraint

2006-03-29 Thread Wang, Hansen
If you are using struts for your webapp, there is an extension sslext
for this purpose. What it does are: 1) gernerate complete url with
property scheme using it's tag; 2) redirect (as you said in your email)
if the incoming has unmatched scheme for the target resource.

Hansen 

-Original Message-
From: tamsin [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 29, 2006 7:25 AM
To: Tomcat-Users
Subject: security-constraint 

Hi all,

I wonder if anyone can help me, I've recently taken over management of
our Tomcat webapp, and have been listening to the list for a while,
although don't know enough to contribute much yet I am afraid.

I'm using the following security-constraint to make sure that any user
using our payment module is transferred to https

security-constraint
   display-nameSecure Access/display-name
   web-resource-collection
  web-resource-nameOrderPayment/web-resource-name

  url-pattern/OrderPayment/url-pattern
   /web-resource-collection
   user-data-constraint
  transport-guaranteeCONFIDENTIAL/transport-guarantee
   /user-data-constraint
/security-constraint

This works fine - if I request http://mydomain/OrderPayment I get
transferred to https.

However, after they've finished paying I really want to transfer them
back to http. I couldn't see a way of doing this using web.xml - the
info I found on the net suggested this isn't possible.

So, I thought I could write a filter to do this. I can easily write a
filter which uses sendRedirect to tranfer an https request to http, but
I wanted to know the best way to see which requests to do this to. I
could hard code into my filter the names of the pages I want to be
secure, but I wondered if there is any way of finding out
programatically which requests are covered by the security-contraint,
and then any that are https and aren't covered, do the redirect on.

Does that make sense? i.e. can I do something like :

if (request.getScheme().equals(https)
 !request.hasConfidentialSecurityContraint()) {

(And does this in general sound like a sensible way of doing things?)

Thanks for any help,
Tamsin




--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.3/295 - Release Date:
28/03/2006


-
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: [5.5] path specified in context.xml not being used

2006-03-24 Thread Wang, Hansen
The path is ignored when you deploy webapps this way. Tomcat will use
the basename of the war file as the context path. If you want to use
something different than that, you can create a context.xml and put in
under the virtual host's conf direction (e.g.
CATALINA_HOME/conf/Catalina/localhost). In this context.xml, you can
specify the context path and docBase.

Hansen

-Original Message-
From: Kris Nuttycombe [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 24, 2006 2:34 PM
To: users@tomcat.apache.org
Subject: [5.5] path specified in context.xml not being used

Hi, all,

Hopefully a pretty simple question:

I am attempting to deploy a warfile with an embedded
META-INF/context.xml. The contents of the context.xml file looks like
this:

Context path=/idb debug=99 reloadable=true crossContext=false
override=true
...
/Context

The warfile is named idb-0.8.2-SNAPSHOT.war

Everything is working fine EXCEPT that the context path that it is
deployed under is /idb-0.8.2-SNAPSHOT instead of /idb - how can I
get it to deploy under a path different from the warfile name?

Thanks,

Kris






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



RE: first jdbc tomcat application

2006-02-23 Thread Wang, Hansen
If you are using tomcat5, do not use ResourceParams. Instead, define
those params as attribute of Resource, as this:
 Resource name=jdbc/WroxTC5 auth=Container
type=javax.sql.Datasource
driverClassName=com.mysql.jdbc.Driver
username=xyz ...
/
 

-Original Message-
From: David McMinn [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 23, 2006 9:20 AM
To: users@tomcat.apache.org
Subject: first jdbc tomcat application

I'm stepping through the example Professional Apache Tomcat 5 book by
Wrox in Chapter 14 - I have set up the mysql database and confirmed it
works and set up the tomcat server and confirmed that I can see my
index.jsp page. When I try to go to
http://localhost:8070/jsp-examples/wroxjdbc/JDBCTest.jsp
  I get a standard The page cannot be displayed page.
   
  I've included all my steps below. Anyone that can help is most
appreciated. Thanks in advance.Dave
   
  Steps I have done
   
  1) Created a DB called everycitizen and a table called test with a
column called pk. Created user everyuser w/ a password and granted
Select privileges to that user.
  2) Copied the mysql-connector-java-3.1.12-bin.jar into
$CATALINA_HOME/common/lib.
  3)Added the following to the $CATALINA_HOME/conf/server.xml just
before the /Host tag. Password is blotted out.
   
  !-- added by DM 2/22/2006 --
 DefaultContext
  Resource name=jdbc/WroxTC5 auth=Container
type=javax.sql.Datasource/
  ResourceParams name=jdbc/WroxTC5
   parameter
namedriverClassName/name
valuecom.mysql.jdbc.Driver/value
   /parameter
   parameter
nameurl/name
valuejdbc:mysql://localhost/everycitizen/value
   /parameter
   parameter
nameusername/name
valueeveryuser/value
   /parameter
   parameter
namepassword/name
value*/value
   /parameter
   parameter
namemaxActive/name
   ; value20/value
   /parameter
   parameter
namemaxIdle/name
value3/value
   /parameter
   parameter
namemaxWait/name
value100/value
   /parameter
  /ResourceParams
 /DefaultContext

  4) Added the following to the
$CATALINA_HOME/webapps/jsp-examples/WEB-INF web.xml file at the bottom
just before the /web-app entry after the last env-entry. 
  
resource-ref
  res-ref-namejdbc/WroxTC5/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
/resource-ref

  5) Added the JDBCTest.jsp file and the errorpg.jsp file to
$CATALINA_HOME/webapps/jsp-examples/wroxjdbc directory. I created the
wroxjdbc folder. The JDBC Test is:
   
  html
 head
  %@ page errorPage=errorpg.jsp
   import=java.sql.*,
 javax.sql.*,
 java.io.*,
 javax.naming.InitialContext,
 javax.naming.Context %
 /head
 body
  h1JDBC JNDI Resource Test/h1
  %
  InitialContext initCtx = new InitialContext();
  DataSource ds =
(DataSource)initCtx.lookup(java:comp/env/jdbc/WroxTC5);
  Connection conn = ds.getConnection();
  Statement stmt = conn.createStatement();
  ResultSet rset = stmt.executeQuery(select * from test;);
  %
  table width = '600' border='1'
   tr
th align='left'/th
   /tr
   %
   while (rset.next())
   {
   %
trtd %=rset.getInt(0)%/td/tr
   % } 
   rset.close();
   stmt.close();
   conn.close();
   initCtx.close();
   %
  /table
 /body
/html
   
   
  and the errorpg is:
   
  html
 body
  %@ page isErrorPage=true %
  h1 An error has occurred /h1
  %= exception.getMessage() %
 /body
/html



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



RE: tomcat 5.5.15 404 - extra path after jsp page

2006-02-22 Thread Wang, Hansen
It is because no servlet is selected for that url based on both explicit
and implicit servlet mappings. You would need to pre-compile the jsp
into class file (e.g. basic-arithmetic_jsp.class) and then define and
map the servlet:

servlet-mapping
servlet-namebasic-arithmetic_jsp/servlet-name
url-pattern/basic-arithmetic.jsp/*/url-pattern
/servlet-mapping
servlet
servlet-namebasic-arithmetic_jsp/servlet-name
servlet-classbasic-arithmetic_jsp.class/servlet-name
/servlet

Using this configuration, /test will be passed to your servlet as
request path info.

You can take a look of section 11.2 of the servlet specification for
details.



-Original Message-
From: Xiangzhou Wang [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 22, 2006 4:31 PM
To: users@tomcat.apache.org
Subject: tomcat 5.5.15 404 - extra path after jsp page


I am using tomcat 5.5.15, I can access jsp page, but if I put /something
after jsp page, I will get 404 error.

e.g.
good -
http://localhost:8080/jsp-examples/jsp2/el/basic-arithmetic.jsp

error-
http://localhost:8080/jsp-examples/jsp2/el/basic-arithmetic.jsp/test

Is there a way to still access the jsp and use getPathInfo to get
test? change config ??

Thanks,
William

-
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]