2 Replies Latest reply on Jul 29, 2003 4:39 AM by hirosh101

    URL Resource

    lubbitikarson

      Hi,

      could somebody tell me how do I define URL resource in JBoss?

      thanks,

      Lubbi Tikarson

        • 1. Re: URL Resource
          hirosh101

          Hello !

          you've a look at http://jboss.sourceforge.net/doc-24/ch05s02.html !
          There is an example.

          bye

          Hirosh

          • 2. Re: URL Resource connection http factory
            hirosh101

            If you use xdoclet ! You can choose this tags. Here's an
            example:

            Write in your EJB following tags:

            ...

            * @ejb.resource-ref
            * res-ref-name="url/fooDS"
            * res-type="java.net.URL"
            * res-auth="Container"
            * @jboss.resource-ref
            * res-ref-name="url/fooDS"
            * jndi-name="java:/fooDS"
            * res-url="http://www.jboss.org"

            ---

            Xdoclet generates the in jboss.xml and ejb-jar.xml the
            right xml description for the container.

            After that you can use that factory from your EJB with
            following detail:
            ...

            {
            Context context = new InitialContext( );
            URL url = ( URL ) context.lookup( java:comp/env/url/fooDS );
            URLConnection connection = ( URLConnection ) url.openConnection( );
            is = connection.getInputStream( );
            br = new BufferedReader( new InputStreamReader( is ) );
            String line;
            while ( ( line = br.readLine( ) ) != null )
            {
            ...
            }
            ...


            regards

            Hirosh