---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideServletRequest - Scoped

# GlideServletRequest - Scoped {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read

The GlideServletRequest API provides methods to use in processor scripts.

ServiceNow processor scripts are equivalent to Java servlets. Processor scripts provide a customizable URL endpoint that can execute arbitrary server-side JavaScript code and produce output such as TEXT,
JSON, or HTML. Use the GlideServletRequest API in processor scripts to access the [HttpServletRequest](http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpServletRequest.html) object. The GlideServletRequest object provides a subset of the HttpServletRequest APIs. The methods are called using the global variable
<var class="keyword varname">g_request</var>.

A useful global variable, <var class="keyword varname">g_target</var>, is available in processor scripts. It contains the table name extracted from the URL.

The URL to a processor has the format: https://\<instance name.servicenow.com\>/\<path endpoint\>.do?\<parameter endpoint\>=\<value\> where
the path endpoint and parameter endpoint are defined on the processor form.

## GlideServletRequest - getContentType() {#ariaid-title2}

Returns the MIME type of the body of the request.
{#r_ScopedGlideServletRequestGetContentType__table_hjl_4q5_qr__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#r_ScopedGlideServletRequestGetContentType__table_hjl_4q5_qr} {#r_ScopedGlideServletRequestGetContentType__table_ijl_4q5_qr__entry__2}

| Type | Description |
|-|-|
| String | The content type, returns null if the content type is not known. |
[Table 2. Returns]

{#r_ScopedGlideServletRequestGetContentType__table_ijl_4q5_qr}  

    var contentType = g_request.getContentType();

## GlideServletRequest - getHeader(String name) {#ariaid-title3}

Returns the header value.
{#r_ScopedGlideServletRequestGetHeader_String__table_mzj_fr5_qr__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | The name of the header to be retrieved. |
[Table 3. Parameters]

{#r_ScopedGlideServletRequestGetHeader_String__table_mzj_fr5_qr} {#r_ScopedGlideServletRequestGetHeader_String__table_nzj_fr5_qr__entry__2}

| Type | Description |
|-|-|
| String | The header. |
[Table 4. Returns]

{#r_ScopedGlideServletRequestGetHeader_String__table_nzj_fr5_qr}  

    var headerValue = g_request.getHeader("host");

Output:

    demonightlyus.service-now.com

## GlideServletRequest - getHeaderNames() {#ariaid-title4}

Returns a comma-separated list of header names.
{#r_ScopedGlideServletRequestGetHeaderNames__table_f2x_vs5_qr__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 5. Parameters]

{#r_ScopedGlideServletRequestGetHeaderNames__table_f2x_vs5_qr} {#r_ScopedGlideServletRequestGetHeaderNames__table_g2x_vs5_qr__entry__2}

| Type | Description |
|-|-|
| Array | An array of header names as a string. |
[Table 6. Returns]

{#r_ScopedGlideServletRequestGetHeaderNames__table_g2x_vs5_qr}  

    var headerList = g_request.getHeaderNames();

Output:

    host,connection,cache-control,authorization,accept,user-agent,accept-encoding,accept-language,
    cookie,x-forwarded-proto,x-forwarded-host,x-forwarded-for

## GlideServletRequest - getHeaders(String name) {#ariaid-title5}

Returns the header values.
{#r_ScopedGlideServletRequestGetHeaders_String__table_vn2_ds5_qr__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Names of the headers to be retrieved. |
[Table 7. Parameters]

{#r_ScopedGlideServletRequestGetHeaders_String__table_vn2_ds5_qr} {#r_ScopedGlideServletRequestGetHeaders_String__table_wn2_ds5_qr__entry__2}

| Type | Description |
|-|-|
| Array | An array of header values as a string. |
[Table 8. Returns]

{#r_ScopedGlideServletRequestGetHeaders_String__table_wn2_ds5_qr}  

    var headerValue = g_request.getHeaders("host");

Output:

    demonightlyus.service-now.com

## GlideServletRequest - getParameter(String name) {#ariaid-title6}

Returns the value of the parameter contained in the request URL.
{#r_ScopedGlideServletRequestGetParameter_String__table_zg5_lt5_qr__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | The name of the parameter to be retrieved. This can be the parameter endpoint from the processor form. |
[Table 9. Parameters]

{#r_ScopedGlideServletRequestGetParameter_String__table_zg5_lt5_qr} {#r_ScopedGlideServletRequestGetParameter_String__table_ah5_lt5_qr__entry__2}

| Type | Description |
|-|-|
| Object | The parameter value. Returns null if the parameter is not found. |
[Table 10. Returns]

{#r_ScopedGlideServletRequestGetParameter_String__table_ah5_lt5_qr}  

    var name = g_request.getParameter("x_snc_custom_x_snc_name");

## GlideServletRequest - getParameterNames() {#ariaid-title7}

Returns a list of URL parameters that were used in the request URI.
{#r_ScopedGlideServletRequestGetParameterNames__table_wgs_c55_qr__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 11. Parameters]

{#r_ScopedGlideServletRequestGetParameterNames__table_wgs_c55_qr} {#r_ScopedGlideServletRequestGetParameterNames__table_xgs_c55_qr__entry__2}

| Type | Description |
|-|-|
| Array | An array of parameter names as a string. |
[Table 12. Returns]

{#r_ScopedGlideServletRequestGetParameterNames__table_xgs_c55_qr}  

    var paramList = g_request.getParameterNames();

## GlideServletRequest - getQueryString() {#ariaid-title8}

Returns the query string from the request.
{#r_ScopedGlideServletRequestGetQueryString__table_j1h_jqt_vr__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 13. Parameters]

{#r_ScopedGlideServletRequestGetQueryString__table_j1h_jqt_vr} {#r_ScopedGlideServletRequestGetQueryString__table_k1h_jqt_vr__entry__2}

| Type | Description |
|-|-|
| String | The query string. |
[Table 14. Returns]

{#r_ScopedGlideServletRequestGetQueryString__table_k1h_jqt_vr}  
This example uses the request URL:
https://instance.service-now.com/x_custom_app_customApp.do?x_custom_app_name=George\&bell=rung.

    var queryString = g_request.getQueryString();
    g_processor.writeOutput("The query string is: " + queryString);

Output:

    The query string is: x_custom_app_name=George&bell=rung


