Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

When a tenant hosts a service to be used by external parties, it should ideally have a short URL. Shorter URLs are easier to be memorized and typed, which eliminates the need to log-in to access the service. Also, tenant information and other descriptive attributes are hidden in shorter URLs, and they are more convenient in hard-copy productions.

As a result, context Context mapping capability for services (Axis2, Jar, Spring, Data Services etc.) and applications is facilitated by the  following feature in the WSO2 feature repository:

Name : WSO2 Carbon - URL Mapper Feature
Identifier : org.wso2.carbon.url.mapper.feature.group

In Application Serverfacilitates this requirement.

By default, a service's endpoint URL is accessible through of the format http://localhost:port/services/service_context/   and service endpoint of a tenant is accessible through of the format http://localhost:port/services/t/tenant_domain/service_context/ Instead of going through this long URL process, the URL Mapping . The URL mapping feature provides a way to access your hosted service endpoint with a shorter URL like such as http://serviceid.localhost:port/ in in standalone products. For example, if the actual URL of a service endpoint is https://localhost:9443/services/admin/RESTSample/, after with a URL mapping is given name as 'servicetest', you get a shorter endpoint URL as https://servicetest.localhost:9443/.

The URL mapping functionality is bundled by default in the WSO2 Application Server. If it is not included in the WSO2 product you are using, you can install it using the instructions provided in section  Server Provisioning through Feature Management. Once installed, the necessary menus will appear in the product's management console.

Follow the instructions below to shorten the URL of a service.

1. Log on to the product's m anagement console and select "Services -> List" under the "Main" menu.

 

Image Removed

2. The "Deployed Services" page appears which lists out all the currently active services. Select a service and click on it to view its dashboard. For example,

  Image Removed

3. If the "URL Mapper" feature is installed in the product, you can find the "URL Mappings" link in the service's dashboard.

Image Removed

 Click the "URL Mappings" link.

4. The "URL Mappings" window opens. Click the "Add New Mapping" link.

  Image Removed

 5. Enter a URL mapping name. For example,

  Image Removed

6. steps below explain how to use URL mapping.

  1. Log in to the management console and select Services > List under the Main menu.  
  2. From the Deployed Services page that appears, click a service to which you want to map the end point URL. 
  3. The service's dashboard opens. It contains a link for URL Mapping. Click it.
    Image Added
  4. In the URL Mappings page that opens, click Add New Mapping link and enter a URL mapping name.
  5. The added URL mapping appears in the

...

  1. URL Mapping

...

  1. page. For example,

...

  1. Image Added
    Here the suffix

...

  1. localhost

...

  1. comes from

...

  1. <PRODUCT_

...

  1. HOME>/repository/conf/etc/url-mapping-config.xml. By default, the suffix is localhost and the  URL mappings limit is 1. You can configure your own suffix and

...

  1. limit

...

  1. per service in the mentioned configuration file.

...

  1.    
  2. With this shortened endpoint URL, you can access the service's WSDL files, tryit tool and rest calls

...

  1. as follows:

...

...

...

...

...

...

  1. You need a cname to access your own domain

...

  1. . If a cname is not available at the moment, you can use

...

  1. etc/hosts file in ubuntu or Windows

...

  1. /System32/drivers/etc/hosts file in windows to put your domain entries pointing to the local ip. For example,

...

  1. 127.0.0.1

...

  1. exampleapp.localhost

...

  1. . This is applicable only for testing purposes

...

hiddentrue

...

  1. .