show

Class: matlab.net.http.Message, matlab.net.http.RequestMessage, matlab.net.http.ResponseMessage
Package: matlab.net.http

Display or return formatted version of message

Description

example

show(msg) displays the whole message in the Command Window, including the Header and Body properties. If Body contains binary data that cannot be converted to characters, then the method displays a message indicating the length of the data in bytes.

Use this syntax for diagnostics or debugging.

example

show(msg,maxlength) displays the first maxlength characters of Body. If Body is longer than maxlength characters, then the method displays the total length of the data.

str = show(___) returns a string containing the information to be displayed, and can include any of the input arguments in previous syntaxes.

Input Arguments

expand all

Message, specified as a matlab.net.http.Message object or vector of Message objects.

Number of bytes, specified as an integer to convert.

Examples

expand all

When a message body contains image/jpeg data, MATLAB displays the number of bytes in the image.

Send a message to the heritage.stsci.edu website requesting an image of Jupiter. Display the response message.

request = matlab.net.http.RequestMessage;
uri = matlab.net.URI('http://heritage.stsci.edu/2007/14/images/p0714aa.jpg');
r = send(request,uri);
show(r)
HTTP/1.1 200 OK
Date: Tue, 09 Aug 2016 19:58:56 GMT
Server: Apache/2.2.15  Red Hat  mod_ssl/2.2.15 OpenSSL/1.0.1e-fips Phusion_Passenger/4.0.23 DAV/2 PHP/5.4.16
Last-Modified: Thu, 08 Mar 2007 18:56:52 GMT
ETag: "1ca16a7-31265-42b2edeb90500"
Accept-Ranges: bytes
Content-Length: 201317
Connection: close
Content-Type: image/jpeg

<< 201317 bytes of image/jpeg data >>

Display the first 100 characters only of the body of a message from mathworks.com. MATLAB displays text indicating the total number of characters in the message body.

request = matlab.net.http.RequestMessage;
uri = matlab.net.URI('https://www.mathworks.com');
r = send(request,uri);
show(r,100)
HTTP/1.1 200 OK
Date: Mon, 02 Oct 2017 12:55:05 GMT
Server: Apache/2.2.15 (CentOS)
Host-ID: wcxm4
X-Content-Type-Options: nosniff
Last-Modified: Sun, 01 Oct 2017 16:57:27 GMT
ETag: "f4b6"
Accept-Ranges: bytes
Cache-Control: max-age=14400
Expires: Mon, 02 Oct 2017 16:55:05 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 9500
Content-Type: text/html; charset=UTF-8
Connection: close

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-w

<< 62581 total characters of text/html UTF-8 data >>

Introduced in R2016b