Package org.w3c.util

Examples of org.w3c.util.ObservableProperties


    && (requrl.getPort() == url.getPort())
    && (vias != null && vias.length > 5)) {
    // maybe a loop, let's try to sort it out with an expensive
    // checking on IPs
    String hostaddr = null;
    ObservableProperties props = getServer().getProperties();
    hostaddr = props.getString(SocketClientFactory.BINDADDR_P,
             default_hostaddr);
    if (requrl != null) {
        InetAddress targhost;
        String reqhostaddr;
       
View Full Code Here


   return props.getString(ServletProps.SERVLET_COOKIE_NAME,
        ServletProps.DEFAULT_COOKIE_NAME);
    }

    protected Cookie createCookie() {
  ObservableProperties props =
      request.getClient().getServer().getProperties();
  String name     = props.getString(ServletProps.SERVLET_COOKIE_NAME,
            ServletProps.DEFAULT_COOKIE_NAME);
  String path     = props.getString(ServletProps.SERVLET_COOKIE_PATH,
            "/");
  String domain   = props.getString(ServletProps.SERVLET_COOKIE_DOMAIN,
            null);
  String comment  = props.getString(ServletProps.SERVLET_COOKIE_COMMENT,
            null);
  int maxage      = props.getInteger(ServletProps.SERVLET_COOKIE_MAXAGE,
             -1);
  boolean secure  = props.getBoolean(ServletProps.SERVLET_COOKIE_SECURE,
             isSecure());

  Cookie cookie = new Cookie(name, null);
  cookie.setPath(path);
  cookie.setMaxAge(maxage);
View Full Code Here

      timer.stopEventManager() ;
      System.out.println (getIdentifier()+": " + getURL() + " done.") ;
      System.out.flush() ;
  // Keep the data neede to reinit (in case needed)
      File init_propfile = props.getFile(PROPS_P, null);
      ObservableProperties init_props = props ;
      String init_identifier = identifier ;
      // Release pointed data:
      identifier = null ;
      manager    = null ;
      factory    = null ;
View Full Code Here

    // System.out.println ("unknown option: ["+args[i]+"]") ;
    // System.exit (1) ;
      }
  }
  // Get the properties for this server:
  ObservableProperties props = null;
  props = new ObservableProperties(System.getProperties()) ;
  // Get the root and configuration directories:
  File root   = ((cmdroot == null)
           ? new File(props.getProperty("user.dir", null))
           : new File(cmdroot));
  File config = new File(root, cmdconfig);
  // Locate the property file:
  if (cmdprop == null) {
      // Try to guess it, cause it is really required:
      File guess = new File (config, cmdid+".props");
      if ( ! guess.exists() )
    // A hack for smooth upgrade from 1.0alpha3 to greater:
    guess = new File(config, "httpd.props");
      cmdprop = guess.getAbsolutePath() ;
  }
  if ( cmdprop != null ) {
      System.out.println ("loading properties from: " + cmdprop) ;
      try {
    File propfile = new File(cmdprop) ;
    props.load(new FileInputStream(propfile)) ;
    props.put (PROPS_P, propfile.getAbsolutePath()) ;
      } catch (FileNotFoundException ex) {
    System.out.println ("Unable to load properties: "+cmdprop);
    System.out.println ("\t"+ex.getMessage()) ;
    System.exit (1) ;
      } catch (IOException ex) {
    System.out.println ("Unable to load properties: "+cmdprop);
    System.out.println ("\t"+ex.getMessage()) ;
    System.exit (1) ;
      }
      System.setProperties (props) ;
  }
  // Check for an upgrade:
  int configvers = props.getInteger(httpd.VERSCOUNT_P, 1);
  if (configvers < httpd.verscount) {
      System.err.println("+ Jigsaw needs upgrade from internal version "+
             configvers+
             " to " + httpd.verscount);
      if ( noupgrade ) {
    System.err.println("+ Jigsaw cannot run in that version.");
    System.exit(1);
      }
      // upgrade(configvers, httpd.verscount, args);
      return;
  }
  // Override properties with our command line options:
  if ( cmdport != null )
      props.put (PORT_P, cmdport.toString()) ;
  if ( cmdhost != null )
      props.put (HOST_P, cmdhost) ;
  if ( cmdroot != null )
      props.put (ROOT_P, root.getAbsolutePath()) ;
  if ( cmdconfig != null )
      props.put(CONFIG_P, config.getAbsolutePath());
  if ( cmdspace != null )
      props.put (SPACE_P, cmdspace) ;
  if ( cmdtrace != null ) {
      props.put (TRACE_P, "true") ;
      props.put (CLIENT_DEBUG_P, "true") ;
  }
  if (maxstores != null)
      props.put (MAX_LOADED_STORE_P, maxstores);

  // Install security manager if needed:
  if (Boolean.getBoolean(USE_SM_P)) {
      SecurityManager sm = new httpdSecurityManager() ;
      System.setSecurityManager (sm) ;
View Full Code Here

  if (getServletProps() == null ) {
      synchronized (this.getClass()) {
    httpd s = (httpd) getServer();
    if ( s != null ) {
        // Register the property sheet if not done yet:
        ObservableProperties props = s.getProperties() ;
        s.registerPropertySet(new ServletProps(s));
    }
      }
  }
    }
