use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest in project ecf by eclipse.
the class AbstractBulletinBoard method getMember.
public IMember getMember(ID id) throws BBException {
if (cachedMembers.containsKey(id)) {
return cachedMembers.get(id);
} else {
final WebRequest request = createMemberPageRequest(id);
try {
request.execute();
final String str = request.getResponseBodyAsString();
request.releaseConnection();
final IMember member = parser.parseMemberPageForName(str, id);
if (member != null) {
((AbstractBBObject) member).setBulletinBoard(this);
cachedMembers.put(member.getID(), member);
return member;
}
} catch (final Exception e) {
e.printStackTrace();
}
return null;
}
}
use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest in project ecf by eclipse.
the class VBulletin method createMemberGroupListRequest.
@Override
protected WebRequest createMemberGroupListRequest() {
WebRequest request = new GetRequest(httpClient, url, "profile.php");
request.addParameter(new NameValuePair("do", "editusergroups"));
return request;
}
use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest in project ecf by eclipse.
the class Forum method getThreads.
public Collection<IThread> getThreads() {
PHPBBParser parser = (PHPBBParser) bb.getParser();
Map<ID, IThread> threadMap = null;
try {
WebRequest request = new GetRequest(bb.getHttpClient(), new URL(id.toExternalForm()), "");
request.addParameter(new NameValuePair("f", String.valueOf(id.getLongValue())));
request.execute();
String resp = request.getResponseBodyAsString();
request.releaseConnection();
threadMap = parser.parseThreads(resp);
for (IThread thread : threadMap.values()) {
((AbstractBBObject) thread).setBulletinBoard(bb);
((Thread) thread).forum = this;
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new HashSet<IThread>(threadMap.values());
}
use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest in project ecf by eclipse.
the class ThreadBrowser2 method fetchNewMessages.
public List<IThreadMessage> fetchNewMessages() throws BBException {
List<IThreadMessage> messages = new ArrayList<IThreadMessage>();
try {
int nextPage = STARTPAGE;
while (nextPage > NONE) {
WebRequest req = createRequest(nextPage);
req.execute();
String resp = req.getResponseBodyAsString();
req.releaseConnection();
// Add messages from page
messages.addAll(0, ((PHPBBParser) bb.getParser()).parseMessages2(resp, thread.lastReadMessageId, true));
nextPage = ((PHPBBParser) bb.getParser()).parseNextPage(resp);
}
} catch (IOException e) {
e.printStackTrace();
}
return messages;
}
use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest in project ecf by eclipse.
the class Forum method getThreads.
public Collection<IThread> getThreads() {
VBParser parser = (VBParser) bb.getParser();
Map<ID, IThread> threadMap = null;
WebRequest request = new GetRequest(bb.getHttpClient(), getURL(), "");
request.addParameter(new NameValuePair("f", String.valueOf(id.getLongValue())));
try {
request.execute();
String resp = request.getResponseBodyAsString();
request.releaseConnection();
threadMap = parser.parseThreads(resp);
for (IThread thread : threadMap.values()) {
((AbstractBBObject) thread).setBulletinBoard(bb);
((Thread) thread).forum = this;
}
} catch (IOException e) {
e.printStackTrace();
}
return new HashSet<IThread>(threadMap.values());
}
Aggregations