HttpContextConfig.java :  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » runtime » component » http » server » Java Open Source

Java Open Source » ESB » cbesb 1.2 
cbesb 1.2 » com » bostechcorp » cbesb » runtime » component » http » server » HttpContextConfig.java
/*
 * ChainBuilder ESB
 *     Visual Enterprise Integration
 * 
 * Copyright (C) 2007 Bostech Corporation
 * 
 * This program is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU General Public License as published by the 
 * Free Software Foundation; either version 2 of the License, or (at your option) 
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License along with 
 * this program; if not, write to the Free Software Foundation, Inc., 
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 *
 * $Id: HttpContextConfig.java 8702 2007-08-23 21:02:31Z mpreston $
 */
package com.bostechcorp.cbesb.runtime.component.http.server;

public class HttpContextConfig {

  protected String contextPath;
  protected boolean soap;
  
  public HttpContextConfig() {
    
  }
  
  public HttpContextConfig(String url) {
    initFromURL(url);
  }
  
  private void initFromURL(String url) {
    int index = url.indexOf("://") + 3;
    
    int index2 = url.indexOf('/', index);
    if (index2 == -1) {
      this.contextPath = "/";
    } else {
      this.contextPath = url.substring(index2);
    }
    if (this.contextPath.endsWith("/")) {
      this.contextPath = this.contextPath.substring(0, this.contextPath.length() - 1);
    }
  }

  /**
   * @return the contextPath
   */
  public String getContextPath() {
    return contextPath;
  }

  /**
   * @param contextPath the contextPath to set
   */
  public void setContextPath(String contextPath) {
    this.contextPath = contextPath;
  }

  /**
   * @return the soap
   */
  public boolean isSoap() {
    return soap;
  }

  /**
   * @param soap the soap to set
   */
  public void setSoap(boolean soap) {
    this.soap = soap;
  }

}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.