//# 0 errors, 94 messages
//#
/*
    //#xmlrpccontroller.java:1:1: class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#xmlrpccontroller.java:1:1: method: net.sourceforge.pebble.web.controller.XmlRpcController.net.sourceforge.pebble.web.controller.XmlRpcController__static_init
 * Copyright (c) 2003-2006, Simon Brown
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *   - Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *
 *   - Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in
 *     the documentation and/or other materials provided with the
 *     distribution.
 *
 *   - Neither the name of Pebble nor the names of its contributors may
 *     be used to endorse or promote products derived from this software
 *     without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package net.sourceforge.pebble.web.controller;

import net.sourceforge.pebble.webservice.BloggerAPIHandler;
import net.sourceforge.pebble.webservice.MetaWeblogAPIHandler;
import net.sourceforge.pebble.webservice.PebbleAPIHandler;
import net.sourceforge.pebble.webservice.SearchAPIHandler;
import org.apache.xmlrpc.XmlRpcServer;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;

/**
 * Single entry point for all XML-RPC requests (e.g. Blogger API).
 *
 * @author    Simon Brown
 */
public class XmlRpcController extends HttpServlet {
    //#xmlrpccontroller.java:54: method: void net.sourceforge.pebble.web.controller.XmlRpcController.net.sourceforge.pebble.web.controller.XmlRpcController()
    //#input(void net.sourceforge.pebble.web.controller.XmlRpcController()): this
    //#xmlrpccontroller.java:54: end of method: void net.sourceforge.pebble.web.controller.XmlRpcController.net.sourceforge.pebble.web.controller.XmlRpcController()

  /**
   * Initialises this instance.
   */
  public void init() {
  }
    //#xmlrpccontroller.java:60: method: void net.sourceforge.pebble.web.controller.XmlRpcController.init()
    //#xmlrpccontroller.java:60: end of method: void net.sourceforge.pebble.web.controller.XmlRpcController.init()

