You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Reynir Hubner <re...@hugsmidjan.is> on 2002/03/20 19:18:38 UTC

RE: TC 4 - URLRewrite :: repost

hey guys, I got no replies.. so this is a repost of the same message
from early this morning.. (hope someone will notice it this time.. ).


> Hi, 
> 
> I'm looking for the best way of writing a URLRewrite for tomcat that
> works similar to mod_rewrite in apache. 
> Does anyone have an opinion on this matter, should I write a filter or
> extend some of the Tomcat base servlets such as DefaultServlet or
> InvokerServlet, or even write some kind of an addition onto coyote.
> 
> I think filter is the correct way to do it.. what's your opinion ?
> 
> thanx... 
> -reynir@hugsmidjan.is
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
> 
> 

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: TC 4 - URLRewrite :: repost

Posted by James Williamson <ja...@nameonthe.net>.
Hi Reynir,

I had a look at doing this, from having a look at the code, the only thing
you can do
is a client side redirect (i.e. sending back a HTTP 302 to the redirected
page). From what
I gathered you've got to start going right up the food chain within Tomcat
to do it internally,
i.e. Filter->Value->Container->Connector

Regards,

James Williamson
www.nameonthe.net
----- Original Message -----
From: Reynir Hubner <re...@hugsmidjan.is>
To: Tomcat Users List <to...@jakarta.apache.org>
Sent: Wednesday, March 20, 2002 6:18 PM
Subject: RE: TC 4 - URLRewrite :: repost


> hey guys, I got no replies.. so this is a repost of the same message
> from early this morning.. (hope someone will notice it this time.. ).
>
>
> > Hi,
> >
> > I'm looking for the best way of writing a URLRewrite for tomcat that
> > works similar to mod_rewrite in apache.
> > Does anyone have an opinion on this matter, should I write a filter or
> > extend some of the Tomcat base servlets such as DefaultServlet or
> > InvokerServlet, or even write some kind of an addition onto coyote.
> >
> > I think filter is the correct way to do it.. what's your opinion ?
> >
> > thanx...
> > -reynir@hugsmidjan.is
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > To unsubscribe:   <ma...@jakarta.apache.org>
> > For additional commands: <ma...@jakarta.apache.org>
> > Troubles with the list: <ma...@jakarta.apache.org>
> >
> >
>
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: DataSources in Tomcat 4 / Windows XP

Posted by Lev Assinovsky <le...@peterlink.ru>.
Is Oracle driver (classes111.zip) visible to Tomcat.
I had to modify (in Linux) catalina.sh script to add driver's path to
the internal
CLASSPATH used by catalina. 

Martin Miranda wrote:
> 
> Hello
> 
> Im having problems creating a DataSource in a StandAlone Tomcat 4.0.1
> with Windows XP. The InitialContext find the DataSource but it cames
> null
> 
> This is the Code:
> 
> <%
>         InitialContext ctxinit = new InitialContext();
> %>
> <%= ctxinit.lookup("java:/comp/env/jdbc/testDB") %> << NULL
> 

You get EnabledDataSource instance above so you have to cast.
May it's be better like this:
<% DataSource ds = (DataSource)
ctxinit.lookup("java:/comp/env/jdbc/testDB") %>
<%= ds %>

Also all examples doing this way:
		Context ctx  = new InitialContext();
		Context envCtx = (Context)ctx.lookup("java:comp/env");
		ds = (DataSource)envCtx.lookup("jdbc/testDB");

Try that just in case.

So your case must work!!
Though I don't advise you to use EnabledDataSource (Tyrex stuff) for
production - it doesn't provide
connection pool.
Use commons/dbcp.
I tested it - it works fine (besides Tomcat 4.0.4-b1 - nothing work
there).

