| | The RESTful client
The RESTful client is a small web application that
provides features for working with RESTful services
Getting the RESTful client
- It is available
on the gf server, and you can use it to interact with services deployed in
the gf server
- You can download
the war file into the domains/domain1/autodeploy
directory of a GlassFish installation. That will allow you to work with
RESTful services deployed in that GlassFish instance. (your browser will
probably change the file extension from .war to .zip, which is OK) The context root is
"restful-client"
If you are using the default ports for GlassFish, and it is running on your
PC, the client's URL should be http://localhost:8080/restful-client/
Screenshot
When you start the client, it should look something
like this
Using the RESTful client
- Typical use of the RESTful client follows this
pattern:
- Fill in the Request URL
- Fill in the names and values of parameters to be
sent in the query string, if any
- Fill in the request content, if any
- Click the button to send the desired http request
type
- The request URL, parameters and content can be typed
into the appropriate boxes in the form. They can also be entered in several
other ways. See the description of the command buttons below for more
information.
- Command buttons and other controls
- Get button - sends an http GET request
- Post button - sends an http POST request
- Put button - sends an http PUT request
- Delete button - sends an http DELETE request
- Previous button - replace the request URL,
parameters and content with those of the previous request
- Next button - if the URL, parameters and content
did not come from the most recent request (for example, if you have just
pressed the Previous button several times), restore the URL, parameters
and content of the request that came next
- Clear names button - clear all Parameter name
entries. Parameter values are ignored if they are not associated with a
name, so pressing this button followed by an http request button has the
effect of removing all the parameters from the request
- Clear values button - clear all Parameter value
entries
- Clear all button - clear all Parameter names and
values
- Headers button - display the most recent response
headers
- Plain button - display the most recent response
content as plain text instead of formatted XML or HTML
- Set team button - some features require a name
(or team name) for the person using the client. The default is
"dino", which is appropriate for working with my reference
implementation of the DiNo project. If you're working with my reference
implementation of the Java homework, click this button and enter
"don". Click this button and replace it
with your servlet's context root to work with your Java homework or DiNo
implementation.
- Notebook button - replaces the request content
text area with a template for DiNo notebook XML
- Note button - replaces the request content text
area with a template for DiNo note XML
- Menu button - replaces the request content text
area with a template for menu service XML
- base URL menu (in the upper right of the input
frame) - allows one-click setup of some of the most common requests
- Output areas
- Last operation - displays the most recent URL
sent to the server
- Response code - the http response code from the
most recent request
- Response text - the http response text from the
most recent request
- Response - the lower right-hand frame is
dedicated to displaying the most recent response content from the
server, if any, either as formatted XML, HTML or plain text (see the
"Plain" button)
Screenshot 2
After sending several items to the menu service,
followed by a GET, the client might look like this
Constraints, issues and known problems
- Depending on your browser security settings, you may
not be able to use the RESTful client with services deployed outside the app
server where you deployed the war file. If so, you will have to deploy the
war file in each app server instance where you have services that you want
to exercise with the RESTful client.
- The client was originally developed to work in both
Internet Explorer and FireFox. However, most of my experience with it has
been in IE, so there may well be FireFox issues that I don't know about.
Please contact me if you find
some.
- The number of request parameters and the size of the
request context box are fixed. A nice enhancement would be to allow the user
to change them.
- The baseURL drop-down menu is just some javascript in
the client. It would be nice if there were a way for the user to extend it.
- If you are comfortable with javascript, you can make
a custom version of the restful-client that behaves the way you want.
An alternative
I have heard good things about this
FireFox plug-in. If you try it, please let
me know what your experience is.
|