routes

Tiny routing library for Java

Лицензия

Лицензия

Группа

Группа

me.geso
Идентификатор

Идентификатор

routes
Последняя версия

Последняя версия

0.6.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

routes
Tiny routing library for Java
Ссылка на сайт

Ссылка на сайт

http://github.com/tokuhirom/routes
Система контроля версий

Система контроля версий

https://github.com/tokuhirom/routes/

Скачать routes

Как подключить последнюю версию

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

Зависимости

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11

Модули Проекта

Данный проект не имеет модулей.

Routes for Java

Build Status

This is a tiny routing library for Java.

Synopsis

Your WebAction.java

@FunctionalInterface
public interface WebAction {
	void call(ServletRequest req, ServletResponse res);
}

Your routing code.

	// Create routing rules.
	router = new WebRouter<WebAction>();
	router.get("/", RootController::index)
			.get("/sample-json", RootController::sampleJson);
			
	// Match
	RoutingResult rr = router.match("GET", "/sample-json");
	if (rr != null) {
		if (rr.methodAllowed()) {
			return res405();
		} else {
			WebAction dst = rr.getDestination();
			return dst.invoke();
		}
	} else {
		return res404();
	}

Path Patterns

/member/{memberId}

Will match %r{^/member/[a-zA-Z0-9._-]+$}.

/download/*

Will match %r{^/download/.*$}.

/blog/{articleId:[0-9]+}

Will match %r{^/blog/[0-9]+$}. You can specify regular expression as a path.

Dependencies

  • Java 8

Версии библиотеки

Версия
0.6.0
0.5.0
0.4.0
0.3.9