Note:
See
the sample files XMLApiAdapter.java, login.jsp, and mymeetings.jsp
When you are building a custom application, it’s very handy to
have an adapter class. You create an instance of the class for each
user login session, and the adapter handles connecting to the server,
logging the user in, making requests to the XML API, and parsing
XML responses.
Write constructors for the adapter class
The
following constructor (from the sample application file XMLApiAdapter.java) creates
an instance of the adapter class to represent a user accessing Adobe Connect.
This is the constructor to use when you already have the
BREEZESESSION
cookie
value (see
Log in from an application
). The constructor also
calls the
createXPaths
method to create valid XPath
instances to use in other methods:
public XMLApiAdapter(String baseUrl, String breezesession)
throws XMLApiException {
this.setBaseUrl(baseUrl);
this.breezesession = breezesession;
createXPaths();
}
The second constructor takes a user’s login
ID and password, as well as a
BREEZESESSION
cookie
value:
public XMLApiAdapter(String baseUrl, String login, String password,
String breezesession) throws XMLApiException {
this(baseUrl, breezesession);
this.setLogin(login);
this.setPassword(password);
}
You can get the
BREEZESESSION
cookie value before
the user logs in by calling
common-info
.
Create an instance of the adapter
The following code (from
mymeetings.jsp) creates an instance of the
XMLApiAdapter
class
to represent a user who is logged in to Adobe Connect. The current
value of
breezesession
, which holds the
BREEZESESSION
cookie
value, is then stored in the JSP
session
attribute
for other files to access.
<%! XMLApiAdapter breeze = null; %>
<%
...
breeze = new XMLApiAdapter(breezeBase, login, password, breezesession);
breeze.getBreezesession();
session.setAttribute("breezesession", breeze);
...
%>
|
|
|