Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | 1x 1x 1x 1x 1x 1x 1x | await import("./cl_express_icf_shim.clas.locals.mjs"); const {cx_root} = await import("./cx_root.clas.mjs"); // cl_express_icf_shim.clas.abap class cl_express_icf_shim { static INTERNAL_TYPE = 'CLAS'; static INTERNAL_NAME = 'CL_EXPRESS_ICF_SHIM'; static IMPLEMENTED_INTERFACES = []; static ATTRIBUTES = {"MI_SERVER": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "IF_HTTP_SERVER", RTTIName: "\\INTERFACE=IF_HTTP_SERVER"});}, "visibility": "I", "is_constant": " ", "is_class": "X"}}; static METHODS = {"RESPONSE": {"visibility": "I", "parameters": {"RES": {"type": () => {return new abap.types.Character(4);}, "is_optional": " "}}}, "REQUEST": {"visibility": "I", "parameters": {"REQ": {"type": () => {return new abap.types.Character(4);}, "is_optional": " "}, "BASE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}, "RUN": {"visibility": "U", "parameters": {"RES": {"type": () => {return new abap.types.Character(4);}, "is_optional": " "}, "REQ": {"type": () => {return new abap.types.Character(4);}, "is_optional": " "}, "BASE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}}; #mi_server; constructor() { this.me = new abap.types.ABAPObject(); this.me.set(this); this.INTERNAL_ID = abap.internalIdCounter++; this.FRIENDS_ACCESS_INSTANCE = { }; this.mi_server = cl_express_icf_shim.mi_server; } async constructor_(INPUT) { if (super.constructor_) { await super.constructor_(INPUT); } return this; } async run(INPUT) { return cl_express_icf_shim.run(INPUT); } static async run(INPUT) { let res = INPUT?.res; let req = INPUT?.req; let base = new abap.types.String({qualifiedName: "STRING"}); if (INPUT && INPUT.base) {base.set(INPUT.base);} let lv_classname = new abap.types.String({qualifiedName: "STRING"}); let li_handler = new abap.types.ABAPObject({qualifiedName: "IF_HTTP_EXTENSION", RTTIName: "\\INTERFACE=IF_HTTP_EXTENSION"}); lv_classname.set(INPUT.class); abap.statements.translate(lv_classname, "UPPER"); let unique1296 = abap.Classes["CLAS-CL_EXPRESS_ICF_SHIM-"+lv_classname.get().trimEnd()]; if (unique1296 === undefined) { unique1296 = abap.Classes[lv_classname.get().trimEnd()]; } if (unique1296 === undefined) { throw new abap.Classes['CX_SY_CREATE_OBJECT_ERROR']; } li_handler.set(await (new unique1296()).constructor_()); if (abap.compare.initial(cl_express_icf_shim.mi_server)) { cl_express_icf_shim.mi_server.set(await (new abap.Classes['CLAS-CL_EXPRESS_ICF_SHIM-LCL_SERVER']()).constructor_()); } cl_express_icf_shim.mi_server.get().if_http_server$request.set(await (new abap.Classes['CL_HTTP_ENTITY']()).constructor_()); await this.request({req: req, base: base}); cl_express_icf_shim.mi_server.get().if_http_server$response.set(await (new abap.Classes['CL_HTTP_ENTITY']()).constructor_()); await li_handler.get().if_http_extension$handle_request({server: cl_express_icf_shim.mi_server}); await this.response({res: res}); } async request(INPUT) { return cl_express_icf_shim.request(INPUT); } static async request(INPUT) { let req = INPUT?.req; let base = INPUT?.base; if (base?.getQualifiedName === undefined || base.getQualifiedName() !== "STRING") { base = undefined; } if (base === undefined) { base = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.base); } let lv_xstr = new abap.types.XString({qualifiedName: "XSTRING"}); let lv_str = new abap.types.String({qualifiedName: "STRING"}); let lv_name = new abap.types.String({qualifiedName: "STRING"}); let lv_value = new abap.types.String({qualifiedName: "STRING"}); let lt_fields = abap.types.TableFactory.construct(new abap.types.Structure({ "name": new abap.types.String({qualifiedName: "STRING"}), "value": new abap.types.String({qualifiedName: "STRING"})}, "IHTTPNVP", "IHTTPNVP", {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "TIHTTPNVP"); lv_xstr.set(INPUT.req.body.toString("hex").toUpperCase()); await cl_express_icf_shim.mi_server.get().if_http_server$request.get().if_http_entity$set_data({data: lv_xstr}); lv_str.set(INPUT.req.method); await cl_express_icf_shim.mi_server.get().if_http_server$request.get().if_http_request$set_method({method: lv_str}); for (const h in INPUT.req.headers) { lv_name.set(h); lv_value.set(INPUT.req.headers[h]); await cl_express_icf_shim.mi_server.get().if_http_server$request.get().if_http_entity$set_header_field({name: lv_name, value: lv_value}); } lv_value.set(INPUT.req.url); await cl_express_icf_shim.mi_server.get().if_http_server$request.get().if_http_entity$set_header_field({name: abap.CharacterFactory.get(12, '~request_uri'), value: lv_value}); abap.statements.split({source: lv_value, at: abap.CharacterFactory.get(1, '?'), targets: [lv_value,lv_value]}); await cl_express_icf_shim.mi_server.get().if_http_server$request.get().if_http_entity$set_header_field({name: abap.CharacterFactory.get(13, '~query_string'), value: lv_value}); lt_fields.set((await abap.Classes['CL_HTTP_UTILITY'].if_http_utility$string_to_fields({string: lv_value}))); await cl_express_icf_shim.mi_server.get().if_http_server$request.get().if_http_entity$set_form_fields({fields: lt_fields}); lv_value.set(INPUT.req.path); await cl_express_icf_shim.mi_server.get().if_http_server$request.get().if_http_entity$set_header_field({name: abap.CharacterFactory.get(5, '~path'), value: lv_value}); await cl_express_icf_shim.mi_server.get().if_http_server$request.get().if_http_entity$set_header_field({name: abap.CharacterFactory.get(25, '~path_translated_expanded'), value: lv_value}); abap.statements.replace({target: lv_value, all: false, with: abap.CharacterFactory.get(1, ''), of: base}); await cl_express_icf_shim.mi_server.get().if_http_server$request.get().if_http_entity$set_header_field({name: abap.CharacterFactory.get(10, '~path_info'), value: lv_value}); await cl_express_icf_shim.mi_server.get().if_http_server$request.get().if_http_entity$set_header_field({name: abap.CharacterFactory.get(19, '~path_info_expanded'), value: lv_value}); } async response(INPUT) { return cl_express_icf_shim.response(INPUT); } static async response(INPUT) { let res = INPUT?.res; let lv_code = new abap.types.Integer({qualifiedName: "I"}); let lv_xstr = new abap.types.XString({qualifiedName: "XSTRING"}); let lv_content_type = new abap.types.String({qualifiedName: "STRING"}); let lt_header_fields = abap.types.TableFactory.construct(new abap.types.Structure({ "name": new abap.types.String({qualifiedName: "STRING"}), "value": new abap.types.String({qualifiedName: "STRING"})}, "IHTTPNVP", "IHTTPNVP", {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"isUnique":false,"type":"STANDARD","keyFields":[],"name":"primary_key"},"secondary":[]}, "TIHTTPNVP"); let ls_field = new abap.types.Structure({ "name": new abap.types.String({qualifiedName: "STRING"}), "value": new abap.types.String({qualifiedName: "STRING"})}, "IHTTPNVP", "IHTTPNVP", {}, {}); await cl_express_icf_shim.mi_server.get().if_http_server$response.get().if_http_response$get_status({code: lv_code}); if (abap.compare.initial(lv_code)) { lv_code.set(abap.IntegerFactory.get(200)); } lv_content_type.set((await cl_express_icf_shim.mi_server.get().if_http_server$response.get().if_http_entity$get_content_type())); if (abap.compare.initial(lv_content_type)) { await cl_express_icf_shim.mi_server.get().if_http_server$response.get().if_http_entity$set_content_type({content_type: abap.CharacterFactory.get(9, 'text/html')}); } await cl_express_icf_shim.mi_server.get().if_http_server$response.get().if_http_entity$get_header_fields({fields: lt_header_fields}); for await (const unique1297 of abap.statements.loop(lt_header_fields)) { ls_field.set(unique1297); INPUT.res.append(ls_field.get().name.get(), ls_field.get().value.get()); } lv_xstr.set((await cl_express_icf_shim.mi_server.get().if_http_server$response.get().if_http_entity$get_data())); INPUT.res.status(lv_code.get()).send(Buffer.from(lv_xstr.get(), "hex")); } } abap.Classes['CL_EXPRESS_ICF_SHIM'] = cl_express_icf_shim; cl_express_icf_shim.mi_server = new abap.types.ABAPObject({qualifiedName: "IF_HTTP_SERVER", RTTIName: "\\INTERFACE=IF_HTTP_SERVER"}); export {cl_express_icf_shim}; |