⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mkcol.java

📁 这是linux下ssl vpn的实现程序
💻 JAVA
字号:
/* ========================================================================== *
 * Copyright (C) 2004-2005 Pier Fumagalli <http://www.betaversion.org/~pier/> *
 *                            All rights reserved.                            *
 * ========================================================================== *
 *                                                                            *
 * Licensed under the  Apache License, Version 2.0  (the "License").  You may *
 * not use this file except in compliance with the License.  You may obtain a *
 * copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>.       *
 *                                                                            *
 * Unless  required  by applicable  law or  agreed  to  in writing,  software *
 * distributed under the License is distributed on an  "AS IS" BASIS, WITHOUT *
 * WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied.  See the *
 * License for the  specific language  governing permissions  and limitations *
 * under the License.                                                         *
 *                                                                            *
 * ========================================================================== */
package com.sslexplorer.vfs.webdav.methods;

import java.io.IOException;

import com.sslexplorer.core.CoreServlet;
import com.sslexplorer.vfs.NetworkPlaceResourceType;
import com.sslexplorer.vfs.webdav.AbstractNetworkPlaceMount;
import com.sslexplorer.vfs.webdav.DAVException;
import com.sslexplorer.vfs.webdav.DAVMethod;
import com.sslexplorer.vfs.webdav.DAVResource;
import com.sslexplorer.vfs.webdav.DAVTransaction;

/**
 * <p>
 * <a href="http://www.rfc-editor.org/rfc/rfc2518.txt">WebDAV</a>
 * <code>MKCOL</code> metohd implementation.
 * </p>
 * 
 * @author <a href="http://www.betaversion.org/~pier/">Pier Fumagalli</a>
 */
public class MKCOL implements DAVMethod {

    /**
     * <p>
     * Create a new {@link MKCOL} instance.
     * </p>
     */
    public MKCOL() {
        super();
    }

    /**
     * <p>
     * Process the <code>MKCOL</code> method.
     * </p>
     */
    public void process(DAVTransaction transaction, DAVResource resource) throws IOException {

        try {
            transaction.setHeader("content-type", "application/octet-stream");
            /*
             * Unsupported media type, we don't want content
             */
            if (transaction.read() != null)
                throw new DAVException(415, "No request body allowed in request");

            /* Create the collection */
            resource.makeCollection();
            transaction.setStatus(201);
            // #ifdef XTRA
            if (resource.getMount().getStore().isFireEvents()) {
                CoreServlet.getServlet().fireCoreEvent(
                    NetworkPlaceResourceType.getResourceAccessMkDirEvent(this, ((AbstractNetworkPlaceMount) resource.getMount())
                                    .getNetworkPlace(), transaction.getRequest(), resource.getFullURI().getPath(), resource
                                    .getFile().getName().getURI(), null));
            }
            // #endif
        } catch (Exception e) {
            if (resource.getMount().getStore().isFireEvents()) {
                CoreServlet.getServlet().fireCoreEvent(
                    NetworkPlaceResourceType.getResourceAccessMkDirEvent(this, ((AbstractNetworkPlaceMount) resource.getMount())
                                    .getNetworkPlace(), transaction.getRequest(), resource.getFullURI().getPath(), resource
                                    .getFile().getName().getURI(), e));
            }
            // #endif
            IOException ioe = new IOException(e.getMessage());
            ioe.initCause(e);
            throw ioe;
        }
    }
}

⌨️ 快捷键说明

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