RequestBuilder.java

/*
** Module   : RequestBuilder.java
** Abstract : Implementation of the builtin class.
**
** Copyright (c) 2019-2023, Golden Code Development Corporation.
**
** -#- -I- --Date-- ---------------------------------------Description---------------------------------------
** 001 CA  20190526 First version, stubs taken by converting the skeleton using FWD.
** 002 CA  20191023 Fixed the LegacySignature.name for post method.
** 003 CA  20191024 Added method support levels and updated the class support level.
** 005 CA  20200503 Added stub for net.http.RequestBuilder:UsingBasicAuthentication.
** 006 ME  20201029 Fix typeof assert for builder type.
**         20201204 Minor fixes for validation and error messages.
**         20210208 Fix static registry property initialization.
**     CA  20210221 Fixed parameters at the LegacySignature annotation.
** 007 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy signature.
**     ME  20210310 Add block 'referent' for static methods.
**     ME  20210519 Fix registry lazy loading.
**     OM  20210917 Code maintenance.
**     CA  20220120 Do not used TypeFactory.object when the OO reference must not be tracked or registered.
**                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
**                  be tracked.
**                  All TypeFactory.object variable definitions must be done outside of the top-level block.
** 008 CA  20230215 Sanitized the LegacySignature parameters, so their type match their Java method definition.
** 009 CA  20231113 The 'execute' method must be annotated with LegacySignature Type.Execute, and also can be
**                  dropped if is a no-op.
*/

/*
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU Affero General Public License as
** published by the Free Software Foundation, either version 3 of the
** License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU Affero General Public License for more details.
**
** You may find a copy of the GNU Affero GPL version 3 at the following
** location: https://www.gnu.org/licenses/agpl-3.0.en.html
** 
** Additional terms under GNU Affero GPL version 3 section 7:
** 
**   Under Section 7 of the GNU Affero GPL version 3, the following additional
**   terms apply to the works covered under the License.  These additional terms
**   are non-permissive additional terms allowed under Section 7 of the GNU
**   Affero GPL version 3 and may not be removed by you.
** 
**   0. Attribution Requirement.
** 
**     You must preserve all legal notices or author attributions in the covered
**     work or Appropriate Legal Notices displayed by works containing the covered
**     work.  You may not remove from the covered work any author or developer
**     credit already included within the covered work.
** 
**   1. No License To Use Trademarks.
** 
**     This license does not grant any license or rights to use the trademarks
**     Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks
**     of Golden Code Development Corporation. You are not authorized to use the
**     name Golden Code, FWD, or the names of any author or contributor, for
**     publicity purposes without written authorization.
** 
**   2. No Misrepresentation of Affiliation.
** 
**     You may not represent yourself as Golden Code Development Corporation or FWD.
** 
**     You may not represent yourself for publicity purposes as associated with
**     Golden Code Development Corporation, FWD, or any author or contributor to
**     the covered work, without written authorization.
** 
**   3. No Misrepresentation of Source or Origin.
** 
**     You may not represent the covered work as solely your work.  All modified
**     versions of the covered work must be marked in a reasonable way to make it
**     clear that the modified work is not originating from Golden Code Development
**     Corporation or FWD.  All modified versions must contain the notices of
**     attribution required in this license.
*/

package com.goldencode.p2j.oo.net.http;

import com.goldencode.p2j.util.*;
import com.goldencode.p2j.util.BlockManager.Action;
import com.goldencode.p2j.util.BlockManager.Condition;
import com.goldencode.p2j.oo.core.*;
import com.goldencode.p2j.oo.core.collections.*;
import com.goldencode.p2j.oo.json.objectmodel.*;
import com.goldencode.p2j.oo.lang.*;
import com.goldencode.p2j.oo.net.*;
import com.goldencode.p2j.oo.net.http.filter.auth.AuthFilterEventHandlerWrapper;
import com.goldencode.p2j.oo.net.http.filter.auth.IauthFilterEventHandler;
import com.goldencode.p2j.security.*;

import static com.goldencode.p2j.util.BlockManager.*;
import static com.goldencode.p2j.report.ReportConstants.*;
import static com.goldencode.p2j.util.InternalEntry.Type;

import java.util.*;
import java.util.stream.*;

/**
 * Business logic (converted to Java from the 4GL source code in
 * OpenEdge/Net/HTTP/RequestBuilder.cls).
 */
