View Javadoc

1   /*
2    * $Id: MuleXmlBuilderContextServlet.java 7976 2007-08-21 14:26:13Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.config.builders;
12  
13  import java.io.IOException;
14  
15  import javax.servlet.ServletException;
16  import javax.servlet.http.HttpServlet;
17  import javax.servlet.http.HttpServletRequest;
18  import javax.servlet.http.HttpServletResponse;
19  
20  public class MuleXmlBuilderContextServlet extends HttpServlet
21  {
22      /**
23       * Serial version
24       */
25      private static final long serialVersionUID = -2446689032349402434L;
26  
27      private MuleXmlBuilderContextListener contextListener = null;
28      
29      public void init() throws ServletException
30      {
31          if (contextListener != null)
32          {
33              contextListener.destroy();
34              contextListener = null;
35          }
36          contextListener = new MuleXmlBuilderContextListener();
37          contextListener.initialize(getServletContext());
38      }
39  
40      protected void service(HttpServletRequest request, HttpServletResponse response)
41          throws ServletException, IOException
42      {
43          getServletContext().log(
44              "("
45              + request.getRequestURI()
46              + ")"
47              + "MuleXmlBuilderContextServlet.service(HttpServletRequest request, HttpServletResponse response) call ignored.");
48          response.sendError(HttpServletResponse.SC_BAD_REQUEST);
49      }
50  
51      public void destroy()
52      {
53          if (contextListener != null)
54          {
55              contextListener.destroy();
56          }
57      }
58  }