KivaKit Extrait #7
Jan 03 2023
En savoir plus sur 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;
}
}
}
En savoir plus sur KivaKit
https://state-of-the-art.org/
https://www.kivakit.org/
Articles Liés
Extrait KivaKit #1
Extrait KivaKit #2
Extrait KivaKit #3
Six raisons pour lesquelles la plupart des Java que vous avez vus ne sont pas du vrai Java
Pourquoi un hôte n'est pas une chaîne et un port n'est pas un entier
Un entier n'est pas un compte
Tout est diviser pour régner
![Qu'est-ce qu'une liste liée, de toute façon? [Partie 1]](https://post.nghiatu.com/assets/images/m/max/724/1*Xokk6XOjWyIGCBujkJsCzQ.jpeg)



































