Cuplikan KivaKit #7

Jan 03 2023
Lebih lanjut tentang KivaKit https://state-of-the-art.org/https://www.
Kode

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; } } }

Lebih lanjut tentang KivaKit

https://state-of-the-art.org/
https://www.kivakit.org/

Artikel Terkait

Cuplikan KivaKit #1
Cuplikan KivaKit #2
Cuplikan KivaKit #3

Enam Alasan Mengapa Sebagian Besar Java yang Anda Lihat Bukan Java Asli
Mengapa Host Bukan String dan Port Bukan Integer
Integer Bukan Hitungan
Semuanya Membagi dan Menaklukkan