Search in sources :

Example 1 with GetRequest

use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest in project ecf by eclipse.

the class MemberGroup method attainDetailsFetched.

private void attainDetailsFetched() {
    if (!detailsFetched) {
        GetRequest request = new GetRequest(bb.getHttpClient(), bb.getURL(), "groupcp.php");
        request.addParameter(new NameValuePair("g", String.valueOf(id.getLongValue())));
        String resp = null;
        try {
            request.execute();
            resp = request.getResponseBodyAsString();
        } catch (IOException e) {
            e.printStackTrace();
        }
        request.releaseConnection();
        if (resp != null) {
            MemberGroup group = ((PHPBBParser) bb.getParser()).parseMemberGroup(resp);
            group.detailsFetched = true;
            this.description = group.getDescription();
        }
    }
}
Also used : IMemberGroup(org.eclipse.ecf.bulletinboard.IMemberGroup) NameValuePair(org.apache.commons.httpclient.NameValuePair) GetRequest(org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest) IOException(java.io.IOException)

Example 2 with GetRequest

use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest in project ecf by eclipse.

the class MemberGroup method getMembers.

public Collection<IMember> getMembers() {
    Map<ID, IMember> map = Collections.emptyMap();
    GetRequest request = new GetRequest(bb.getHttpClient(), bb.getURL(), "groupcp.php");
    request.addParameter(new NameValuePair("g", String.valueOf(id.getLongValue())));
    try {
        request.execute();
        String str = request.getResponseBodyAsString();
        request.releaseConnection();
        if (str != null) {
            map = bb.getParser().parseMembers(str);
            for (IMember member : map.values()) {
                ((AbstractBBObject) member).setBulletinBoard(bb);
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    return new HashSet<IMember>(map.values());
}
Also used : NameValuePair(org.apache.commons.httpclient.NameValuePair) AbstractBBObject(org.eclipse.ecf.internal.bulletinboard.commons.AbstractBBObject) GetRequest(org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest) ID(org.eclipse.ecf.core.identity.ID) MemberGroupID(org.eclipse.ecf.internal.provider.phpbb.identity.MemberGroupID) IOException(java.io.IOException) IMember(org.eclipse.ecf.bulletinboard.IMember) HashSet(java.util.HashSet)

Example 3 with GetRequest

use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest in project ecf by eclipse.

the class PHPBB method getMessage.

public IThreadMessage getMessage(ID id) throws BBException {
    GetRequest request = new GetRequest(httpClient, url, "viewtopic.php");
    request.addParameter(new NameValuePair("p", String.valueOf(((ThreadMessageID) id).getLongValue())));
    String resp = null;
    try {
        request.execute();
        resp = request.getResponseBodyAsString();
    } catch (IOException e) {
        e.printStackTrace();
    }
    request.releaseConnection();
    if (resp != null) {
        ThreadMessage msg = getParser().parseRequestedMessage((ThreadMessageID) id, resp);
        msg.setBulletinBoard(this);
        IMember author = msg.author;
        ((Member) author).setBulletinBoard(this);
        return msg;
    }
    return null;
}
Also used : NameValuePair(org.apache.commons.httpclient.NameValuePair) GetRequest(org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest) IOException(java.io.IOException) IThreadMessage(org.eclipse.ecf.bulletinboard.IThreadMessage) IMember(org.eclipse.ecf.bulletinboard.IMember) IMember(org.eclipse.ecf.bulletinboard.IMember)

Example 4 with GetRequest

use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest in project ecf by eclipse.

the class PHPBB method getTitle.

public String getTitle() throws BBException {
    if (this.title == null) {
        GetRequest request = new GetRequest(httpClient, url, "");
        String resp = null;
        try {
            request.execute();
            resp = request.getResponseBodyAsString();
        } catch (IOException e) {
            throw new BBException(e);
        }
        request.releaseConnection();
        if (resp != null) {
            this.title = getParser().parseTitle(resp);
        }
    }
    return this.title;
}
Also used : GetRequest(org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest) BBException(org.eclipse.ecf.bulletinboard.BBException) IOException(java.io.IOException)

Example 5 with GetRequest

use of org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest in project ecf by eclipse.

the class VBulletin method getThread.

public IThread getThread(ID id) throws BBException {
    GetRequest request = new GetRequest(httpClient, url, "showthread.php");
    request.addParameter(new NameValuePair("t", String.valueOf(((ThreadID) id).getLongValue())));
    String resp = null;
    try {
        request.execute();
        resp = request.getResponseBodyAsString();
    } catch (IOException e) {
        e.printStackTrace();
    }
    request.releaseConnection();
    if (resp != null) {
        Thread t = getParser().parseThreadPageForThreadAttributes(resp);
        t.setBulletinBoard(this);
        return t;
    }
    return null;
}
Also used : NameValuePair(org.apache.commons.httpclient.NameValuePair) GetRequest(org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest) IOException(java.io.IOException) IThread(org.eclipse.ecf.bulletinboard.IThread)

Aggregations

GetRequest (org.eclipse.ecf.internal.bulletinboard.commons.webapp.GetRequest)14 IOException (java.io.IOException)11 NameValuePair (org.apache.commons.httpclient.NameValuePair)10 WebRequest (org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest)5 IThread (org.eclipse.ecf.bulletinboard.IThread)4 HashSet (java.util.HashSet)3 ID (org.eclipse.ecf.core.identity.ID)3 AbstractBBObject (org.eclipse.ecf.internal.bulletinboard.commons.AbstractBBObject)3 ArrayList (java.util.ArrayList)2 BBException (org.eclipse.ecf.bulletinboard.BBException)2 IForum (org.eclipse.ecf.bulletinboard.IForum)2 IMember (org.eclipse.ecf.bulletinboard.IMember)2 URL (java.net.URL)1 IMemberGroup (org.eclipse.ecf.bulletinboard.IMemberGroup)1 IThreadMessage (org.eclipse.ecf.bulletinboard.IThreadMessage)1 ForumID (org.eclipse.ecf.internal.provider.phpbb.identity.ForumID)1 MemberGroupID (org.eclipse.ecf.internal.provider.phpbb.identity.MemberGroupID)1 ForumID (org.eclipse.ecf.internal.provider.vbulletin.identity.ForumID)1