View Full Code Here

  if ( cls != null ) {
      // This is a fresh new server handler:
      try {
    Class c = Class.forName(cls);
    server  = (ServerHandler) c.newInstance();
    ObservableProperties p = props.loadPropertySpace(id);
    this.fixProperties(p);
    server.initialize(this, id, p);
      } catch (FileNotFoundException ex) {
    error("Unable to launch "+id+", no properties found:"
          + ex.getMessage());
View Full Code Here

      } else if (flt[i].equals(
           "org.w3c.www.protocol.http.cache.CacheFilter")) {
    if (server.getPropertySet(CACHE_PROP_NAME) == null) {
        p = new CacheProp(CACHE_PROP_NAME, server);
        server.registerPropertySet(p);
        ObservableProperties props = server.getProperties();
        File c =
      props.getFile(CacheStore.CACHE_DIRECTORY_P, null);
        if ( c == null ) {
      c = new File(server.getConfigDirectory(),
             "cache");
      props.putValue(CacheStore.CACHE_DIRECTORY_P,
               c.getAbsolutePath());
        }
    }
      } else if (flt[i].equals(
       "org.w3c.www.protocol.http.proxy.ProxyDispatcher")) {
View Full Code Here

    continue;
      if ( managers[i].sameProperties(p) )
    return managers[i].getManager();
  }
  // Get the props we will initialize from:
  ObservableProperties props = null;
  if ( p instanceof ObservableProperties )
      props = (ObservableProperties) p;
  else
      props = new ObservableProperties(p);
  // Create a new manager for this set of properties:
  HttpManager manager = null;;
  try {
      Object o = managerclass.newInstance();
      if (o instanceof HttpManager) {
    manager = (HttpManager) o;
      } else { // default value
    manager = new HttpManager();
      }
  } catch (Exception ex) {
      ex.printStackTrace();
      manager = new HttpManager();
  }
  manager.props = props;
  // Initialize this new manager filters:
  String filters[] = props.getStringArray(FILTERS_PROP_P, null);
  if ( filters != null ) {
      for (int i = 0 ; i < filters.length ; i++) {
    try {
        Class c = Class.forName(filters[i]);
        PropRequestFilter f = null;
        f = (PropRequestFilter) c.newInstance();
        f.initialize(manager);
    } catch (PropRequestFilterException ex) {
        System.out.println("Couldn't initialize filter \""
               + filters[i]
               + "\" init failed: "
                                       + ex.getMessage());
    } catch (Exception ex) {
        System.err.println("Error initializing prop filters:");
        System.err.println("Coulnd't initialize ["
                                       + filters[i]
               + "]: " + ex.getMessage());
        ex.printStackTrace();
        System.exit(1);
    }
      }
  }
  // The factory to create MIME reply holders:
  manager.factory = manager.getReplyFactory();
  // The class to create HttpServer instances from
  String c = props.getString(SERVER_CLASS_P, DEFAULT_SERVER_CLASS);
  try {
    manager.serverclass = Class.forName(c);
  } catch (Exception ex) {
      System.err.println("Unable to initialize HttpManager: ");
      System.err.println("Class \""+c+"\" not found, from property "
                               + SERVER_CLASS_P);
      ex.printStackTrace();
      System.exit(1);
  }
  // Setup the template request:
  Request tpl = manager.template;
  // Set some default headers value (from props)
  // Check for a proxy ?
  manager.updateProxy();
  // CacheControl, only-if-cached
  tpl.setOnlyIfCached(props.getBoolean(ONLY_IF_CACHED_P, false));
  // CacheControl, maxstale
  int ival = props.getInteger(MAX_STALE_P, -1);
  if ( ival >= 0 )
      tpl.setMaxStale(ival);
  // CacheControl, minfresh:
  ival = props.getInteger(MIN_FRESH_P, -1);
  if ( ival >= 0 )
      tpl.setMinFresh(ival);
  // general, lenient
  manager.lenient = props.getBoolean(LENIENT_P, true);
  manager.keepbody = props.getBoolean(KEEPBODY_P, false);
  // General, User agent
  String sval;
  tpl.setValue("user-agent"
         , props.getString(USER_AGENT_P
               , DEFAULT_USER_AGENT));
  // General, Accept
  tpl.setValue("accept"
         , props.getString(ACCEPT_P, DEFAULT_ACCEPT));
  // General, Accept-Language
  sval = props.getString(ACCEPT_LANGUAGE_P, null);
  if ( sval != null ) {
      if (sval.trim().length() > 0) {
    tpl.setValue("accept-language", sval);
      }
  }
  // General, Accept-Encoding
  sval = props.getString(ACCEPT_ENCODING_P, null);
  if ( sval != null ) {
      if (sval.trim().length() > 0) {
    tpl.setValue("accept-encoding", sval);
      }
  }
  // Maximum number of allowed connections:
  manager.conn_max = props.getInteger(CONN_MAX_P, 5);
  // timeout value
  manager.timeout = props.getInteger(TIMEOUT_P, manager.timeout);
  // connection timeout
  manager.conn_timeout = props.getInteger(CONN_TIMEOUT_P,
            manager.conn_timeout);
  // Register ourself as a property observer:
  props.registerObserver(manager);
  // Register that manager in our knwon managers:
  for (int i = 0 ; i < managers.length ; i++) {
      if ( managers[i] == null ) {
    managers[i] = new ManagerDescription(manager, p);
    return manager;
View Full Code Here

  if ( ! inited ) {
      synchronized (this.getClass()) {
    httpd s = (httpd) getServer();
    if ( s != null ) {
        // Register the CVS property sheet if not done yet:
        ObservableProperties props = s.getProperties() ;
        s.registerPropertySet(new CvsProp("cvs", s));
        inited = true ;
    }
      }
  }
View Full Code Here

    /**
     * companion to initialize, called after the register
     */
    public void registerResource(FramedResource resource) {
  super.registerResource(resource);
  ObservableProperties props = getResource().getServer().getProperties();
  manager = org.w3c.www.protocol.webdav.DAVManager.getDAVManager(props);
    }
View Full Code Here

TOP

Related Classes of org.w3c.util.ObservableProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.