[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-cvs-commits
Subject:    [jboss-cvs] jboss/src/main/org/jboss/invocation/http/server HttpInvoker.java HttpInvokerMBean.java
From:       Scott M Stark <starksm () users ! sourceforge ! net>
Date:       2002-10-31 5:32:40
[Download RAW message or body]

  User: starksm 
  Date: 02/10/30 21:32:40

  Modified:    src/main/org/jboss/invocation/http/server Tag: Branch_3_0
                        HttpInvoker.java HttpInvokerMBean.java
  Log:
  Add invokerURLPrefix, invokerURLSuffix and useHostName that allow one to
  specify the host invariant parts of the http invokerURL with the host
  coming from either InetAddress.getLocalHost name or ip depending on useHostName
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.3   +45 -1     jboss/src/main/org/jboss/invocation/http/server/HttpInvoker.java
  
  Index: HttpInvoker.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/invocation/http/server/HttpInvoker.java,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- HttpInvoker.java	20 Aug 2002 13:38:15 -0000	1.1.4.2
  +++ HttpInvoker.java	31 Oct 2002 05:32:39 -0000	1.1.4.3
  @@ -42,12 +42,15 @@
    * The HttpInvoker ... into the JMX base.
    *
    * @author <a href="mailto:scott.stark@jboss.org>Scott Stark</a>
  - * @version $Revision: 1.1.4.2 $
  + * @version $Revision: 1.1.4.3 $
    */
   public class HttpInvoker extends ServiceMBeanSupport
      implements HttpInvokerMBean
   {
      private String invokerURL;
  +   private String invokerURLPrefix = "http://";
  +   private String invokerURLSuffix = "/invoker/JMXInvokerServlet";
  +   private boolean useHostName = false;
   
      // Public --------------------------------------------------------
   
  @@ -63,9 +66,37 @@
         log.debug("Set invokerURL to "+this.invokerURL);
      }
   
  +   public String getInvokerURLPrefix()
  +   {
  +      return invokerURLPrefix;
  +   }
  +   public void setInvokerURLPrefix(String invokerURLPrefix)
  +   {
  +      this.invokerURLPrefix = invokerURLPrefix;
  +   }
  +
  +   public String getInvokerURLSuffix()
  +   {
  +      return invokerURLSuffix;
  +   }
  +   public void setInvokerURLSuffix(String invokerURLSuffix)
  +   {
  +      this.invokerURLSuffix = invokerURLSuffix;
  +   }
  +
  +   public boolean getUseHostName()
  +   {
  +      return useHostName;
  +   }
  +   public void setUseHostName(boolean flag)
  +   {
  +      this.useHostName = flag;
  +   }
  +
      protected void startService()
         throws Exception
      {
  +      checkInvokerURL();
         InitialContext context = new InitialContext();
         Invoker delegateInvoker = new HttpInvokerProxy(invokerURL);
   
  @@ -168,5 +199,18 @@
      protected Transaction importTPC(Object tpc)
      {
         return null;
  +   }
  +
  +   /** Validate that the invokerURL is set, and if not build it from
  +    * the invokerURLPrefix + host + invokerURLSuffix.
  +    */
  +   protected void checkInvokerURL() throws UnknownHostException
  +   {
  +      if( invokerURL == null )
  +      {
  +         InetAddress addr = InetAddress.getLocalHost();
  +         String host = useHostName ? addr.getHostName() : addr.getHostAddress();
  +         invokerURL = invokerURLPrefix + host + invokerURLSuffix;
  +      }
      }
   }
  
  
  
  1.1.4.3   +41 -1     jboss/src/main/org/jboss/invocation/http/server/HttpInvokerMBean.java
  
  Index: HttpInvokerMBean.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/invocation/http/server/HttpInvokerMBean.java,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- HttpInvokerMBean.java	20 Aug 2002 13:38:16 -0000	1.1.4.2
  +++ HttpInvokerMBean.java	31 Oct 2002 05:32:40 -0000	1.1.4.3
  @@ -7,13 +7,53 @@
   
   /** The MBean interface for the HTTP invoker.
    @author Scott.Stark@jboss.org
  - @version $Revision: 1.1.4.2 $
  + @version $Revision: 1.1.4.3 $
    */
   public interface HttpInvokerMBean extends ServiceMBean
   {
  +   /** Get the URL string of the servlet that will handle posts from
  +    * the HttpInvokerProxy
  +    */
      public String getInvokerURL();
  +   /** Get the URL string of the servlet that will handle posts from
  +    * the HttpInvokerProxy. For example, http://webhost:8080/invoker/JMXInvokerServlet
  +    */
      public void setInvokerURL(String invokerURL);
   
  +   /** If there is no invokerURL set, then one will be constructed via the
  +    * concatenation of invokerURLPrefix + the local host + invokerURLSuffix.
  +    */
  +   public String getInvokerURLPrefix();
  +   /** If there is no invokerURL set, then one will be constructed via the
  +    * concatenation of invokerURLPrefix + the local host + invokerURLSuffix.
  +    * An example prefix is "http://", and this is the default value.
  +    */
  +   public void setInvokerURLPrefix(String invokerURLPrefix);
  +
  +   /** If there is no invokerURL set, then one will be constructed via the
  +    * concatenation of invokerURLPrefix + the local host + invokerURLSuffix.
  +    */
  +   public String getInvokerURLSuffix();
  +   /** If there is no invokerURL set, then one will be constructed via the
  +    * concatenation of invokerURLPrefix + the local host + invokerURLSuffix.
  +    * An example suffix is "/invoker/JMXInvokerServlet" and this is the default
  +    * value.
  +    */
  +   public void setInvokerURLSuffix(String invokerURLSuffix);
  +
  +   /** A flag if the InetAddress.getHostName() or getHostAddress() method
  +    * should be used as the host component of invokerURLPrefix + host +
  +    * invokerURLSuffix. If true getHostName() is used, false getHostAddress().
  +    */
  +   public boolean getUseHostName();
  +   /** A flag if the InetAddress.getHostName() or getHostAddress() method
  +    * should be used as the host component of invokerURLPrefix + host +
  +    * invokerURLSuffix. If true getHostName() is used, false getHostAddress().
  +    */
  +   public void setUseHostName(boolean flag);
  +
  +   /** The invoker JMX method
  +   */
      public Object invoke(Invocation invocation)
         throws Exception;
   }
  
  
  


-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic