001/** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.activemq.web; 018 019/** 020 * Bean to initialize the port number we use for embedded Jetty server for the web consoles. 021 */ 022public class WebConsolePort { 023 024 public static final String DEFAULT_HOST = "0.0.0.0"; 025 public static final int DEFAULT_PORT = 8161; 026 027 private int port = DEFAULT_PORT; 028 private String host = DEFAULT_HOST; 029 030 public int getPort() { 031 return port; 032 } 033 034 public void setPort(int port) { 035 this.port = port; 036 } 037 038 public String getHost() { 039 return host; 040 } 041 042 public void setHost(String host) { 043 this.host = host; 044 } 045 046 public void start() { 047 // you may set a JVM system property for the jetty.port 048 String port = System.getProperty("jetty.port", "" + this.port); 049 System.setProperty("jetty.port", port); 050 String host = System.getProperty("jetty.host", "" + this.host); 051 System.setProperty("jetty.host", host); 052 } 053}