Package org.eclipse.ecf.internal.bulletinboard.commons.webapp

Examples of org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest


    return new GetRequest(httpClient, url, "memberlist.php");
  }

  @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;
  }
View Full Code Here


  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;
      }
View Full Code Here

  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("disable_smilies",
        // "on"),
        // checkbox : disabled new NameValuePair("disable_bbcode",
        // "on"),
        // 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;
  }
View Full Code Here

  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;
View Full Code Here

  protected abstract WebRequest createMemberListRequest();

  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) {
View Full Code Here

  protected abstract WebRequest createMemberGroupListRequest();

  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) {
View Full Code Here

  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);
      }
View Full Code Here

     * 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;
  }
View Full Code Here

  }

  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;
      }
View Full Code Here

    return new GetRequest(httpClient, url, "memberlist.php");
  }

  @Override
  protected WebRequest createMemberPageRequest(ID id) {
    WebRequest request = new GetRequest(httpClient, url, "member.php");

    NameValuePair params[] = { new NameValuePair("u", String
        .valueOf(((MemberID) id).getLongValue())) };
    request.setParameters(params);
    return request;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.internal.bulletinboard.commons.webapp.WebRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.