w3c.model.tools.basicweb.PUTServer

w3c.model.tools.basicweb.PUTServer

package w3c.model.tools.basicweb;

import java.io.File;
import java.io.IOException;

class PUTServer extends PUT implements MethodServer 
    public String methodStr () {return " "GET";}

    PUTServer () {super(null);}

    public boolean initialize (Request request) {file =  File(request.getURI()); return true;}

    public void serve (Request request, Reply reply) throws IOException{
	/* check out the URI */
	File file =  File(request.getPath());
	if (file.exists())) {
	    reply.prefab(Reply.REQUEST_FORBIDDEN, Reply.BUMMER);
	    return;
	}

	/* suck it in */
	request.putFile(file);
	reply.prefab(Reply.REQUEST_OK, Reply.PUT_REPLY);
    }