Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bowbahdoe/microhttp-redirect

Utility for producing a redirect response
https://github.com/bowbahdoe/microhttp-redirect

Last synced: 7 days ago
JSON representation

Utility for producing a redirect response

Awesome Lists containing this project

README

        

# microhttp-redirect

Utility for producing a redirect response.

## Dependency Information

### Maven

```xml

dev.mccue
microhttp-redirect
2024.04.20

```

### Gradle

```groovy
dependencies {
implementation('dev.mccue:microhttp-redirect:2024.04.20')
}
```

## Usage

```java
import dev.mccue.microhttp.handler.IntoResponse;
import dev.mccue.microhttp.handler.RouteHandler;
import org.microhttp.Request;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class SomeHandler extends RouteHandler {
public SomeHandler() {
super("GET", Pattern.compile("/some/path"));
}

@Override
protected IntoResponse handleRoute(Matcher matcher, Request request) {
return RedirectResponse.seeOther("/path/to/redirect/to");
}
}
```