use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest in project ecf by eclipse.
the class AbstractBulletinBoard method getMemberGroups.
public Collection<IMemberGroup> getMemberGroups() throws BBException {
if (cachedMemberGroups.isEmpty()) {
final WebRequest request = createMemberGroupListRequest();
try {
request.execute();
final String str = request.getResponseBodyAsString();
request.releaseConnection();
cachedMemberGroups = parser.parseMemberGroups(str);
for (final IMemberGroup grp : cachedMemberGroups.values()) {
((AbstractBBObject) grp).setBulletinBoard(this);
}
} catch (final IOException e) {
// log.error(e);
}
}
return new HashSet<IMemberGroup>(cachedMemberGroups.values());
}
use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest in project ecf by eclipse.
the class AbstractBulletinBoard method getMembers.
public List<IMember> getMembers() throws BBException {
// TODO: this only returns first page
if (cachedMembers.isEmpty()) {
final WebRequest request = createMemberListRequest();
try {
request.execute();
final String str = request.getResponseBodyAsString();
request.releaseConnection();
cachedMembers = parser.parseMembers(str);
for (final IMember member : cachedMembers.values()) {
((AbstractBBObject) member).setBulletinBoard(this);
}
} catch (final IOException e) {
e.printStackTrace();
}
}
return new ArrayList<IMember>(cachedMembers.values());
}
use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest in project ecf by eclipse.
the class PHPBB method createMemberPageRequest.
@Override
protected WebRequest createMemberPageRequest(ID id) {
WebRequest request = new GetRequest(httpClient, url, "profile.php");
NameValuePair[] params = { new NameValuePair("mode", "viewprofile"), new NameValuePair("u", String.valueOf(((MemberID) id).getLongValue())) };
request.setParameters(params);
return request;
}
use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest in project ecf by eclipse.
the class Forum method postThread.
public boolean postThread(IThread thread) throws IllegalWriteException, BBException {
if ((mode & READ_ONLY) == READ_ONLY) {
throw new IllegalWriteException(E_READ_ONLY);
}
WebRequest request = new PostRequest(bb.getHttpClient(), bb.getURL(), "posting.php");
NameValuePair[] params;
params = new NameValuePair[] { new NameValuePair("subject", thread.getPrePostMessage().getName()), new NameValuePair("message", thread.getPrePostMessage().getMessage()), new NameValuePair("f", String.valueOf(id.getLongValue())), new NameValuePair("mode", "newtopic"), // checkbox : disabled new NameValuePair("notify", "on"),
new NameValuePair("post", "Submit") };
request.addParameters(params);
// We seem to always have to get the response body.
try {
request.execute();
request.getResponseBodyAsString();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
request.releaseConnection();
return true;
}
use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest in project ecf by eclipse.
the class ThreadBrowser2 method createRequest.
public WebRequest createRequest(int page) {
/*
* String ppStr =
* bb.getActiveConfiguration().getProperties().getProperty(
* IBBConfiguration.P_POSTS_PER_PAGE);
*/
int pp = 15;
int start = (page - 1) * pp;
WebRequest req = new PostRequest(bb.getHttpClient(), bb.getURL(), "viewtopic.php?t=" + ((ThreadID) thread.getID()).getLongValue() + "&start=" + start);
req.addParameter(new NameValuePair("postorder", "desc"));
req.addParameter(new NameValuePair("postdays", "0"));
req.addParameter(new NameValuePair("submit", "Go"));
return req;
}
Aggregations