Skip to content

Home

Development

IDEs

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

UrlMethods

The UrlMethods class contains utility one-liners for manipulating URLs such as extracting parts of the URL or building a URL from a given HttpServletRequest object. Methods in this class can be used in both Gloop and Groovy.

These are the different ways of using UrlMethods:

Sample Gloop service showing how to use the `UrlMethods` one-liners

1
2
3
4
5
6
7
8
// Retrieve a HttpServletRequest object
def request = ...

// Get the base URL from the request
def baseUrl = request.getBaseUrl()

// Get the file name from the URL
def fileName = baseUrl.filenameFromUrl()