  /**
   * Processes the request - this is delegated to from doGet and doPost.
   *
   * @param request   the HttpServletRequest instance
   * @param response   the HttpServletResponse instance
   */
  protected void processRequest(HttpServletRequest request,
                                HttpServletResponse response)
      throws ServletException, IOException {

    try {
      XmlRpcServer xmlrpc = new XmlRpcServer();
    //#xmlrpccontroller.java:73: method: void net.sourceforge.pebble.web.controller.XmlRpcController.processRequest(HttpServletRequest, HttpServletResponse)
    //#xmlrpccontroller.java:73: Warning: method not available
    //#    -- call on void org.apache.xmlrpc.XmlRpcServer()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#    method: void processRequest(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.xmlrpc.XmlRpcServer()
    //#input(void processRequest(HttpServletRequest, HttpServletResponse)): request
    //#input(void processRequest(HttpServletRequest, HttpServletResponse)): response
    //#input(void processRequest(HttpServletRequest, HttpServletResponse)): this
    //#pre[1] (void processRequest(HttpServletRequest, HttpServletResponse)): request != null
    //#pre[2] (void processRequest(HttpServletRequest, HttpServletResponse)): response != null
    //#presumption(void processRequest(HttpServletRequest, HttpServletResponse)): javax.servlet.http.HttpServletResponse:getOutputStream(...)@91 != null
    //#presumption(void processRequest(HttpServletRequest, HttpServletResponse)): org.apache.xmlrpc.XmlRpcServer:execute(...)@88 != null
    //#presumption(void processRequest(HttpServletRequest, HttpServletResponse)): org.springframework.web.context.support.WebApplicationContextUtils:getWebApplicationContext(...)@74 != null
    //#presumption(void processRequest(HttpServletRequest, HttpServletResponse)): result.length@88 <= 4_294_967_295
      ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
    //#xmlrpccontroller.java:74: Warning: method not available
    //#    -- call on ServletContext net.sourceforge.pebble.web.controller.XmlRpcController:getServletContext()
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#    method: void processRequest(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: ServletContext net.sourceforge.pebble.web.controller.XmlRpcController:getServletContext()
    //#xmlrpccontroller.java:74: Warning: method not available
    //#    -- call on WebApplicationContext org.springframework.web.context.support.WebApplicationContextUtils:getWebApplicationContext(ServletContext)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#    method: void processRequest(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: WebApplicationContext org.springframework.web.context.support.WebApplicationContextUtils:getWebApplicationContext(ServletContext)

      BloggerAPIHandler bloggerApi = (BloggerAPIHandler)ctx.getBean("bloggerApiHandler");
    //#xmlrpccontroller.java:76: Warning: method not available
    //#    -- call on Object org.springframework.context.ApplicationContext:getBean(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#    method: void processRequest(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: Object org.springframework.context.ApplicationContext:getBean(String)
      xmlrpc.addHandler("blogger", bloggerApi);
    //#xmlrpccontroller.java:77: Warning: method not available
    //#    -- call on void org.apache.xmlrpc.XmlRpcServer:addHandler(String, Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#    method: void processRequest(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.xmlrpc.XmlRpcServer:addHandler(String, Object)

      MetaWeblogAPIHandler metaweblogApi = (MetaWeblogAPIHandler)ctx.getBean("metaweblogApiHandler");
    //#xmlrpccontroller.java:79: Warning: method not available
    //#    -- call on Object org.springframework.context.ApplicationContext:getBean(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#    method: void processRequest(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: Object org.springframework.context.ApplicationContext:getBean(String)
      xmlrpc.addHandler("metaWeblog", metaweblogApi);
    //#xmlrpccontroller.java:80: Warning: method not available
    //#    -- call on void org.apache.xmlrpc.XmlRpcServer:addHandler(String, Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#    method: void processRequest(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.xmlrpc.XmlRpcServer:addHandler(String, Object)

      PebbleAPIHandler pebbleApi = (PebbleAPIHandler)ctx.getBean("pebbleApiHandler");
    //#xmlrpccontroller.java:82: Warning: method not available
    //#    -- call on Object org.springframework.context.ApplicationContext:getBean(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#    method: void processRequest(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: Object org.springframework.context.ApplicationContext:getBean(String)
      xmlrpc.addHandler("pebble", pebbleApi);
    //#xmlrpccontroller.java:83: Warning: method not available
    //#    -- call on void org.apache.xmlrpc.XmlRpcServer:addHandler(String, Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#    method: void processRequest(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.xmlrpc.XmlRpcServer:addHandler(String, Object)

      SearchAPIHandler searchApi = (SearchAPIHandler)ctx.getBean("searchApiHandler");
    //#xmlrpccontroller.java:85: Warning: method not available
    //#    -- call on Object org.springframework.context.ApplicationContext:getBean(String)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#    method: void processRequest(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: Object org.springframework.context.ApplicationContext:getBean(String)
      xmlrpc.addHandler("search", searchApi);
    //#xmlrpccontroller.java:86: Warning: method not available
    //#    -- call on void org.apache.xmlrpc.XmlRpcServer:addHandler(String, Object)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#    method: void processRequest(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: void org.apache.xmlrpc.XmlRpcServer:addHandler(String, Object)

      byte[] result = xmlrpc.execute(request.getInputStream());
    //#xmlrpccontroller.java:88: Warning: method not available
    //#    -- call on byte[] org.apache.xmlrpc.XmlRpcServer:execute(InputStream)
    //#    severity: INFORMATIONAL
    //#    class: net.sourceforge.pebble.web.controller.XmlRpcController
    //#    method: void processRequest(HttpServletRequest, HttpServletResponse)
    //#    unanalyzed callee: byte[] org.apache.xmlrpc.XmlRpcServer:execute(InputStream)
      response.setContentType("text/xml; charset=UTF-8");
      response.setContentLength(result.length);
      OutputStream out = response.getOutputStream();
      out.write(result);
      out.flush();
    } catch (Exception e) {
      e.printStackTrace();
      throw new ServletException(e);
    }
  }
    //#xmlrpccontroller.java:98: end of method: void net.sourceforge.pebble.web.controller.XmlRpcController.processRequest(HttpServletRequest, HttpServletResponse)

  /**
   * A default implementation of doGet that delegates to the processRequest method.
   *
   * @param req   the HttpServletRequest instance
   * @param res   the HttpServletResponse instance
   */
  protected void doGet(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

    processRequest(req, res);
    //#xmlrpccontroller.java:109: method: void net.sourceforge.pebble.web.controller.XmlRpcController.doGet(HttpServletRequest, HttpServletResponse)
    //#input(void doGet(HttpServletRequest, HttpServletResponse)): __Descendant_Table[net/sourceforge/pebble/web/controller/XmlRpcController]
    //#input(void doGet(HttpServletRequest, HttpServletResponse)): __Descendant_Table[others]
    //#input(void doGet(HttpServletRequest, HttpServletResponse)): __Dispatch_Table.processRequest(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V
    //#input(void doGet(HttpServletRequest, HttpServletResponse)): req
    //#input(void doGet(HttpServletRequest, HttpServletResponse)): res
    //#input(void doGet(HttpServletRequest, HttpServletResponse)): this
    //#input(void doGet(HttpServletRequest, HttpServletResponse)): this.__Tag
    //#pre[1] (void doGet(HttpServletRequest, HttpServletResponse)): req != null
    //#pre[2] (void doGet(HttpServletRequest, HttpServletResponse)): res != null
    //#pre[4] (void doGet(HttpServletRequest, HttpServletResponse)): this.__Tag == net/sourceforge/pebble/web/controller/XmlRpcController
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:org.apache.xmlrpc.XmlRpcServer
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:net.sourceforge.pebble.web.controller.XmlRpcController:getServletContext
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:org.springframework.web.context.support.WebApplicationContextUtils:getWebApplicationContext
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:org.springframework.context.ApplicationContext:getBean
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:org.apache.xmlrpc.XmlRpcServer:addHandler
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:javax.servlet.http.HttpServletRequest:getInputStream
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:org.apache.xmlrpc.XmlRpcServer:execute
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:javax.servlet.http.HttpServletResponse:setContentType
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:javax.servlet.http.HttpServletResponse:setContentLength
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:javax.servlet.http.HttpServletResponse:getOutputStream
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.io.OutputStream:write
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.io.OutputStream:flush
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.lang.Exception:printStackTrace
    //#unanalyzed(void doGet(HttpServletRequest, HttpServletResponse)): Effects-of-calling:javax.servlet.ServletException
  }
    //#xmlrpccontroller.java:110: end of method: void net.sourceforge.pebble.web.controller.XmlRpcController.doGet(HttpServletRequest, HttpServletResponse)

