Skip to content

abapPM/ABAP-URL

Repository files navigation

Version

License Contributor Covenant REUSE Status

URL Object

Full implementation of WHATWG URL Standard.

NO WARRANTIES, MIT License

┌────────┬──┬──────────┬──────────┬─────────────────┬──────┬──────────┬─┬──────────────┬──────────┐
" https:  //    user   :   pass   @ sub.example.com : 8080   /p/a/t/h  ?  query=string     #hash  "
│ scheme │  │ username │ password │    host         │ port │   path   │ |    query     │ fragment │
├────────┴──┴──────────┴──────────┴─────────────────┴──────┴──────────┴─┴──────────────┴──────────┤
│                                            url                                                  │
└─────────────────────────────────────────────────────────────────────────────────────────────────┘
(All spaces in the "" line should be ignored. They are purely for formatting.)

Usage

Parse a URL into it's component:

DATA(url) = zcl_url=>parse( 'https://example.com/path?query#fragment' ).

" url->components-scheme   = 'https'
" url->components-host     = 'example.com'
" url->components-path     = '/path'
" url->components-query    = 'query'
" url->components-fragment = 'fragment'

Serialize a URL from components:

DATA(components) = VALUE zcl_url=>ty_url_components(
  scheme   = 'https'
  username = 'user'
  password = 'pass'
  host     = 'example.com'
  port     = '8080'
  path     = '/path/to/resource'
  query    = 'key=value'
  fragment = 'section' ).

DATA(url_string) = zcl_url=>serialize( components ).

" url_string = 'https://user:pass@example.com:8080/path/to/resource?key=value#section'

Prerequisites

SAP Basis 7.50 or higher

Limitations

There's no support for punycode (should be a separate package).

Installation

Install url as a global module in your system using apm.

or

Specify the url module as a dependency in your project and import it to your namespace using apm.

Contributions

All contributions are welcome! Read our Contribution Guidelines, fork this repo, and create a pull request.

You can install the developer version of ABAP URL using abapGit by creating a new online repository for https://github.com/abapPM/ABAP-URL.

Recommended SAP package: $URL

About

Made with ❤ in Canada

Copyright 2025 apm.to Inc. https://apm.to

Follow @marcf.be on Blueksy and @marcfbe or LinkedIn

About

URL Object for ABAP

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Languages