Os_http_request::url($val), Example, Context – Brocade Virtual ADX OpenScript API Guide (Supporting ADX v03.1.00) User Manual

Page 52: Usage, Input parameters, Return values

Advertising
background image

40

Brocade Virtual ADX OpenScript API Guide

53-1003243-01

Methods

5

Example

OS_HTTP_REQUEST::url($val)

Sets the value of the URL to the value specified in $val.

Context

HTTP request event. If called in the HTTP response context, undefined will be returned.

Usage

Can be used to rewrite a url.

Input Parameters

The following table contains the input values.

Return Values

None

Example

TABLE 32

Input Values

Name

Type

Description

$val

string

A string representing the value
of the url.

use OS_HTTP_REQUEST;

use OS_SLB;

sub HTTP_REQUEST{

my $url = OS_HTTP_REQUEST::url;

my $method = OS_HTTP_REQUEST::method;

if ( defined $url && $url eq "/index.html" ){

OS_SLB::forward(1);

} elsif ( defined $method && $method eq "GET" ) {

OS_SLB::forward(2);

}

}

use OS_HTTP_REQUEST;

sub HTTP_REQUEST{

OS_HTTP_REQUEST::url("/index.html");

}

Advertising