001/*
002 * ====================================================================
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *   http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied.  See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 * ====================================================================
020 *
021 * This software consists of voluntary contributions made by many
022 * individuals on behalf of the Apache Software Foundation.  For more
023 * information on the Apache Software Foundation, please see
024 * <http://www.apache.org/>.
025 *
026 */
027
028package org.apache.http.client.methods;
029
030import java.net.URI;
031
032/**
033 * HTTP PATCH method.
034 * <p>
035 * The HTTP PATCH method is defined in <a
036 * href="http://tools.ietf.org/html/rfc5789">RF5789</a>:
037 * </p>
038 * <blockquote> The PATCH
039 * method requests that a set of changes described in the request entity be
040 * applied to the resource identified by the Request- URI. Differs from the PUT
041 * method in the way the server processes the enclosed entity to modify the
042 * resource identified by the Request-URI. In a PUT request, the enclosed entity
043 * origin server, and the client is requesting that the stored version be
044 * replaced. With PATCH, however, the enclosed entity contains a set of
045 * instructions describing how a resource currently residing on the origin
046 * server should be modified to produce a new version.
047 * </blockquote>
048 *
049 * @since 4.2
050 */
051public class HttpPatch extends HttpEntityEnclosingRequestBase {
052
053    public final static String METHOD_NAME = "PATCH";
054
055    public HttpPatch() {
056        super();
057    }
058
059    public HttpPatch(final URI uri) {
060        super();
061        setURI(uri);
062    }
063
064    public HttpPatch(final String uri) {
065        super();
066        setURI(URI.create(uri));
067    }
068
069    @Override
070    public String getMethod() {
071        return METHOD_NAME;
072    }
073
074}