W3C home > Mailing lists > Public > www-jigsaw@w3.org > May to June 1998

Re: VirtualHost Probs

From: Yves Lafon <ylafon@w3.org>
Date: Fri, 5 Jun 1998 11:49:44 +0200 (MET DST)
To: Stefan Speidel <Speidel@tp-cad.com>
cc: "www-jigsaw@w3.org" <www-jigsaw@w3.org>
Message-ID: <Pine.GSO.3.96.980605114242.21763A-201000@tarantula.inria.fr>
On Thu, 4 Jun 1998, Stefan Speidel wrote:

> Hi,
> 
> when I access to a VirtualHostResource for example
> http://www.dasradioantenne.de:8001/spiel1/ I get the Dir-Listing. But
> When I access to http://www.dasradioantenne.de:8001/spiel1 (without
> tailing '/') the server tells me:
> Can't access to
> http://www.dasradioantenne.de:8001/www.dasradioantenne.de:8001/spiel1/
> 
> The same is when I pick a file out of the Dir-Listing.
> (I have this error under Jigsaw 1.0xx and 2.0beta1)
> What's wrong?

Well, the beginning of the URL was wrong because of the resource in the
virtualhost holder (the resource with the VirtualHostFrame). It is now
fixed with the VirtualHostResource which force the base URL of its
children to '/'.

Attached are the source and the .class of the new VirtualHostResource you
must use.

You will have to create your virtual holder again. The resource class will
be "org.w3c.jigsaw.resources.VirtualHostResource" instead of
"org.w3c.tools.resources.ContainerResource", then add the
VirtualHostFrame, as in the documentation
(http://www.w3.org/Jigsaw/Doc/User/virtual-hosting.html)
Regards,

      /\          - Yves Lafon - World Wide Web Consortium - 
  /\ /  \                Architecture Domain - Jigsaw
 /  \    \/\    
/    \   /  \   http://www.w3.org/People/Lafon - ylafon@w3.org    


// VirtualHostResource.java
// $Id: VirtualHostResource.java,v 1.11 1998/06/05 09:40:53 ylafon Exp $
// (c) COPYRIGHT MIT and INRIA, 1998.
// Please first read the full copyright statement in file COPYRIGHT.html 
 
package org.w3c.jigsaw.resources; 

import java.lang.*;
import java.util.*;
import org.w3c.tools.resources.* ; 
 
public class VirtualHostResource extends ContainerResource {

    /** 
     * Initialize and register the given resource within that container. 
     * @param name The identifier for the resource. 
     * @param resource An unitialized resource instance. 
     * @param defs A default set of init attribute values (may be 
     * <strong>null</strong>). 
     * @exception InvalidResourceException If an error occurs during 
     * the registration. 
     */ 
 
    public void registerResource(String name, 
				 Resource resource, 
				 Hashtable defs) 
	throws InvalidResourceException 
    { 
	acquireChildren(); 
	// Create a default set of attributes: 
	if ( defs == null ) 
	    defs = new Hashtable(11) ; 
	defs.put("identifier", name); 
	ResourceContext context =  updateDefaultChildAttributes(defs); 
	defs.put("url","/"); // URL defaults to "/"
	if (context != null) { 
	    resource.initialize(defs);
	    ResourceReference rr = getSpace().addResource(
		getChildrenSpaceEntry(), 
		resource,  
		defs); 
	    context.setResourceReference(rr); 
	    if (resource instanceof FramedResource) { 
		FramedResource fres = (FramedResource) resource; 
		fres.addStructureChangedListener(this); 
		// send event 
	    } 
	    markModified(); 
	    throw new InvalidResourceException(getIdentifier(), 
					       name, 
					       "unable to get context"); 
	} 
    }
}


Received on Friday, 5 June 1998 05:49:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:27 GMT