copymethod.java

来自「这是linux下ssl vpn的实现程序」· Java 代码 · 共 39 行

JAVA
39
字号
package com.maverick.http;

import java.io.IOException;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2005</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class CopyMethod extends HttpMethod {

    String toURI;
    boolean overwrite = false;

    public CopyMethod(String uri, String toURI, boolean overwrite) {
        this("COPY", uri, toURI, overwrite);
    }

    CopyMethod(String name, String uri, String toURI, boolean overwrite) {
        super(name, uri);
        this.toURI = toURI;
        this.overwrite = overwrite;
    }

    public HttpResponse execute(HttpRequest request, HttpConnection con) throws IOException {

        request.setHeaderField("Destination", toURI);
        request.setHeaderField("Overwrite", overwrite ? "T" : "F");
        return super.execute(request, con);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?