2017-08-23 15:46:55 +02:00
|
|
|
package context
|
|
|
|
|
2019-06-21 18:43:25 +02:00
|
|
|
import (
|
2020-04-28 00:58:56 +02:00
|
|
|
"io"
|
2019-12-13 22:06:18 +01:00
|
|
|
"time"
|
2019-06-21 18:43:25 +02:00
|
|
|
|
2019-10-25 00:27:02 +02:00
|
|
|
"github.com/kataras/iris/v12/macro"
|
2019-06-21 18:43:25 +02:00
|
|
|
)
|
2018-08-05 12:51:05 +02:00
|
|
|
|
2017-08-23 15:46:55 +02:00
|
|
|
// RouteReadOnly allows decoupled access to the current route
|
|
|
|
// inside the context.
|
|
|
|
type RouteReadOnly interface {
|
|
|
|
// Name returns the route's name.
|
|
|
|
Name() string
|
2017-08-23 16:01:51 +02:00
|
|
|
|
2020-05-10 23:44:54 +02:00
|
|
|
// StatusErrorCode returns 0 for common resource routes
|
|
|
|
// or the error code that an http error handler registered on.
|
|
|
|
StatusErrorCode() int
|
|
|
|
|
2017-08-23 16:01:51 +02:00
|
|
|
// Method returns the route's method.
|
|
|
|
Method() string
|
|
|
|
|
|
|
|
// Subdomains returns the route's subdomain.
|
|
|
|
Subdomain() string
|
|
|
|
|
2017-08-23 15:46:55 +02:00
|
|
|
// Path returns the route's original registered path.
|
|
|
|
Path() string
|
|
|
|
|
2017-08-23 16:01:51 +02:00
|
|
|
// String returns the form of METHOD, SUBDOMAIN, TMPL PATH.
|
|
|
|
String() string
|
|
|
|
|
2017-08-23 15:46:55 +02:00
|
|
|
// IsOnline returns true if the route is marked as "online" (state).
|
|
|
|
IsOnline() bool
|
|
|
|
|
2019-12-16 01:00:42 +01:00
|
|
|
// IsStatic reports whether this route is a static route.
|
|
|
|
// Does not contain dynamic path parameters,
|
|
|
|
// is online and registered on GET HTTP Method.
|
|
|
|
IsStatic() bool
|
2017-08-24 14:40:06 +02:00
|
|
|
// StaticPath returns the static part of the original, registered route path.
|
|
|
|
// if /user/{id} it will return /user
|
2018-10-21 18:20:05 +02:00
|
|
|
// if /user/{id}/friend/{friendid:uint64} it will return /user too
|
2017-08-24 14:40:06 +02:00
|
|
|
// if /assets/{filepath:path} it will return /assets.
|
|
|
|
StaticPath() string
|
|
|
|
|
2017-08-23 15:46:55 +02:00
|
|
|
// ResolvePath returns the formatted path's %v replaced with the args.
|
|
|
|
ResolvePath(args ...string) string
|
2020-04-28 00:58:56 +02:00
|
|
|
// Trace should writes debug route info to the "w".
|
2020-02-10 18:40:17 +01:00
|
|
|
// Should be called after Build.
|
2020-08-19 00:24:36 +02:00
|
|
|
Trace(w io.Writer, stoppedIndex int)
|
2018-08-05 12:51:05 +02:00
|
|
|
|
|
|
|
// Tmpl returns the path template,
|
|
|
|
// it contains the parsed template
|
|
|
|
// for the route's path.
|
|
|
|
// May contain zero named parameters.
|
|
|
|
//
|
|
|
|
// Available after the build state, i.e a request handler or Iris Configurator.
|
|
|
|
Tmpl() macro.Template
|
|
|
|
|
|
|
|
// MainHandlerName returns the first registered handler for the route.
|
|
|
|
MainHandlerName() string
|
2019-06-21 18:43:25 +02:00
|
|
|
|
2020-04-27 14:48:09 +02:00
|
|
|
// MainHandlerIndex returns the first registered handler's index for the route.
|
|
|
|
MainHandlerIndex() int
|
|
|
|
|
2019-12-13 22:06:18 +01:00
|
|
|
// Sitemap properties: https://www.sitemaps.org/protocol.html
|
|
|
|
|
|
|
|
// GetLastMod returns the date of last modification of the file served by this route.
|
|
|
|
GetLastMod() time.Time
|
|
|
|
// GetChangeFreq returns the the page frequently is likely to change.
|
|
|
|
GetChangeFreq() string
|
|
|
|
// GetPriority returns the priority of this route's URL relative to other URLs on your site.
|
|
|
|
GetPriority() float32
|
2019-06-21 18:43:25 +02:00
|
|
|
}
|