@LegacyResource(resource = "OpenEdge.Net.HTTP.RequestBuilder")
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
public abstract class RequestBuilder extends ConfigBuilder
implements com.goldencode.p2j.oo.core.ISupportInitialize
{
   protected static final String LANG_CLASS = "progress.lang.class";
   protected static final String LANG_OBJECT = "progress.lang.object";
   protected static final String IHTTPREQUEST = "openedge.net.http.ihttprequest";
   protected static final String NET_URI = "openedge.net.uri";
   protected static final String REQUESTBUILDER = "openedge.net.http.requestbuilder";
   protected static final List<String> XML_CONTENT_TYPES_LIST = Collections.unmodifiableList(
         Arrays.asList(
               "application/xml",
               "text/xml",
               "text/xml-external-parsed-entity",
               "application/xml-external-parsed-entity",
               "application/xml-dtd"
         )
   ); 
   protected static final String XML_CONTENT_TYPES = XML_CONTENT_TYPES_LIST.stream().
         collect(Collectors.joining(","));
   protected static final String APPLICATION_JSON = "application/json";
   protected static final String TEXT_HTML = "text/html";
   protected static final String FORM_URLENCODED = "application/x-www-form-urlencoded";

   protected static final String OPTION_METHOD = "method";
   protected static final String OPTION_URI = "uri";
   protected static final String OPTION_ACCEPT_CONTENT_TYPE = "AcceptContentType";
   protected static final String OPTION_VERSION = "version";
   protected static final String OPTION_SUPPORT_AUTHENTICATION = "supportsAuthentication";
   protected static final String OPTION_SUPPORT_PROXY= "supportsProxy";
   protected static final String OPTION_PROXY_URI = "ProxyURI";
   protected static final String OPTION_ENTITY = "entity";
   protected static final String OPTION_EVENT_LISTENER_TYPE= "EventListenerType";
   protected static final String OPTION_AUTH_LISTENER= "Listener";
   protected static final String OPTION_AUTH_CREDENTIALS= "credentials";
   protected static final String OPTION_AUTH_METHOD= "authenticationMethod";
   protected static final String OPTION_AUTH_CHALLENGE= "challenge";
   
   protected static final String HANDLE = "HANDLE";
   protected static final String CHAR = "CHARACTER";
   protected static final String INPUT = "INPUT";
   protected static final String OBJECT = "OBJECT";

   private static ContextLocal<object<? extends BuilderRegistry>> REGISTRY = 
         new ContextLocal<object<? extends BuilderRegistry>>()
   {
      protected object<? extends BuilderRegistry> initialValue()
      {
         return TypeFactory.object(BuilderRegistry.class);
      }
   };
   /**
    * Decorate the request with additional behavior
    * @param _poDecorationType 
    *         The type of decorator to use
    * @param _poDecoratedRequest
    *         The request/instance we're decorating
    *         
    * @return The new, decorating request
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "DecorateRequest", qualified = IHTTPREQUEST, 
         parameters = 
   {
         @LegacyParameter(name = "poDecorationType", type = OBJECT, qualified = LANG_CLASS, 
               mode = INPUT),
         @LegacyParameter(name = "poDecoratedRequest", type = OBJECT, qualified = IHTTPREQUEST, 
               mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends IhttpRequest> decorateRequest(
         final object<? extends LegacyClass> _poDecorationType, 
         final object<? extends IhttpRequest> _poDecoratedRequest)
   {
      object<? extends LegacyClass> poDecorationType = TypeFactory.initInput(_poDecorationType);
      object<? extends IhttpRequest> poDecoratedRequest = TypeFactory.initInput(_poDecoratedRequest);
      object<? extends IhttpRequest> oRequest = TypeFactory.object(IhttpRequest.class);
      
      return function(RequestBuilder.class, "DecorateRequest", object.class, 
            new Block((Body) () -> {
            
            Assert.notNull(poDecoratedRequest, new character("Request"));
            Assert.notNull(poDecorationType, new character("Decoration type"));
            
            if (poDecoratedRequest.ref().getLegacyClass().ref()._isA(poDecorationType)) 
               returnNormal(poDecoratedRequest);
            
            if (poDecoratedRequest.ref() instanceof IAdaptable) {
               object<? extends _BaseObject_> oAdapter = ((IAdaptable) poDecoratedRequest.ref()).getAdapter(poDecorationType);
               if (oAdapter._isValid() && oAdapter.ref().getLegacyClass().ref()._isA(poDecorationType))
                  returnNormal(poDecoratedRequest);
            }
            
            object<? extends LegacyClass> oDecorator = getRegistry().ref().get(poDecorationType.ref().getTypeName());
            if (!oDecorator._isValid())
               returnNormal(poDecoratedRequest);
            
            Assert.isType(oDecorator, ObjectOps.getLegacyClass(HttpRequestDecorator.class));
            
            oRequest.assign(ObjectOps.newInstance(oDecorator.ref().getType(), "I", poDecoratedRequest));
            
            if (oRequest._isValid() && oRequest.ref() instanceof ISupportInitialize)
               ((ISupportInitialize) oRequest.ref()).initialize();
            
            returnNormal(oRequest);
      }));
   }

   /**
    * Adds initial values into the registry
    * 
    * @param _poRegistry
    *        The registry to populate
    */
   @LegacySignature(type = Type.METHOD, name = "InitializeRegistry", parameters = {
            @LegacyParameter(name = "poRegistry", type = OBJECT, qualified = "openedge.net.http.builderregistry", mode = INPUT) })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
   private static void initializeRegistry(final object<? extends BuilderRegistry> _poRegistry)
   {
      internalProcedure(RequestBuilder.class, "InitializeRegistry", new Block((Body) () -> {
         _poRegistry.ref()._put(ObjectOps.getLegacyName(IAuthenticatedRequest.class),
                  ObjectOps.getLegacyClass(AuthenticatedRequest.class));
         _poRegistry.ref()._put(ObjectOps.getLegacyName(IhttpRequest.class),
                  ObjectOps.getLegacyClass(HttpRequest.class));
         _poRegistry.ref()._put(ObjectOps.getLegacyName(ISupportProxy.class),
                  ObjectOps.getLegacyClass(ProxyHttpRequest.class));
         _poRegistry.ref()._put(ObjectOps.getLegacyName(RequestBuilder.class),
                  ObjectOps.getLegacyClass(DefaultRequestBuilder.class));
      }));
   }

   /**
    * Get the registry
    * 
    * @return registry
    */
   @LegacySignature(returns = "OBJECT", qualified = "OpenEdge.Net.HTTP.BuilderRegistry", type = Type.GETTER, name = "Registry")
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends BuilderRegistry> getRegistry()
   {
      return function(RequestBuilder.class, "Registry", object.class, new Block((Body) () -> 
      {
         if (!REGISTRY.get()._isValid()) {
            REGISTRY.get().assign(ObjectOps.newInstance(BuilderRegistry.class));
            initializeRegistry(REGISTRY.get());
         }
         
         returnNormal(REGISTRY.get());
      }));
   }

   /**
    * Builder director method.
    * 
    * @param _pcMethod HTTP method
    * @param _poURI    HTTP URI
    * 
    * @return A builder for the requested type
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Build", qualified = REQUESTBUILDER, parameters = {
            @LegacyParameter(name = "pcMethod", type = CHAR, mode = INPUT),
            @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT) })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
   public static object<? extends RequestBuilder> build(final character _pcMethod,
            final object<? extends Uri> _poURI)
   {
      character pcMethod = TypeFactory.initInput(_pcMethod);
      object<? extends Uri> poURI = TypeFactory.initInput(_poURI);
      object<? extends RequestBuilder> builder = TypeFactory.object(RequestBuilder.class);
      
      return function(RequestBuilder.class, "Build", object.class, new Block((Body) () -> {
         object<? extends LegacyClass> builderCls = ObjectOps
                  .getLegacyClass(RequestBuilder.class);
         object<? extends LegacyClass> builderType = getRegistry().ref()
                  .get(builderCls.ref().getTypeName());
         
         Assert.isType(builderType, builderCls);

         builder.assign(ObjectOps.newInstance(builderType.ref().getType(), "II", pcMethod, poURI));

         if (builder._isValid() && builder.ref() instanceof ISupportInitialize)
            ((ISupportInitialize) builder.ref()).initialize();

         returnNormal(builder);
      }));
   }

   /**
    * Create builder for the HTTP DELETE.
    * 
    * @param _pcURI HTTP URI
    * 
    * @return A builder for the HTTP DELETE
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Delete", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcURI", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> delete(final character _pcURI)
   {
      return function(RequestBuilder.class, "Delete", object.class, new Block((Body) () -> 
      {
         returnNormal(delete(Uri.parse(_pcURI)));
      }));
   }

   /**
    * Create builder for the HTTP DELETE.
    * 
    * @param _pcURI HTTP URI
    * @param _poEntity request body
    * 
    * @return A builder for the HTTP DELETE
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Delete", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcURI", type = CHAR, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> delete(final character _pcURI,
         final object<? extends _BaseObject_> _poEntity)
   {
      return function(RequestBuilder.class, "Delete", object.class, new Block((Body) () -> 
      {
         returnNormal(delete(Uri.parse(_pcURI), _poEntity));
      }));
   }

   /**
    * Create builder for the HTTP DELETE.
    * 
    * @param _poURI HTTP URI
    * 
    * @return A builder for the HTTP DELETE
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Delete", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> delete(final object<? extends Uri> _poURI)
   {
      return function(RequestBuilder.class, "Delete", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.delete.ref().toLegacyString(), _poURI));
      }));
   }

   /**
    * Create builder for the HTTP DELETE.
    * 
    * @param _poURI HTTP URI
    * @param _poEntity request body
    * 
    * @return A builder for the HTTP DELETE
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Delete", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> delete(final object<? extends Uri> _poURI,
         final object<? extends _BaseObject_> _poEntity)
   {
      return function(RequestBuilder.class, "Delete", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.delete.ref().toLegacyString(), _poURI).ref().withData(_poEntity));
      }));
   }

   /**
    * Create builder for the HTTP DELETE.
    * 
    * @param _poURI HTTP URI
    * @param _poEntity request body
    * @param _pcContentType body content type 
    * 
    * @return A builder for the HTTP DELETE
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Delete", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
         @LegacyParameter(name = "pcContentType", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> delete(final object<? extends Uri> _poURI,
         final object<? extends _BaseObject_> _poEntity, final character _pcContentType)
   {
      return function(RequestBuilder.class, "Delete", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.delete.ref().toLegacyString(), _poURI).ref().withData(_poEntity, _pcContentType));
      }));
   }

   /**
    * Create builder for the HTTP GET.
    * 
    * @param _pcURI HTTP URI
    * 
    * @return A builder for the HTTP GET
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Get", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcURI", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> get(final character _pcURI)
   {
      return function(RequestBuilder.class, "Get", object.class, new Block((Body) () -> 
      {
         returnNormal(get(Uri.parse(_pcURI)));
      }));
   }

   /**
    * Create builder for the HTTP GET.
    * 
    * @param _pcURI HTTP URI
    * @param _poEntity request body
    * 
    * @return A builder for the HTTP GET
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Get", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcURI", type = CHAR, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> get(final character _pcURI,
         final object<? extends _BaseObject_> _poEntity)
   {
      return function(RequestBuilder.class, "Get", object.class, new Block((Body) () -> 
      {
         returnNormal(get(Uri.parse(_pcURI), _poEntity));
      }));
   }

   /**
    * Create builder for the HTTP GET.
    * 
    * @param _poURI HTTP URI
    * 
    * @return A builder for the HTTP GET
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Get", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> get(final object<? extends Uri> _poURI)
   {
      return function(RequestBuilder.class, "Get", object.class, new Block((Body) () -> 
      {
         returnNormal(get(_poURI, new object()));
      }));
   }

   /**
    * Create builder for the HTTP GET.
    * 
    * @param _poURI HTTP URI
    * @param _poEntity request body
    * 
    * @return A builder for the HTTP GET
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Get", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> get(final object<? extends Uri> _poURI,
         final object<? extends _BaseObject_> _poEntity)
   {
      return function(RequestBuilder.class, "Get", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.get.ref().toLegacyString(), _poURI).ref().withData(_poEntity));
      }));
   }

   /**
    * Create builder for the HTTP GET.
    * 
    * @param _poURI HTTP URI
    * @param _poEntity request body
    * @param _pcContentType body content type 
    * 
    * @return A builder for the HTTP GET
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Get", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
         @LegacyParameter(name = "pcContentType", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> get(final object<? extends Uri> _poURI,
         final object<? extends _BaseObject_> _poEntity, final character _pcContentType)
   {
      return function(RequestBuilder.class, "Get", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.get.ref().toLegacyString(), _poURI).ref().withData(_poEntity, _pcContentType));
      }));
   }

   /**
    * Create builder for the HTTP HEAD.
    * 
    * @param _pcURI HTTP URI
    * 
    * @return A builder for the HTTP HEAD
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Head", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcURI", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> head(final character _pcURI)
   {
      return function(RequestBuilder.class, "Head", object.class, new Block((Body) () -> 
      {
         returnNormal(head(Uri.parse(_pcURI)));
      }));
   }

   /**
    * Create builder for the HTTP HEAD.
    * 
    * @param _poURI HTTP URI
    * 
    * @return A builder for the HTTP HEAD
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Head", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> head(final object<? extends Uri> _poURI)
   {
      return function(RequestBuilder.class, "Head", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.head.ref().toLegacyString(), _poURI));
      }));
   }

   /**
    * Create builder for the HTTP OPTIONS.
    * 
    * @param _pcURI HTTP URI
    * 
    * @return A builder for the HTTP OPTIONS
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Options", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "p1", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> options(final character _pcURI)
   {
      return function(RequestBuilder.class, "Options", object.class, new Block((Body) () -> 
      {
         returnNormal(options(Uri.parse(_pcURI)));
      }));
   }

   /**
    * Create builder for the HTTP OPTIONS.
    * 
    * @param _pcURI HTTP URI
     * @param _poEntity request body
   * 
    * @return A builder for the HTTP OPTIONS
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Options", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcURI", type = CHAR, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> options(final character _pcURI,
         final object<? extends _BaseObject_> _poEntity)
   {
      return function(RequestBuilder.class, "Options", object.class, new Block((Body) () -> 
      {
         returnNormal(options(Uri.parse(_pcURI), _poEntity));
      }));
   }

   /**
    * Create builder for the HTTP OPTIONS.
    * 
    * @param _poURI HTTP URI
    * 
    * @return A builder for the HTTP OPTIONS
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Options", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "p1", type = OBJECT, qualified = NET_URI, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> options(final object<? extends Uri> _poURI)
   {
      return function(RequestBuilder.class, "Options", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.options.ref().toLegacyString(), _poURI));
      }));
   }

   /**
    * Create builder for the HTTP OPTIONS.
    * 
    * @param _poURI HTTP URI
    * @param _poEntity request body
    * 
    * @return A builder for the HTTP OPTIONS
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Options", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> options(final object<? extends Uri> _poURI,
         final object<? extends _BaseObject_> _poEntity)
   {
      return function(RequestBuilder.class, "Options", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.options.ref().toLegacyString(), _poURI).ref().withData(_poEntity));
      }));
   }

   /**
    * Create builder for the HTTP OPTIONS.
    * 
    * @param _poURI HTTP URI
    * @param _poEntity request body
    * @param _pcContentType body content type 
    * 
    * @return A builder for the HTTP OPTIONS
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Options", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
         @LegacyParameter(name = "pcContentType", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> options(final object<? extends Uri> _poURI,
         final object<? extends _BaseObject_> _poEntity, final character _pcContentType)
   {
      return function(RequestBuilder.class, "Options", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.options.ref().toLegacyString(), _poURI).ref().withData(_poEntity, _pcContentType));
      }));
   }

   /**
    * Create builder for the HTTP PATCH.
    * 
    * @param _pcURI HTTP URI
    * @param _poEntity request body
    * 
    * @return A builder for the HTTP PATCH
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Patch", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcURI", type = CHAR, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> patch(final character _pcURI,
         final object<? extends _BaseObject_> _poEntity)
   {
      return function(RequestBuilder.class, "Patch", object.class, new Block((Body) () -> 
      {
         returnNormal(patch(Uri.parse(_pcURI), _poEntity));
      }));
   }

   /**
    * Create builder for the HTTP PATCH.
    * 
    * @param _poURI HTTP URI
    * @param _poEntity request body
    * 
    * @return A builder for the HTTP PATCH
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Patch", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> patch(final object<? extends Uri> _poURI,
         final object<? extends _BaseObject_> _poEntity)
   {
      return function(RequestBuilder.class, "Patch", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.patch.ref().toLegacyString(), _poURI).ref().withData(_poEntity));
      }));
   }

   /**
    * Create builder for the HTTP PATCH.
    * 
    * @param _poURI HTTP URI
    * @param _poEntity request body
    * @param _pcContentType body content type 
    * 
    * @return A builder for the HTTP PATCH
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Patch", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
         @LegacyParameter(name = "pcContentType", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> patch(final object<? extends Uri> _poURI,
         final object<? extends _BaseObject_> _poEntity, final character _pcContentType)
   {
      return function(RequestBuilder.class, "Patch", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.patch.ref().toLegacyString(), _poURI).ref().withData(_poEntity, _pcContentType));
      }));
   }

   /**
    * Create builder for the HTTP POST.
    * 
    * @param _pcURI HTTP URI
    * 
    * @return A builder for the HTTP POST
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Post", qualified = REQUESTBUILDER, parameters = 
   {
      @LegacyParameter(name = "pcURI", type = CHAR, mode = INPUT),
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> post(final character _pcURI)
   {
      return function(RequestBuilder.class, "post", object.class, new Block((Body) () -> 
      {
         returnNormal(post(Uri.parse(_pcURI)));
      }));
   }
   
   /**
    * Create builder for the HTTP POST.
    * 
    * @param _pcURI HTTP URI
    * @param _poEntity request body
    * 
    * @return A builder for the HTTP POST
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Post", qualified = REQUESTBUILDER, parameters = 
   {
      @LegacyParameter(name = "pcURI", type = CHAR, mode = INPUT),
      @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> post(final character _pcURI,
         final object<? extends _BaseObject_> _poEntity)
   {
      return function(RequestBuilder.class, "post", object.class, new Block((Body) () -> 
      {
         returnNormal(post(Uri.parse(_pcURI), _poEntity));
      }));
   }

   /**
    * Create builder for the HTTP POST.
    * 
    * @param _poURI HTTP URI
    * 
    * @return A builder for the HTTP POST
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Post", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> post(final object<? extends Uri> _poURI)
   {
      return function(RequestBuilder.class, "post", object.class, new Block((Body) () -> 
      {
         returnNormal(build(new character("POST"), _poURI));
      }));
   }
   
   /**
    * Create builder for the HTTP POST.
    * 
    * @param _poURI HTTP URI
    * @param _poEntity request body
    * 
    * @return A builder for the HTTP POST
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Post", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> post(final object<? extends Uri> _poURI,
         final object<? extends _BaseObject_> _poEntity)
   {
      return function(RequestBuilder.class, "post", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.post.ref().toLegacyString(), _poURI).ref().withData(_poEntity));
      }));
   }

   /**
    * Create builder for the HTTP POST.
    * 
    * @param _poURI HTTP URI
    * @param _poEntity request body
    * @param _pcContentType body content type 
    * 
    * @return A builder for the HTTP POST
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Post", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
         @LegacyParameter(name = "pcContentType", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> post(final object<? extends Uri> _poURI,
         final object<? extends _BaseObject_> _poEntity, final character _pcContentType)
   {
      return function(RequestBuilder.class, "post", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.post.ref().toLegacyString(), _poURI).ref().withData(_poEntity, _pcContentType));
      }));
   }

   /**
    * Create builder for the HTTP PUT.
    * 
    * @param _poURI HTTP URI
    * @param _poEntity request body
    * @param _pcContentType body content type 
    * 
    * @return A builder for the HTTP PUT
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Put", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
         @LegacyParameter(name = "pcContentType", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> put(final object<? extends Uri> _poURI,
         final object<? extends _BaseObject_> _poEntity, final character _pcContentType)
   {
      return function(RequestBuilder.class, "put", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.put.ref().toLegacyString(), _poURI).ref().withData(_poEntity, _pcContentType));
      }));
   }

   /**
    * Create builder for the HTTP PUT.
    * 
    * @param _pcURI HTTP URI
    * @param _poEntity request body
    * 
    * @return A builder for the HTTP PUT
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Put", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcURI", type = CHAR, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> put(final character _pcURI,
         final object<? extends _BaseObject_> _poEntity)
   {
      return function(RequestBuilder.class, "put", object.class, new Block((Body) () -> 
      {
         returnNormal(put(Uri.parse(_pcURI), _poEntity));
      }));
   }

   /**
    * Create builder for the HTTP PUT.
    * 
    * @param _poURI HTTP URI
    * @param _poEntity request body
    * 
    * @return A builder for the HTTP PUT
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Put", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poURI", type = OBJECT, qualified = NET_URI, mode = INPUT),
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> put(final object<? extends Uri> _poURI,
         final object<? extends _BaseObject_> _poEntity)
   {
      return function(RequestBuilder.class, "put", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.put.ref().toLegacyString(), _poURI).ref().withData(_poEntity));
      }));
   }

   /**
    * Create builder for the HTTP TRACE.
    * 
    * @param _pcURI HTTP URI
    * 
    * @return A builder for the HTTP TRACE
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Trace", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "p1", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> trace(final character _pcURI)
   {
      return function(RequestBuilder.class, "Trace", object.class, new Block((Body) () -> 
      {
         returnNormal(trace(Uri.parse(_pcURI)));
      }));
   }

   /**
    * Create builder for the HTTP TRACE.
    * 
    * @param _poURI HTTP URI
    * 
    * @return A builder for the HTTP TRACE
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Trace", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "p1", type = OBJECT, qualified = NET_URI, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public static object<? extends RequestBuilder> trace(final object<? extends Uri> _poURI)
   {
      return function(RequestBuilder.class, "Trace", object.class, new Block((Body) () -> 
      {
         returnNormal(build(MethodEnum.trace.ref().toLegacyString(), _poURI));
      }));
   }

   @LegacySignature(type = Type.CONSTRUCTOR)
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
   public static void __net_http_RequestBuilder_constructor__static__()
   {
      externalProcedure(RequestBuilder.class, new Block((Body) () ->
      {
         onBlockLevel(Condition.ERROR, Action.THROW);
      }));
   }
         
   /**
    * 'constructor'.
    * @param _pcMethod HTTP method
    * @param _poURI HTTP URI  
    */
   @LegacySignature(type = Type.CONSTRUCTOR, parameters = 
   {
         @LegacyParameter(name = "pcMethod", type = CHAR, mode = INPUT),
         @LegacyParameter(name = "uri", type = OBJECT, qualified = NET_URI, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   protected void __net_http_RequestBuilder_constructor__(final character _pcMethod,
         final object<? extends Uri> _poURI)
   {
      character pcMethod = TypeFactory.initInput(_pcMethod);
      object<? extends Uri> poURI = TypeFactory.initInput(_poURI);
      internalProcedure(this, "__net_http_RequestBuilder_constructor__", new Block((Body) () -> 
      {
         __net_http_ConfigBuilder_constructor__();
         Assert.notNullOrEmpty(pcMethod, new character("Method"));
         Assert.notNull(poURI, new character("URI"));
         
         setOption(new character(OPTION_URI), poURI);
         setOption(new character(OPTION_METHOD), pcMethod);
      }));
   }

   /**
    * ????.
    */
   @LegacySignature(type = Type.EXECUTE)
   public void __net_http_RequestBuilder_execute__()
   {
      onBlockLevel(Condition.ERROR, Action.THROW);
   }


   /**
    * Initialize.
    */
   @Override
   @LegacySignature(type = Type.METHOD, name = "Initialize")
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
   public void initialize()
   {
      internalProcedure(this, "Initialize", new Block((Body) () -> {
         httpVersion(new character("HTTP/1.1"));
      }));
   }

   /**
    * Destroy.
    */
   @Override
   @LegacySignature(type = Type.METHOD, name = "Destroy")
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public void destroy()
   {
      internalProcedure(this, "Destroy", new Block((Body) () -> {
         // no-op
      }));
   }
   
   /**
    * Get the HTTP Request
    * 
    * @return HTTP request
    */
   @LegacySignature(returns = "OBJECT", qualified = "OpenEdge.Net.HTTP.IHttpRequest", type = Type.GETTER, name = "Request")
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public abstract object<? extends IhttpRequest> getRequest();
   /**
    * Allows the request to accept all content types.
    * 
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AcceptAll", qualified = REQUESTBUILDER)
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> acceptAll()
   {
      return function(this, "AcceptAll", object.class, new Block((Body) () -> {
         returnNormal(acceptContentType(new character("*/*")));
      }));
   }

   /**
    * Allows the request to accept the input content type.
    * @param _pcContentType
    *         Content Type
    *         
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AcceptContentType", 
         qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcContentType", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> acceptContentType(
         final character _pcContentType)
   {
      character pcContentType = TypeFactory.initInput(_pcContentType);
      return function(this, "AcceptContentType", object.class, new Block((Body)() -> 
      {
         character ctype = new character(OPTION_ACCEPT_CONTENT_TYPE);
         character cv = getOptionStringValue(ctype);

         setOption(ctype, TextOps.substitute("&1,&2", cv.isUnknown() ? "" : cv, pcContentType));
         returnNormal(new object(this));
      }));
   }

   /**
    * Allows the request to accept form data content. 
    * 
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AcceptFormData", qualified = REQUESTBUILDER)
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> acceptFormData()
   {
      return function(this, "AcceptFormData", object.class, new Block((Body)() -> 
      {
         returnNormal(acceptContentType(new character(FORM_URLENCODED)));
      }));
   }

   /**
    * Allows the request to accept HTML content types.
    * 
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AcceptHtml", qualified = REQUESTBUILDER)
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> acceptHtml()
   {
      return function(this, "AcceptHtml", object.class, new Block((Body)() -> 
      {
         returnNormal(acceptContentType(new character(TEXT_HTML)));
      }));
   }

   /**
    * Allows the request to accept basic JSON content types.
    * 
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AcceptJson", qualified = REQUESTBUILDER)
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> acceptJson()
   {
      return function(this, "AcceptJson", object.class, new Block((Body)() -> 
      {
         returnNormal(acceptContentType(new character(APPLICATION_JSON)));
      }));
   }

   /**
    *  Allows the request to accept XML content types.
    *  
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AcceptXml", qualified = REQUESTBUILDER)
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> acceptXml()
   {
      return function(this, "AcceptXml", object.class, new Block((Body)() -> 
      {
         returnNormal(acceptContentType(new character(XML_CONTENT_TYPES)));
      }));
   }

   /**
    * Adds a listener to events from the Request.
    * 
    * @param _poEventListenerType   
    *        The type of events the EventProviders is capable of listening to
    * @param _phListener
    *        The listening procedure. Must conform to the type
    *        
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AddCallback", 
         qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poEventListenerType ", type = OBJECT, qualified = LANG_CLASS, 
               mode = INPUT),
         @LegacyParameter(name = "phListener", type = HANDLE, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> addCallback(
         final object<? extends LegacyClass> _poEventListenerType, final handle _phListener)
   {
      object<? extends LegacyClass> poEventListenerType = TypeFactory.initInput(_poEventListenerType);
      handle phListener = TypeFactory.initInput(_phListener);
      
      return function(this, "AddCallback", object.class, new Block((Body) () -> {
         object<? extends LegacyClass> authClass = ObjectOps.getLegacyClass(IauthFilterEventHandler.class);
         
         Assert.isType(_poEventListenerType, authClass);
         
         object<? extends AuthFilterEventHandlerWrapper> handler = ObjectOps.newInstance(AuthFilterEventHandlerWrapper.class, "I", phListener);
         
         returnNormal(addCallback(poEventListenerType, handler));
      }));
   }

   /**
    * Adds a listener to events from the Request.
    * 
    * @param _poEventListenerType   
    *        The type of events the EventProviders is capable of listening to
    * @param _poListener
    *        The listening procedure. Must conform to the type
    *        
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AddCallback", 
         qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poEventListenerType ", type = OBJECT, qualified = LANG_CLASS, 
               mode = INPUT),
         @LegacyParameter(qualified = "Progress.Lang.Object", name = "poListener", type = OBJECT, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> addCallback(
         final object<? extends LegacyClass> _poEventListenerType, 
         final object<? extends _BaseObject_> _poListener)
   {
      object<? extends LegacyClass> poEventListenerType = TypeFactory.initInput(_poEventListenerType);
      object<? extends _BaseObject_> poListener = TypeFactory.initInput(_poListener);
      
      return function(this, "AddCallback", object.class, new Block((Body) () -> {
         
         Assert.notNull(poEventListenerType, new character("Event listener type"));
         Assert.notNull(poListener, new character("Event listener"));
         
         supportsAuthentication();
         setOption(new character(OPTION_EVENT_LISTENER_TYPE), poEventListenerType);
         setOption(new character(OPTION_AUTH_LISTENER), poListener);
         
         returnNormal(new object(this));
      }));
   }

   /**
    * Adds (or replaces) a cookie

    * @param _poCookie
    *        cookie to be added
    *        
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AddCookie", 
         qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poCookie", type = OBJECT, 
               qualified = "openedge.net.http.cookie", mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> addCookie(
         final object<? extends Cookie> _poCookie)
   {
      object<? extends Cookie> poCookie = TypeFactory.initInput(_poCookie);
      
      return function(this, "AddCookie", object.class, new Block((Body) () -> {
         Assert.notNull(poCookie, new character("Http cookie"));
         setOption(new character("cookie+" + poCookie.ref().getName().getValue()), poCookie);
         returnNormal(new object(this));
      }));
   }
   
   /**
    * Adds a form data as a body to the request.
    * 
    * @param _pcFieldName
    *         form field name
    * @param _pcFieldValue
    *         form field value
    * 
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AddFormData", 
         qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcFieldName", type = CHAR, mode = INPUT),
         @LegacyParameter(name = "pcFieldValue", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> addFormData(final character _pcFieldName,
         final character _pcFieldValue)
   {
      character pcFieldName = TypeFactory.initInput(_pcFieldName);
      character pcFieldValue = TypeFactory.initInput(_pcFieldValue);
      object<? extends IStringStringMap> formData = TypeFactory.object(IStringStringMap.class);
      
      return function(this, "AddFormData", object.class, new Block((Body) () -> {
         Assert.notNullOrEmpty(pcFieldName, new character("Field Name"));
         formData.assign(ObjectOps.cast(getOptionObjectValue(new character("entity")), 
               IStringStringMap.class));
         if (!formData._isValid())
         {
            formData.assign(ObjectOps.newInstance(StringStringMap.class));
            addFormData(formData);
         }
         formData.ref().put(pcFieldName, new longchar(pcFieldValue));
         returnNormal(new object(this));
      }));
   }

   /**
    * Adds a form data as a body to the request.
    *
    * @param _poEntity
    *        The complete data being added to the request
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AddFormData", 
         qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poEntity", type = OBJECT, 
               qualified = "openedge.core.collections.istringstringmap", mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> addFormData(
         final object<? extends IStringStringMap> _poEntity)
   {
      return function(this, "AddFormData", object.class, new Block((Body) () -> {
         returnNormal(withData(_poEntity));
      }));
   }

   /**
    * Adds (or replaces) a heade
    * 
    * @param _pcName
    *        header name
    * @param _pcValue
    *        header value
    *        
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AddHeader", 
         qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcName", type = CHAR, mode = INPUT),
         @LegacyParameter(name = "pcValue", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> addHeader(final character _pcName,
         final character _pcValue)
   {
      character pcName = TypeFactory.initInput(_pcName);
      character pcValue = TypeFactory.initInput(_pcValue);
      
      return function(this, "AddHeader", object.class, new Block((Body) () -> {
         Assert.notNullOrEmpty(pcName, new character("Header name"));
         Assert.notNull(pcValue, new character("Header value"));
         returnNormal(addHeader(HttpHeaderBuilder.build(pcName).
               ref().value(pcValue).ref().getHeader()));
      }));
   }

   /**
    * Adds (or replaces) a header

    * @param _poHeader
    *        header to be added
    *        
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AddHeader", 
         qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "poHeader", type = OBJECT, 
               qualified = "openedge.net.http.httpheader", mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> addHeader(
         final object<? extends HttpHeader> _poHeader)
   {
      object<? extends HttpHeader> poHeader = TypeFactory.initInput(_poHeader);
      
      return function(this, "AddHeader", object.class, new Block((Body) () -> {
         Assert.notNull(poHeader, new character("Http header"));
         setHeaderOption(poHeader);
         returnNormal(new object(this));
      }));
   }

   /**
    * Adds a JSON body to the request.
    * 
    * @param _poEntity
    *        JSON body
    *        
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AddJsonData", qualified = REQUESTBUILDER, 
         parameters = 
   {
         @LegacyParameter(name = "poEntity", type = OBJECT, 
               qualified = "progress.json.objectmodel.jsonobject", mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> addJsonData(
         final object<? extends JsonObject> _poEntity)
   {
      return function(this, "AddJsonData", object.class, new Block((Body) () -> {
         returnNormal(withData(_poEntity));
      }));
   }

   /**
    * Adds an authentication listener to events from the Request.
    * 
    * @param _phListener
    *        The listening procedure. Must conform to the type
    *        
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AuthCallback", qualified = REQUESTBUILDER, 
         parameters = 
   {
         @LegacyParameter(name = "phListener", type = HANDLE, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> authCallback(final handle _phListener)
   {
      handle phListener = TypeFactory.initInput(_phListener);
      
      return function(this, "AuthCallback", object.class, new Block((Body) () -> {
         
         object<? extends AuthFilterEventHandlerWrapper> handler = ObjectOps.newInstance(AuthFilterEventHandlerWrapper.class, "I", phListener);
         
         returnNormal(addCallback(ObjectOps.getLegacyClass(IauthFilterEventHandler.class), handler));
      }));
   }

   /**
    * Adds an authentication listener to events from the Request.
    * 
    * @param _poListener
    *        The listening procedure. Must conform to the type
    *        
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "AuthCallback", qualified = REQUESTBUILDER, 
         parameters = 
   {
         @LegacyParameter(name = "poListener", type = OBJECT, 
               qualified = LANG_OBJECT, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> authCallback(
         final object<? extends _BaseObject_> _poListener)
   {
      object<? extends _BaseObject_> poListener = TypeFactory.initInput(_poListener);
      
      return function(this, "AuthCallback", object.class, new Block((Body) () -> {
         returnNormal(addCallback(ObjectOps.getLegacyClass(IauthFilterEventHandler.class), poListener));
      }));
   }

   /**
    * Sets the content type for the request.
    * 
    * @param _pcContentType
    *        content type
    *        
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "ContentType", qualified = REQUESTBUILDER, 
         parameters = 
   {
         @LegacyParameter(name = "pcContentType", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> contentType(final character _pcContentType)
   {
      character pcContentType = TypeFactory.initInput(_pcContentType);
      return function(this, "ContentType", object.class, new Block((Body)() -> 
      {
         Assert.notNullOrEmpty(pcContentType, new character("Content type"));
         returnNormal(addHeader(new character("Content-Type"), pcContentType));  
      }));
   }

   /**
    * Adds an ETag value to the request.
    * 
    * @param _pcETag
    *        The tag value
    *        
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "ETag", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcETag", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> etag(final character _pcETag)
   {
      character pcETag = TypeFactory.initInput(_pcETag);
      return function(this, "ETag", object.class, new Block((Body) () -> {
         Assert.notNullOrEmpty(pcETag, new character("ETag "));
         returnNormal(addHeader(new character("ETag"), character.quoter(pcETag)));  
      }));
   }

   /**
    * Sets the HTTP version of the request
    * @param _pcVersion
    *        HTTP version
    *        
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "HttpVersion", qualified = REQUESTBUILDER, 
         parameters = 
   {
         @LegacyParameter(name = "pcVersion", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> httpVersion(final character _pcVersion)
   {
      character pcVersion = TypeFactory.initInput(_pcVersion);
      
      return function(this, "HttpVersion", object.class, new Block((Body) () -> {
         Assert.legacyEquals(new character("HTTP/1.1"), pcVersion);
         
         setOption(new character(OPTION_VERSION), pcVersion);
         returnNormal(new object(this));
      }));
   }

   /**
    * Sets the X-Request-Id header.
    * 
    * @param _pcRequestId
    *        True if the request id should be sent.
    *        
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "Id", qualified = REQUESTBUILDER, parameters = 
   {
         @LegacyParameter(name = "pcRequestId", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> id(final character _pcRequestId)
   {
      character pcRequestId = TypeFactory.initInput(_pcRequestId);
      
      return function(this, "Id", object.class, new Block((Body) () -> {
         Assert.notNullOrEmpty(pcRequestId, new character("Request id"));
         addHeader(new character("X-Request-ID"), pcRequestId);
         returnNormal(new object(this));
      }));
   }

   /**
    * Flags the setting of the X-Request-Id header.
    * 
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "SendRequestId", qualified = REQUESTBUILDER)
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> sendRequestId()
   {
      return function(this, "SendRequestId", object.class, new Block((Body) () -> {
         returnNormal(id(SecurityOps.convertUniversalUIDToGlobalUID()));
      }));
   }
   /**
    * Indicates that this request is can handle authentication This allows credentials etc to be 
    * supplied later.
    * 
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "SupportsAuthentication", 
         qualified = REQUESTBUILDER)
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> supportsAuthentication()
   {
      return function(this, "SupportsAuthentication", object.class, new Block((Body) () -> {
         setOption(new character(OPTION_SUPPORT_AUTHENTICATION), character.valueOf(true));
         returnNormal(new object(this));
      }));
   }

   /**
    * Indicates that this request is capable of being proxied. This allows the proxy to be 
    * supplied later. 
    * 
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "SupportsProxy", qualified = REQUESTBUILDER)
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> supportsProxy()
   {
      return function(this, "SupportsProxy", object.class, new Block((Body) () -> {
         setOption(new character(OPTION_SUPPORT_PROXY), character.valueOf(true));
         returnNormal(new object(this));
      }));
   }

   /**
    * Sets the URI to use as a proxy server for all requests.
    * 
    * @param _pcProxyURI
    *         proxy URI
    * 
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "ViaProxy", qualified = REQUESTBUILDER, 
         parameters = 
   {
         @LegacyParameter(name = "pcProxyURI", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> viaProxy(final character _pcProxyURI)
   {
      character pcProxyURI = TypeFactory.initInput(_pcProxyURI);
      return function(this, "ViaProxy", object.class, new Block((Body) () -> {
         Assert.notNullOrEmpty(pcProxyURI, new character("Proxy server URI"));
         returnNormal(viaProxy(Uri.parse(pcProxyURI)));
      })); 
   }

   /**
    * Sets the URI to use as a proxy server for all requests.
    * 
    * @param _poProxyURI
    *         proxy URI
    * 
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "ViaProxy", qualified = REQUESTBUILDER, 
         parameters = 
   {
         @LegacyParameter(name = "poProxyURI", type = OBJECT, qualified = NET_URI, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> viaProxy(final object<? extends Uri> _poProxyURI)
   {
      object<? extends Uri> poProxyURI = TypeFactory.initInput(_poProxyURI);
      return function(this, "ViaProxy", object.class, new Block((Body) () -> {
         Assert.notNull(poProxyURI, new character("Proxy server URI"));
         supportsProxy();
         setOption(new character(OPTION_PROXY_URI), poProxyURI);
         returnNormal(new object(this));
      }));
   }

   /**
    * Adds data to the request.
    *
    * @param _poEntity
    *        The object to use as the request payload/entity
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "WithData", qualified = REQUESTBUILDER, 
         parameters = 
   {
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> withData(
         final object<? extends _BaseObject_> _poEntity)
   {
      object<? extends _BaseObject_> poEntity = TypeFactory.initInput(_poEntity);
      
      return function(this, "WithData", object.class, new Block((Body) () -> {
         if (poEntity._isValid())
         {
            if (poEntity.ref().getLegacyClass().ref().
                  _isA(ObjectOps.
                        getLegacyClass(JsonConstruct.class)))
            {
               returnNormal(withData(poEntity, new character(APPLICATION_JSON)));
            }
            if (poEntity.ref().getLegacyClass().ref().
                  _isA(ObjectOps.getLegacyClass(WidgetHandle.class)))
            {
               returnNormal(withData(poEntity, new character(XML_CONTENT_TYPES_LIST.get(0))));
            }
            if (poEntity.ref().getLegacyClass().ref().
                  _isA(ObjectOps.getLegacyClass(LegacyString.class)))
            {
               returnNormal(withData(poEntity, new character(TEXT_HTML)));
            }
            if (poEntity.ref().getLegacyClass().ref().
                  _isA(ObjectOps.getLegacyClass(IStringStringMap.class)))
            {
               returnNormal(withData(poEntity, 
                     new character(FORM_URLENCODED)));
            }
            if (poEntity.ref().getLegacyClass().ref().
                  _isA(ObjectOps.getLegacyClass(ISupportMultipartEntity.class)))
            {
               returnNormal(withData(poEntity, new character("multipart/mixed")));
            }
            returnNormal(withData(poEntity, new character("text/plain")));
         }
         returnNormal(new object(this));
      }));
   }

   /**
    * Adds data to the request.
    *
    * @param _poEntity
    *        The object to use as the request payload/entity 
    * @param _pcContentType
    *        The content type for this entity/payloa
    * 
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "WithData", qualified = REQUESTBUILDER, 
         parameters = 
   {
         @LegacyParameter(name = "poEntity", type = OBJECT, qualified = LANG_OBJECT, mode = INPUT),
         @LegacyParameter(name = "pcContentType", type = CHAR, mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> withData(
         final object<? extends _BaseObject_> _poEntity, final character _pcContentType)
   {
      object<? extends _BaseObject_> poEntity = TypeFactory.initInput(_poEntity);
      character pcContentType = TypeFactory.initInput(_pcContentType);
      
      return function(this, "WithData", object.class, new Block((Body) () -> {
         Assert.notNull(poEntity, new character("Data"));
         Assert.notNullOrEmpty(pcContentType, new character("Content type"));
         
         setOption(new character(OPTION_ENTITY), poEntity);
         contentType(pcContentType);
         
         returnNormal(new object(this));
      }));
   }
   
   /**
    * Stores a header value as an option.
    * 
    * @param _poHeader header.
    * 
    * @return <code>true</code> if option was replaced.
    */
   @LegacySignature(returns = "LOGICAL", type = Type.METHOD, name = "SetHeaderOption", parameters = 
   {
         @LegacyParameter(name = "poHeader", type = OBJECT, 
               qualified = "openedge.net.http.httpheader", mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   protected logical setHeaderOption(final object<? extends HttpHeader> _poHeader)
   {
      object<? extends HttpHeader> poHeader = TypeFactory.initInput(_poHeader);

      return function(this, "SetHeaderOption", logical.class, new Block((Body) () -> {
         Assert.notNull(poHeader, new character("Http header"));
         returnNormal(
               setOption(new character("header+" + poHeader.ref().getName().getValue()), 
                     poHeader));
      }));
   }

   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "UsingBasicAuthentication", qualified = REQUESTBUILDER, parameters = 
   {
      @LegacyParameter(name = "p1", mode = INPUT, qualified = "OpenEdge.Net.HTTP.Credentials", type = OBJECT)
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> usingBasicAuthentication(object<? extends Credentials> p1)
   {
      return usingCredentials(p1, AuthenticationMethodEnum.basic.ref().toLegacyString(), 
                           new character("realm=\"\""));
   }
   
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "UsingCredentials", qualified = "openedge.net.http.requestbuilder", parameters = {
            @LegacyParameter(name = "p1", type = "OBJECT", qualified = "openedge.net.http.credentials", mode = "INPUT") })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> usingCredentials(
            final object<? extends Credentials> _p1)
   {
      object<? extends Credentials> p1 = TypeFactory.initInput(_p1);

      return function(RequestBuilder.class, this, "UsingCredentials", object.class, new Block((Body) () -> {
         Assert.notNull(p1, new character("Credentials"));
         
         supportsAuthentication();
         setOption(new character(OPTION_AUTH_CREDENTIALS), p1);
         
         returnNormal(new object(this));
      }));
   }

   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "UsingCredentials", qualified = "openedge.net.http.requestbuilder", parameters = {
            @LegacyParameter(name = "p1", type = "OBJECT", qualified = "openedge.net.http.credentials", mode = "INPUT"),
            @LegacyParameter(name = "p2", type = "CHARACTER", mode = "INPUT"),
            @LegacyParameter(name = "p3", type = "CHARACTER", mode = "INPUT") })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> usingCredentials(
            final object<? extends Credentials> _p1, final character _p2, final character _p3)
   {
      object<? extends Credentials> p1 = TypeFactory.initInput(_p1);
      character p2 = TypeFactory.initInput(_p2);
      character p3 = TypeFactory.initInput(_p3);

      return function(RequestBuilder.class, this, "UsingCredentials", object.class, new Block((Body) () -> {
         Assert.notNullOrEmpty(p2, new character("Authentication Method"));
         Assert.notNull(p3, new character("Challenge"));
         
         usingCredentials(p1);
         
         setOption(new character(OPTION_AUTH_METHOD), p2);
         setOption(new character(OPTION_AUTH_CHALLENGE), p3);
         
         returnNormal(new object(this));
      }));
   }
   
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "UsingDigestAuthentication", qualified = REQUESTBUILDER, parameters = {
            @LegacyParameter(name = "p1", type = "OBJECT", qualified = "openedge.net.http.credentials", mode = "INPUT") })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> usingDigestAuthentication(
            final object<? extends Credentials> _p1)
   {
      return usingCredentials(_p1);
   }

   /**
    * Set the transfer encoding method.
    *
    * @param _poEncoding
    *        The encoding to be used for data transfer.
    * @return The request builder being constructed.
    */
   @LegacySignature(returns = "OBJECT", type = Type.METHOD, name = "WithTransferEncoding", qualified = REQUESTBUILDER, 
         parameters = 
   {
         @LegacyParameter(name = "poEncoding", type = OBJECT, qualified = "OpenEdge.Net.HTTP.TransferEncodingEnum", mode = INPUT) 
   })
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
   public object<? extends RequestBuilder> withTransferEncoding(
         final object<? extends TransferEncodingEnum> _poEncoding)
   {
      object<? extends TransferEncodingEnum> poEncoding = TypeFactory.initInput(_poEncoding);
      
      return function(this, "WithTransferEncoding", object.class, new Block((Body) () -> {
         Assert.notNull(poEncoding, new character("Transfer encoding"));
         
         returnNormal(addHeader(new character("Transfer-Encoding"), poEncoding.ref().toLegacyString()));
      }));
   }
}