All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.genexus.specific.java.HttpOptionsWithBody Maven / Gradle / Ivy

Go to download

Core classes for the runtime used by Java and Android apps generated with GeneXus

There is a newer version: 4.7.3
Show newest version
package com.genexus.specific.java;

import org.apache.http.Header;
import org.apache.http.HeaderElement;
import org.apache.http.HeaderIterator;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.util.Args;

import java.net.URI;
import java.util.HashSet;
import java.util.Set;

public class HttpOptionsWithBody extends HttpEntityEnclosingRequestBase {
	public static final String METHOD_NAME = "OPTIONS";

	public String getMethod() {
		return METHOD_NAME;
	}

	public Set getAllowedMethods(HttpResponse response) {
		Args.notNull(response, "HTTP response");
		HeaderIterator it = response.headerIterator("Allow");
		HashSet methods = new HashSet();

		while(it.hasNext()) {
			Header header = it.nextHeader();
			HeaderElement[] elements = header.getElements();
			HeaderElement[] arr$ = elements;
			int len$ = elements.length;

			for(int i$ = 0; i$ < len$; ++i$) {
				HeaderElement element = arr$[i$];
				methods.add(element.getName());
			}
		}

		return methods;
	}

	public HttpOptionsWithBody(final String uri) {
		super();
		setURI(URI.create(uri));
	}

	public HttpOptionsWithBody(final URI uri) {
		super();
		setURI(uri);
	}

	public HttpOptionsWithBody() {
		super();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy