Package org.w3c.jigsaw.http

Examples of org.w3c.jigsaw.http.httpd


     * @return An URL, encoded as a String, or <strong>null</strong> if not
     * available.
     */

    public String getHelpURL() {
  httpd server = (httpd) getServer();
  if ( server == null )
      return null;
  String docurl = server.getDocumentationURL();
  if ( docurl == null )
      return null;
  return docurl + "/" + getClass().getName() + ".html";
    }
View Full Code Here


     * @param topic The topic (can be an attribute name, or a property, etc).
     * @return A String encoded URL, or <strong>null</strong>.
     */

    public String getHelpURL(String topic) {
  httpd server = (httpd) getServer();
  if ( server == null )
      return null;
  String docurl = server.getDocumentationURL();
  if ( docurl == null )
      return null;
  Class defines = AttributeRegistry.getAttributeClass(getClass(), topic);
  if ( defines != null )
      return docurl + "/" + defines.getName() + ".html";
View Full Code Here

  super.registerOtherResource(resource);
  this.props = getResource().getServer().getProperties();
  synchronized(this.getClass()) {
      if (!inited) {
    // Register the client side properties (if still needed):
    httpd server = (httpd) getServer();
    server.registerPropertySet(new ProxyProp("proxy", server));
    inited = true;
      }
  }
  manager = org.w3c.www.protocol.http.HttpManager.getManager(props);
    }
View Full Code Here

    {
  Reply        reply  = (Reply) performFrames(req);
  if (reply != null)
      return reply;
  Request request = (Request) req;
  httpd    server = (httpd) getServer();
  String     host = request.getHost();
  request.setState(Request.ORIG_URL_STATE, request.getURL());
  request.setState(JigsawRequestDispatcher.REQUEST_URI_P,
       getRequestURI(request));
  request.setState(JigsawRequestDispatcher.QUERY_STRING_P,
       request.getQueryString());
  request.setState(JigsawRequestDispatcher.SERVLET_PATH_P, getURLPath());
  try {
      String target = null;
      if (request.hasQueryString())
    target = getTarget()+"?"+request.getQueryString();
      else
    target = getTarget();

      if (host == null) {
    request.setURL(new URL(server.getURL(), target));
      } else {
    int ic = host.indexOf(':');
    // we will take care of '[' later (ipv6 address)
    if ( ic < 0 ) {
        request.setURL(new URL(server.getURL().getProtocol(),
             host, target));
    } else {
        request.setURL(new URL(server.getURL().getProtocol(),
             host.substring(0, ic),
             Integer.parseInt(
                 host.substring(ic+1)),
             target));
    }
      }
      request.setInternal(true);
  } catch (MalformedURLException ex) {
      Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR);
      error.setContent("<html><head><title>Server Error</title>"+
           "</head><body><h1>Server misconfigured</h1>"+
           "<p>The resource <b>"+getIdentifier()+"</b>"+
           "has an invalid target attribute : <p><b>"+
           getTarget()+"</b></body></html>");     
      throw new HTTPException (error);
  }
  return server.perform(request);
    }