> In the web application deployment descriptor (web.xml) i have this code:
> 
>   <resource-ref>
>     <description>Resource reference to a factory for java.sql.Connection
> instances that may be used for talking to a particular database that is
> configured in the server.xml file.</description>
>     <res-ref-name>jdbc/testDB</res-ref-name>
>     <res-type>javax.sql.DataSource</res-type>
>     <res-auth>Container</res-auth>
>   </resource-ref>
> 
> In the server.xml file:
> 
> <Context path="/test" docBase="test/" debug="1" privileged="true"
> reloadable="true" useNaming="true">
> 
> <Resource name="jdbc/testDB" auth="Container"
> type="javax.sql.DataSource" description="Default Database for
> Applications" />
> 
> <ResourceParams name="jdbc/testDB">
>         <parameter>
>                 <name>driverClassName</name>
>                 <value>oracle.jdbc.driver.OracleDriver</value>
>         </parameter>
>         <parameter>
>                 <name>driverName</name>
>                 <value>jdbc:oracle:thin:@dir</value>
>         </parameter>
>         <parameter>
>                 <name>user</name>
>                 <value>usuario1</value>
>         </parameter>
>         <parameter>
>                 <name>password</name>
>                 <value>password1</value>
>         </parameter>
> </ResourceParams>
> </Context>
> 
> When i use debug level 1 in the context the logs seems normal:
> 
> XmlMapper: org.apache.catalina.core.StandardContext.setSessionTimeout(
> 30)
> XmlMapper: org.apache.catalina.core.StandardContext.addMimeMapping(
> html, text/html)
> XmlMapper: org.apache.catalina.core.StandardContext.addMimeMapping( txt,
> text/plain)
> XmlMapper: org.apache.catalina.core.StandardContext.addWelcomeFile(
> index.jsp)
> XmlMapper: org.apache.catalina.core.StandardContext.addWelcomeFile(
> index.html)
> XmlMapper: new null org.apache.catalina.deploy.ContextResource
> resource-ref ContextResource[name=null, scope=Shareable]
> XmlMapper: org.apache.catalina.deploy.ContextResource.setDescription(
> Resource reference to a factory for java.sql.Connection instances that
> may be used for talking to a particular database that is configured in
> the server.xml file.)
> XmlMapper: org.apache.catalina.deploy.ContextResource.setName(
> jdbc/testDB)
> XmlMapper: org.apache.catalina.deploy.ContextResource.setType(
> javax.sql.DataSource)
> XmlMapper: org.apache.catalina.deploy.ContextResource.setAuth(
> Container)
> XmlMapper: Calling org.apache.catalina.core.StandardContext.addResource
> ContextResource[name=jdbc/testDB, description=Resource reference to a
> factory for java.sql.Connection instances that may be used for talking
> to a particular database that is configured in the server.xml file.,
> type=javax.sql.DataSource, auth=Container, scope=Shareable]
> XmlMapper: pop resource-ref org.apache.catalina.deploy.ContextResource:
> ContextResource[name=jdbc/testDB, description=Resource reference to a
> factory for java.sql.Connection instances that may be used for talking
> to a particular database that is configured in the server.xml file.,
> type=javax.sql.DataSource, auth=Container, scope=Shareable]
> 
> 
> 
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>

-- 
Lev Assinovsky                Peterlink Web
Programmer		      St. Petersburg, Russia
Tel/Fax: +7 812 3275343       197022 ul.Chapigina 7а
E-mail: lev@peterlink.ru

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


DataSources in Tomcat 4 / Windows XP

Posted by Martin Miranda <mm...@cubika.com>.
Hello

Im having problems creating a DataSource in a StandAlone Tomcat 4.0.1
with Windows XP. The InitialContext find the DataSource but it cames
null

This is the Code:

<%
	InitialContext ctxinit = new InitialContext();		
%>
<%= ctxinit.lookup("java:/comp/env/jdbc/testDB") %> << NULL

In the web application deployment descriptor (web.xml) i have this code:

  <resource-ref>
    <description>Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular database that is
configured in the server.xml file.</description>
    <res-ref-name>jdbc/testDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

In the server.xml file:

<Context path="/test" docBase="test/" debug="1" privileged="true"
reloadable="true" useNaming="true">
        
<Resource name="jdbc/testDB" auth="Container"
type="javax.sql.DataSource" description="Default Database for
Applications" />
        	
<ResourceParams name="jdbc/testDB">
	<parameter>
		<name>driverClassName</name>
		<value>oracle.jdbc.driver.OracleDriver</value>
	</parameter>
	<parameter>
		<name>driverName</name>
		<value>jdbc:oracle:thin:@dir</value>
	</parameter>
	<parameter>
		<name>user</name>
		<value>usuario1</value>
	</parameter>
	<parameter>
		<name>password</name>
		<value>password1</value>
	</parameter>
</ResourceParams>          
</Context>        

When i use debug level 1 in the context the logs seems normal:

XmlMapper: org.apache.catalina.core.StandardContext.setSessionTimeout(
30)
XmlMapper: org.apache.catalina.core.StandardContext.addMimeMapping(
html, text/html)
XmlMapper: org.apache.catalina.core.StandardContext.addMimeMapping( txt,
text/plain)
XmlMapper: org.apache.catalina.core.StandardContext.addWelcomeFile(
index.jsp)
XmlMapper: org.apache.catalina.core.StandardContext.addWelcomeFile(
index.html)
XmlMapper: new null org.apache.catalina.deploy.ContextResource
resource-ref ContextResource[name=null, scope=Shareable]
XmlMapper: org.apache.catalina.deploy.ContextResource.setDescription(
Resource reference to a factory for java.sql.Connection instances that
may be used for talking to a particular database that is configured in
the server.xml file.)
XmlMapper: org.apache.catalina.deploy.ContextResource.setName(
jdbc/testDB)
XmlMapper: org.apache.catalina.deploy.ContextResource.setType(
javax.sql.DataSource)
XmlMapper: org.apache.catalina.deploy.ContextResource.setAuth(
Container)
XmlMapper: Calling org.apache.catalina.core.StandardContext.addResource
ContextResource[name=jdbc/testDB, description=Resource reference to a
factory for java.sql.Connection instances that may be used for talking
to a particular database that is configured in the server.xml file.,
type=javax.sql.DataSource, auth=Container, scope=Shareable]
XmlMapper: pop resource-ref org.apache.catalina.deploy.ContextResource:
ContextResource[name=jdbc/testDB, description=Resource reference to a
factory for java.sql.Connection instances that may be used for talking
to a particular database that is configured in the server.xml file.,
type=javax.sql.DataSource, auth=Container, scope=Shareable]

 



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>