-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------


Hi,
On Wed, 1 Sep 1999, Reuben @ I-Cue wrote:
RIC| Whilst all this is good and well, I noted a limitation of JServSSI in that
RIC| it doesn't work
RIC| with Servlets which implement the SingleThreadModel interface. I'd firstly
RIC| like to
RIC| know why this is. 

This is a long story. The SSI Servlet calls a servlet by asking the
context for a servlet with the given name:
   Servlet servlet = context.getServlet(className);
The context returns an instance of the servlet. The service() method is
called - done.

If the Servlet is a SingleThreadModel Servlet, the Servlet engine has to
make sure, that the servlet()-method of a given instance is called in only
_one_ thread. Internally, the engine could do this in differnet ways,
usually by maintaining a set of instantiated servlets in a pool. If a
servlet is called, it is taken from the pool, executed and put back in the
pool. BUT - this is done internally and implementation dependant, and
there is no way for a 'user'-servlet (which the SSI-servlet is), to savely
get a servlet and put it back.

In case of JServ, if context.getServlet() is called, the engine returns an
instance which would be save to call, but since there is no way to give it
back to the internal pool, this works only until the maximum of
STM-instances is allocated (default is 10 AFAIK) ...

So - there are several options: Write the servlet thread save (which is
the best way IMO). Wait for JSKD 2.1 and an JSSI using it, since there 
are much better possibilities to call servlets from user servlet IIRC.
Or use a solution you proposed - making the SSI servlet STM (a bit hacky).

(please read <http://java.apache.org/faq/?file=165> as well !)

RIC| And Secondly could I write a servlet which reads in the
RIC| .jhtml file
RIC| and somehow pass it to the JServSSI Servlet which will replace the
RIC| <SERVLET></SERVLET> tag
RIC| and subsequently send the result back to a browser ? This can then implement
RIC| the SingleThreadModel
RIC| interface.

Have a look at the PageParserServlet, it uses class PageParser which could
be used in your won servlets. You could as well extend the SSI-Servlet and
just add the tagging SingleThreadModel interface, something like

-----
public class STMSSI extends org.apache.servlet.ssi.SSI
  implements SingleThreadModel {
}
----

ciao,
  -hen
---
Henner Zeller                                 [EMAIL PROTECTED]
 PGP pub key [77F75B39]: finger [EMAIL PROTECTED] 




--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to