1 7 package org.jboss.webservice.server; 8 9 11 import org.jboss.logging.Logger; 12 import org.jboss.mx.util.MBeanServerLocator; 13 import org.jboss.webservice.AxisServiceMBean; 14 import org.jboss.webservice.PortComponentInfo; 15 16 import javax.management.MBeanServer ; 17 import javax.servlet.ServletException ; 18 import javax.servlet.http.HttpServlet ; 19 import javax.servlet.http.HttpServletRequest ; 20 import javax.servlet.http.HttpServletResponse ; 21 import java.io.IOException ; 22 import java.io.PrintWriter ; 23 24 42 public class PortComponentLinkServlet extends HttpServlet 43 { 44 private static final Logger log = Logger.getLogger(PortComponentLinkServlet.class); 46 47 50 protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException , IOException 51 { 52 String serviceID = req.getParameter("serviceID"); 53 if (serviceID == null) 54 throw new IllegalArgumentException ("Cannot obtain request parameter 'serviceID'"); 55 56 PortComponentInfo pcInfo = null; 57 try 58 { 59 MBeanServer server = MBeanServerLocator.locateJBoss(); 60 pcInfo = (PortComponentInfo)server.invoke(AxisServiceMBean.OBJECT_NAME, "getPortComponentInfo", 61 new Object []{serviceID}, new String []{String .class.getName()}); 62 } 63 catch (Exception e) 64 { 65 throw new ServletException (e); 66 } 67 68 if (pcInfo == null) 69 throw new IllegalStateException ("Cannot resolve port-component-link: " + serviceID); 70 71 res.setContentType("text/plain"); 72 PrintWriter out = res.getWriter(); 73 74 String serviceEndpointURL = pcInfo.getServiceEndpointURL(); 75 out.println(serviceEndpointURL); 76 77 log.debug("Resolved " + serviceID + " to: " + serviceEndpointURL); 78 79 out.close(); 80 } 81 } 82 | Popular Tags |