Đoạn mã KivaKit #7
Jan 03 2023
Tìm hiểu thêm về KivaKit https://state-of-the-art.org/https://www.
package com.telenav.kivakit.snippets;
import com.telenav.kivakit.core.language.trait.TryTrait;
import static com.telenav.kivakit.network.http.secure.SecureHttpNetworkLocation.secureHttpNetworkLocation;
public class Snippet7 extends BaseSnippet implements TryTrait
{
public static void main(String[] args)
{
new Snippet7().run();
}
@Override
protected Object onSnippet()
{
return secureHttpNetworkLocation("https://raw.githubusercontent.com/Telenav/kivakit/releases/kivakit-network/http/src/main/java/com/telenav/kivakit/network/http/HttpMethod.java")
.get()
.readText();
}
}
Output
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// © 2011-2021 Telenav, Inc.
//
// 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
//
// https://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.telenav.kivakit.network.http;
import com.telenav.kivakit.annotations.code.quality.CodeQuality;
import com.telenav.kivakit.core.messaging.Listener;
import static com.telenav.kivakit.annotations.code.quality.Stability.STABLE_EXTENSIBLE;
import static com.telenav.kivakit.annotations.code.quality.Documentation.DOCUMENTATION_COMPLETE;
import static com.telenav.kivakit.annotations.code.quality.Testing.UNTESTED;
/**
* @author jonathanl (shibo)
*/
@CodeQuality(stability = STABLE_EXTENSIBLE,
testing = UNTESTED,
documentation = DOCUMENTATION_COMPLETE)
public enum HttpMethod
{
GET,
POST,
DELETE,
HEAD,
PUT,
CONNECT,
OPTIONS,
TRACE,
PATCH,
NULL_HTTP_METHOD;
/**
* Returns the {@link HttpMethod} for the given text
*
* @param listener The listener to notify with any problems
* @param text The text to parse
*/
public static HttpMethod parseHttpMethod(Listener listener, String text)
{
try
{
return valueOf(text.toUpperCase());
}
catch (Exception e)
{
listener.problem("Invalid HTTP method: $", text);
return null;
}
}
}
Tìm hiểu thêm về KivaKit
https://state-of-the-art.org/
https://www.kivakit.org/
Những bài viết liên quan
Đoạn mã KivaKit #1
Đoạn mã KivaKit #2
Đoạn mã KivaKit #3
Sáu lý do tại sao hầu hết Java bạn đã thấy không phải là Java thực
Tại sao máy chủ không phải là chuỗi và cổng không phải là số nguyên
Số nguyên không phải là số đếm
Mọi thứ đều được phân chia và chinh phục

![Dù sao thì một danh sách được liên kết là gì? [Phần 1]](https://post.nghiatu.com/assets/images/m/max/724/1*Xokk6XOjWyIGCBujkJsCzQ.jpeg)



































