normalize-url

Utility to normalize a URL, aiding in determining if two syntactically different URIs may be equivalent.

License

License

Categories

Categories

Net ORM Data
GroupId

GroupId

net.nebupookins
ArtifactId

ArtifactId

normalize-url
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

normalize-url
Utility to normalize a URL, aiding in determining if two syntactically different URIs may be equivalent.
Project URL

Project URL

https://github.com/NebuPookins/normalize-url
Source Code Management

Source Code Management

https://github.com/NebuPookins/normalize-url

Download normalize-url

How to add to project

<!-- https://jarcasting.com/artifacts/net.nebupookins/normalize-url/ -->
<dependency>
    <groupId>net.nebupookins</groupId>
    <artifactId>normalize-url</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.nebupookins/normalize-url/
implementation 'net.nebupookins:normalize-url:1.0.0'
// https://jarcasting.com/artifacts/net.nebupookins/normalize-url/
implementation ("net.nebupookins:normalize-url:1.0.0")
'net.nebupookins:normalize-url:jar:1.0.0'
<dependency org="net.nebupookins" name="normalize-url" rev="1.0.0">
  <artifact name="normalize-url" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.nebupookins', module='normalize-url', version='1.0.0')
)
libraryDependencies += "net.nebupookins" % "normalize-url" % "1.0.0"
[net.nebupookins/normalize-url "1.0.0"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

normalize-url

normalize-url is a Java library for normalizing URLs.

Installation

Maven:

<dependency>
  <groupId>net.nebupookins</groupId>
  <artifactId>normalize-url</artifactId>
  <version>1.0.0</version>
</dependency>

Gradle Groovy:

implementation 'net.nebupookins:normalize-url:1.0.0'

Gradle Kotlin

implementation("net.nebupookins:normalize-url:1.0.0")

SBT

libraryDependencies += "net.nebupookins" % "normalize-url" % "1.0.0"

Usage

Function<String, String> normalizer = UrlNormalizer.semanticPreservingNormalizer();
String normalizedUrl = normalizer.apply("HTTP://Example.COM:80/bar/../%7Efoo%2a");
assertThat(normalizedUrl, is("http://example.com/~foo%2A"));

Roadmap

I would like to eventually add in support for other Url normalizers besides the "Semantic Preserving" one. See https://en.wikipedia.org/wiki/URI_normalization for some ideas of normalizers that do "more dangerous" normalizations.

Contributing

Easiest way to contribute would probably be to submit examples of normalizations that you think should have happened but didn't (basically show me what the input URL was, and what you think the output URL should be). Note that I think "validating" the input URL is out of scope for this library, so if your "input URL" isn't actually a valid URL, then I think either throwing an exception or returning non-sensical output is okay and not a bug.

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Versions

Version
1.0.0