001/** 002 * Copyright 2015 DuraSpace, Inc. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.fcrepo.client.utils; 017 018import java.net.URI; 019 020import org.apache.http.HttpHeaders; 021import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; 022 023/** 024 * HTTP move 025 * 026 * @author sleroux 027 * @since 2015-06-03 028 **/ 029public class HttpMove extends HttpEntityEnclosingRequestBase { 030 031 /** 032 * Create an HTTP MOVE request. 033 * 034 * @param source 035 * Source String URL. 036 * @param destination 037 * Destination String URL. 038 **/ 039 public HttpMove(final String source, final String destination) { 040 this(URI.create(source), URI.create(destination)); 041 } 042 043 /** 044 * Create an HTTP MOVE request. 045 * 046 * @param source 047 * Source URL. 048 * @param destination 049 * Destination URL. 050 **/ 051 public HttpMove(final URI source, final URI destination) { 052 this.setHeader(HttpHeaders.DESTINATION, destination.toASCIIString()); 053 this.setURI(source); 054 } 055 056 /** 057 * Returns the request method. 058 **/ 059 @Override 060 public String getMethod() { 061 return "MOVE"; 062 } 063}