tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexis <alz...@gmail.com>
Subject Re: custom class as resource
Date Mon, 31 Jan 2011 22:23:07 GMT



Sure, find attached 3 files

1. LCMS3, started as Listener.
2. Queue (started from LCMS3 and responsible to start threads connecting to a device and get
information see QueueExec on this class)
3. Parser , responsible to parse and process results obtained from Queue.QueueExec

This app is intended to do the following (extremely resumed)

. Mantain n connections via telnet to a device
. Read a queue of commands to execute on these device
. parse the result and do 2 things with those results
1> show them via web (no need to persist the result in any way), for this purpose i have
a servlet that will parse the result and return an xml to be parsed by extjs(from sencha)
2> persist the data in a database to make off-line reports.

to accomplish what is described in point 1, i thought to handle an object that holds instance
of every object i parse on the database, so

Queue.QueueExec, gets the command, Parser parses the result and store the command in this
object stored on servletcontext, so whenever the servlet that serves the xml need's it, can
access and present the info.

The section regarding point 2 is done (from the called parser i have calls to a DAO class
that access the database)

Let me know if you need more info.

thanks in advance


On Jan 31, 2011, at 7:13 PM, Christopher Schultz wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Alexis,
> 
> On 1/31/2011 4:48 PM, alexis wrote:
>> The only difference i found is the class that sets the attribute on
>> the servletcontext extends ServletContextListener.
>> 
>> the class that access and reads the context extends HttpServlet and
>> shows the content upon an http request.
>> 
>> the class that gets the null pointer, also extends HttpServlet but
>> it's instantiated from another class and a method is called from
>> there.
> 
> Can you show us the code?
> 
> If you aren't calling YourNewServlet.init(ServletContext) then you will
> probably get NPEs. Tomcat provides lots of bootstrap services for
> servlets that you will have to provide yourself if you want to load,
> instantiate, and configure servlets yourself.
> 
>> there's no http request on this class. i've also declared this
>> class as a servlet in the web.xml of my app.
> 
> That may not matter, depending on what your code it doing. Tomcat is
> likely to create an Servlet instance that you cannot access, and you're
> just wasting memory.
> 
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk1HM/UACgkQ9CaO5/Lv0PA3oACeLT8bjyT2BY4w5Rq/DCTI3ghN
> VqgAn3HryldcUCRxrBIHQrKhXkwdDhRs
> =7JfY
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 



Mime
View raw message