ASF Bugzilla – Attachment 28845 Details for
Bug 53301
Servlet init method called twice with embedded Tomcat
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
SampleServlet.java
SampleServlet.java (text/plain), 1.38 KB, created by
Konstantin Kolinko
on 2012-05-28 21:15:20 UTC
(
hide
)
Description:
SampleServlet.java
Filename:
MIME Type:
Creator:
Konstantin Kolinko
Created:
2012-05-28 21:15:20 UTC
Size:
1.38 KB
patch
obsolete
>/** > * > */ >package org.apache.tomcat.tomcat53301; > >import java.io.IOException; > >import javax.servlet.ServletConfig; >import javax.servlet.ServletException; >import javax.servlet.http.HttpServlet; >import javax.servlet.http.HttpServletRequest; >import javax.servlet.http.HttpServletResponse; > >import org.slf4j.Logger; >import org.slf4j.LoggerFactory; > >/** > * > */ >public class SampleServlet > extends HttpServlet >{ > > private static final Logger log = LoggerFactory.getLogger( SampleServlet.class ); > > private boolean alreadyInitialized = false; > > /** {@inheritDoc} > */ > @Override > protected void doGet( HttpServletRequest req, HttpServletResponse resp ) > throws ServletException, IOException > { > resp.getWriter().write( "<html><body>OK</body></html>" ); > } > > /** {@inheritDoc} > */ > @Override > public void init( ServletConfig config ) > throws ServletException > { > log.info( "Init called, config="+config, new Throwable() ); > super.init( config ); > if (this.alreadyInitialized) > { > log.error( "Already initialized"); > throw new IllegalStateException( "Already initialized" ); > } > this.alreadyInitialized = true; > } > > @Override > public void destroy() { > log.info( "Destroy called", new Throwable() ); > super.destroy(); > this.alreadyInitialized = false; > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 53301
:
28844
| 28845