View Full Code Here

      }
      if (code != null) { // remote or not ??
    ResourceReference r_wrapper =
        (ResourceReference)wrappers.get(code);
    if (r_wrapper == null) { //lookup for wrapper
        httpd server =
      (httpd) ssiframe.getFileResource().getServer();
        ResourceReference rr_root = server.getRootReference();
        try {
      FramedResource root = (FramedResource) rr_root.lock();
      LookupState ls = new LookupState(code);
      LookupResult lr = new LookupResult(rr_root);
      ResourceReference wrap = null;
View Full Code Here

           + " command attribute");
      throw new HTTPException(error);
  }
  // Ok:
  Vector      env       = new Vector(32) ;
  httpd       server    = request.getClient().getServer() ;
  InetAddress sadr      = server.getInetAddress() ;
  // Specified environment variables:
  // We do not handle the following variables:
  // - REMOTE_IDENT: would require usage of IDENT protocol.
  // Authentification type, if any:
  String svalue = (String) request.getState(AuthFilter.STATE_AUTHTYPE);
  if ( svalue != null )
      addEnv("AUTH_TYPE", svalue, env);
  // Content length, if available:
  svalue = request.getValue("content-length");
  if ( svalue != null )
      addEnv("CONTENT_LENGTH", svalue, env);
  // Content type, if available:
  svalue = request.getValue("content-type");
  if ( svalue != null )
      addEnv("CONTENT_TYPE", svalue, env);
  // The gateway interface, hopefully 1.1 !
  addEnv ("GATEWAY_INTERFACE", "CGI/1.1", env) ;
  // The PATH_INFO, which I am afraid I still don't understand:
  svalue = (String) request.getState(STATE_EXTRA_PATH);
  if ( svalue == null )
      addEnv ("PATH_INFO", "/", env) ;
  else
      addEnv ("PATH_INFO", svalue, env) ;
  // The query string:
  query = request.getQueryString();
  if ( query != null )
      addEnv("QUERY_STRING", query, env) ;
  // The remote client IP address:
  svalue = request.getClient().getInetAddress().toString();
  addEnv ("REMOTE_ADDR", svalue, env);
  // Authentified user:
  svalue = (String) request.getState(AuthFilter.STATE_AUTHUSER);
  if ( svalue != null )
      addEnv("REMOTE_USER", svalue, env);
  // Remote host name, if allowed:
  if ( checkRemoteHost() ) {
      String host = request.getClient().getInetAddress().getHostName();
      addEnv("REMOTE_HOST", host, env);
  }
  // The request method:
  addEnv ("REQUEST_METHOD", request.getMethod(), env) ;
  // The script name :
  addEnv("SCRIPT_NAME", getURLPath(), env);
  // Server name:
  addEnv ("SERVER_NAME", getServer().getHost(), env) ;
  // Server port:
  svalue = Integer.toString(getServer().getLocalPort());
  addEnv ("SERVER_PORT", svalue, env);
  // Server protocol:
  addEnv ("SERVER_PROTOCOL", request.getVersion(), env) ;
  // Server software:
  addEnv ("SERVER_SOFTWARE", server.getSoftware(), env) ;
  if (getFileResource()!= null) {
      addEnv("PATH_TRANSLATED",
       getFileResource().getFile().getAbsolutePath(), env);
  }
View Full Code Here

     */
    public void registerResource(FramedResource resource) {
  super.registerOtherResource(resource);
  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

     * @param name The name of the property that has changed.
     * @return A boolean, <strong>true</strong> if we updated ourself
     *    successfully.
     */
    public boolean propertyChanged (String name) {
  httpd s = server;
  if ( name.equals(MINSPARE_FREE_P) ) {
      minFree = props.getInteger(MINSPARE_FREE_P, minFree);
  } else if ( name.equals(MAXSPARE_FREE_P) ) {
      maxFree = props.getInteger(MAXSPARE_FREE_P, maxFree);
  } else if ( name.equals(MAXSPARE_IDLE_P) ) {
View Full Code Here

     */
    public void registerResource(FramedResource resource) {
  super.registerResource(resource);
  if (getPageCompileProps() == 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 PageCompileProp(s));
    }
      }
  }
  File generatedClassDir =
      getPageCompileProps().getCompiledPageDirectory();
View Full Code Here

      }
      if (!affected) {
    return super.perform(request);
      }
  }
  httpd    server = (httpd) getServer();
  String     host = request.getHost();
  // why this??? commenting while investigating
        //request.setReferer(getURLPath());
  try {
      String target = null;
      String pathinfo = (String) request.getState(PATH_INFO);
      if (pathinfo != null)
    target = getTarget()+pathinfo;
      else
    target = getTarget();

      if (request.hasQueryString())
    target += "?"+request.getQueryString();

      // save the original URL
      request.setState(Request.ORIG_URL_STATE, request.getURL());
      // and mark content location
      request.setState(STATE_CONTENT_LOCATION, "true");
      if (host == null) {
    request.setURL(new URL(server.getURL(), target));
      } else {
//    URL newurl = new URL (new URL(server.getURL().getProtocol(),
//                host,
//                server.getURL().getFile()),
//              target);
    URL newurl = new URL(request.getURL(), target);
    String newhost = null;
    if (newurl.getPort() != -1 &&
        (newurl.getProtocol().equalsIgnoreCase("http") &&
      (newurl.getPort() != 80))) {
        newhost = newurl.getHost() + ":" + newurl.getPort();
    } else {
        newhost = newurl.getHost();
    }
    request.setURL(newurl);
    request.setHost(newhost);
      }
  } catch (MalformedURLException ex) {
      Reply error = request.makeReply(HTTP.INTERNAL_SERVER_ERROR);
      error.setContent("<html><head><title>Server Error</title>"+
           "</head><body><h1>Server misconfigured</h1>"+
           "<p>The resource <b>"+getIdentifier()+"</b>"+
           "has an invalid target attribute : <p><b>"+
           getTarget()+"</b></body></html>");     
      throw new HTTPException (error);
  }
  return server.perform(request);
    }
View Full Code Here

TOP

Related Classes of org.w3c.jigsaw.http.httpd

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.