Hi Christoph,

Thanks for the info, that was a real good starting point.

Also helpful where these posts:
http://humblecode.blogspot.com/2009/05/gwt-16-using-jndi-datasource.html
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/3f5369b0aea1a265
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/d37a823d8fac8693

I'm putting some advice and my configuration files here, they might be
useful to somebody.

First about about my webapp: it uses jndi to lookup a datasource, and
applies container managed security via JDBCRealm, all data is stored
in an Oracle database.
It was developed using GWT 1.5, and has a working Tomcat
configuration.

In the end of my conversion to Jetty, I didn't manage to get the
container-managed-security via JDBCRealm working because Jetty assumes
the ID's in the tables are ints (mine are varchar2s), so it throws the
java.sql.SQLException: Fail to convert to internal representation.
For development/debugging purposes a HashUserRealm is fine, and it's
very easy to setup.

----------------------------------------------------------------------
- I assume you have your oracle jdbc jar in your lib folder )
----------------------------------------------------------------------
- download jetty-6.1.19.zip, unzip and copy lib/naming/jetty-
naming-6.1.19.jar and lib/plus/jetty-plus-6.1.19.jar to your war/WEB-
INF/lib
----------------------------------------------------------------------
- add to your eclipse launch:  (advice from
http://humblecode.blogspot.com/2009/05/gwt-16-using-jndi-datasource.html)
   -
Djava.naming.factory.initial=org.mortbay.naming.InitialContextFactory
----------------------------------------------------------------------
- Put the security constraint and database resource ref in your war/
WEB-INF/web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
    ..
    <servlet> .. </servlet><servlet-mapping>.. </servlet-mapping>
    etc..
    ..
    <security-constraint>
      <web-resource-collection>
          <web-resource-name>MyWebApp</web-resource-name>
          <description>MyWebApp</description>
          <url-pattern>/protected/*</url-pattern>
      </web-resource-collection>
      <auth-constraint>
          <role-name>admin</role-name>
          <role-name>user</role-name>
      </auth-constraint>
  </security-constraint>

  <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>MyWebApp</realm-name>
    <form-login-config>
      <form-login-page>/logon.jsp</form-login-page>
      <form-error-page>/logonerror.jsp</form-error-page>
    </form-login-config>
  </login-config>

  <resource-ref>
    <description>My DataSource Reference For The Database</
description>
    <res-ref-name>jdbc/myapp</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
..
<web-app>
----------------------------------------------------------------------
Define your database and security in the war/WEB-INF/jetty-web.xml

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://jetty.mortbay.org/configure.dtd";>
<Configure class="org.mortbay.jetty.webapp.WebAppContext">

  <New id="myapp" class="org.mortbay.jetty.plus.naming.Resource">
    <Arg></Arg>
    <Arg>java:comp/env/jdbc/myapp</Arg>
    <Arg>
      <New class="oracle.jdbc.pool.OracleConnectionPoolDataSource">
        <Set name="URL">jdbc:oracle:thin:@localhost:1521:XE</Set>
        <Set name="User">myapp_user</Set>
        <Set name="Password">myapp_pwd</Set>
      </New>
    </Arg>
  </New>

  <Get name="SecurityHandler">
    <Call name="setUserRealm">
      <Arg>
        <New class="org.mortbay.jetty.security.HashUserRealm">
          <Set name="name">MyWebApp</Set>
          <Set name="config">config/dev_realm.properties</Set>
        </New>
      </Arg>
    </Call>
  </Get>

----------------------------------------------------------------------
File: config/dev_realm.properties
bob:bob,admin

(yes, just one line with the username:password,role)
----------------------------------------------------------------------

And fire it up!

I still get a warning though, when starting up my app:
[WARN] Unable to process 'file:war/WEB-INF/web.xml' for servlet

I guess it's to do with the security configuration in the web.xml,
I'll look at it later.

Regards,

Willem




On Aug 21, 10:19 am, cschoett <[email protected]> wrote:
> Maybe one of my earlier post helps 
> you:http://groups.google.com/group/google-web-toolkit/browse_thread/threa...
>
> Regards,
> Christoph
>
> On Aug 19, 4:14 pm, "[email protected]" <[email protected]>
> wrote:
>
> > Thanks for your answer, Lothar.
>
> > The info onjettyyou provided I had already found. What I am actually
> > looking for is that specific info in the context of GWT 1.7,
> > So as to be able to use all the debugging features (as well client as
> > server code debugging) when running my gwt-app in eclipse, in hosted
> > mode usingjettyas a server.
>
> > To rephrase my question: how do you configure jndi and container
> > managed security in theJettyinstance that comes along with GWT 1.7.
>
> > Ciao,
>
> > W.
>
> > On Aug 19, 2:26 pm, Lothar Kimmeringer <[email protected]> wrote:
>
> > > [email protected] schrieb:
>
> > > > I've recently migrated from GWT 1.5.x to 1.7.0 and I'm looking for
> > > > pointers to articles/documentation/... on:
> > > > 1) how to configure the JNDI lookup withinJetty(I want to define my
> > > > database connection details)
>
> > >http://www.google.de/search?q=jetty+jndi+configuration
>
> > > > 2) how to configure container managed security withinJetty
>
> > >http://www.google.de/search?q=jetty+container+managed+security
>
> > > > If the above are too specific, then maybe just how to configureJetty
> > > > in general, within the GWT - eclipse environment.
>
> > > That I was never doing, I always use the Tomcat-server being
> > > "shipped" with GWT. But installing a GWT-application is simply
> > > adding the WAR-file to the web-app-directory or define it as
> > > specific WebApplication.
>
> > > Regards, Lothar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to