  /**
   * A default implementation of doPost that delegates to the processRequest method.
   *
   * @param req   the HttpServletRequest instance
   * @param res   the HttpServletResponse instance
   */
  protected void doPost(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

    processRequest(req, res);
    //#xmlrpccontroller.java:121: method: void net.sourceforge.pebble.web.controller.XmlRpcController.doPost(HttpServletRequest, HttpServletResponse)
    //#input(void doPost(HttpServletRequest, HttpServletResponse)): __Descendant_Table[net/sourceforge/pebble/web/controller/XmlRpcController]
    //#input(void doPost(HttpServletRequest, HttpServletResponse)): __Descendant_Table[others]
    //#input(void doPost(HttpServletRequest, HttpServletResponse)): __Dispatch_Table.processRequest(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V
    //#input(void doPost(HttpServletRequest, HttpServletResponse)): req
    //#input(void doPost(HttpServletRequest, HttpServletResponse)): res
    //#input(void doPost(HttpServletRequest, HttpServletResponse)): this
    //#input(void doPost(HttpServletRequest, HttpServletResponse)): this.__Tag
    //#pre[1] (void doPost(HttpServletRequest, HttpServletResponse)): req != null
    //#pre[2] (void doPost(HttpServletRequest, HttpServletResponse)): res != null
    //#pre[4] (void doPost(HttpServletRequest, HttpServletResponse)): this.__Tag == net/sourceforge/pebble/web/controller/XmlRpcController
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:org.apache.xmlrpc.XmlRpcServer
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:net.sourceforge.pebble.web.controller.XmlRpcController:getServletContext
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:org.springframework.web.context.support.WebApplicationContextUtils:getWebApplicationContext
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:org.springframework.context.ApplicationContext:getBean
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:org.apache.xmlrpc.XmlRpcServer:addHandler
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:javax.servlet.http.HttpServletRequest:getInputStream
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:org.apache.xmlrpc.XmlRpcServer:execute
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:javax.servlet.http.HttpServletResponse:setContentType
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:javax.servlet.http.HttpServletResponse:setContentLength
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:javax.servlet.http.HttpServletResponse:getOutputStream
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.io.OutputStream:write
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.io.OutputStream:flush
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:java.lang.Exception:printStackTrace
    //#unanalyzed(void doPost(HttpServletRequest, HttpServletResponse)): Effects-of-calling:javax.servlet.ServletException
  }
    //#xmlrpccontroller.java:122: end of method: void net.sourceforge.pebble.web.controller.XmlRpcController.doPost(HttpServletRequest, HttpServletResponse)

}
    //#output(net.sourceforge.pebble.web.controller.XmlRpcController__static_init): __Descendant_Table[net/sourceforge/pebble/web/controller/XmlRpcController]
    //#output(net.sourceforge.pebble.web.controller.XmlRpcController__static_init): __Dispatch_Table.doGet(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V
    //#output(net.sourceforge.pebble.web.controller.XmlRpcController__static_init): __Dispatch_Table.doPost(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V
    //#output(net.sourceforge.pebble.web.controller.XmlRpcController__static_init): __Dispatch_Table.init()V
    //#output(net.sourceforge.pebble.web.controller.XmlRpcController__static_init): __Dispatch_Table.processRequest(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V
    //#post(net.sourceforge.pebble.web.controller.XmlRpcController__static_init): __Descendant_Table[net/sourceforge/pebble/web/controller/XmlRpcController] == &__Dispatch_Table
    //#post(net.sourceforge.pebble.web.controller.XmlRpcController__static_init): __Dispatch_Table.doGet(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V == &doGet
    //#post(net.sourceforge.pebble.web.controller.XmlRpcController__static_init): __Dispatch_Table.doPost(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V == &doPost
    //#post(net.sourceforge.pebble.web.controller.XmlRpcController__static_init): __Dispatch_Table.init()V == &init
    //#post(net.sourceforge.pebble.web.controller.XmlRpcController__static_init): __Dispatch_Table.processRequest(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V == &processRequest
    //#xmlrpccontroller.java:: end of method: net.sourceforge.pebble.web.controller.XmlRpcController.net.sourceforge.pebble.web.controller.XmlRpcController__static_init
    //#xmlrpccontroller.java:: end of class: net.sourceforge.pebble.web.controller.XmlRpcController
