You want to override init(), not service().
On Mon, Nov 30, 2009 at 2:49 PM, Tahir Akram <[email protected]> wrote:
> I want to initialize a generic servlet on load-on-startup = 1. I read
> on GAE docs that this feature is supported but happen only when first
> request comes, not prior to it. But its not working. I dont know
> whether on local and production it has same behavior.
>
> Will anyone please guide me if I can do that?
>
> My Generic servlet code:
>
> public class StartupServlet extends GenericServlet {
> public void service(ServletRequest arg0, ServletResponse arg1)
> throws ServletException, IOException {
> String serverInfo = getServletContext().getServerInfo();
> if (serverInfo.contains("Development")) {
> FFConstants.DEV_MODE = true;
> }else {
> FFConstants.DEV_MODE = false;
> }
> }
> }
>
>
> Web.xml enteries
>
> <servlet>
> <servlet-name>StartupServlet</servlet-name>
> <servlet-class>com.servlet.StartupServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> <servlet-mapping>
> <servlet-name>StartupServlet</servlet-name>
> <url-pattern>/Startup</url-pattern>
> </servlet-mapping>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" 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-appengine-java?hl=en.