Package org.apache.abdera.protocol.server.context

Examples of org.apache.abdera.protocol.server.context.EmptyResponseContext


   * is returned.  The Etag header will be set.
   */ 
  protected ResponseContext buildHeadEntryResponse(RequestContext request,
                                                   String id,
                                                   Date updated) throws ResponseContextException {
    EmptyResponseContext rc = new EmptyResponseContext(200);
    rc.setEntityTag(EntityTag.generate(id, AtomDate.format(updated)));
    return rc;
  }
View Full Code Here


      String mediaLink = addMediaContent(feedIri, entry, entryObj, request);

      return buildPostMediaEntryResponse(mediaLink, entry);
    } catch (IOException e) {
      return new EmptyResponseContext(500);
    } catch (ResponseContextException e) {
      return createErrorResponse(e);
    }
  }
View Full Code Here

      T entryObj = getEntry(id, request);
     
      putMedia(entryObj, request.getContentType(), request.getSlug(),
               request.getInputStream(), request);

      return new EmptyResponseContext(200);
    } catch (IOException e) {
      return new EmptyResponseContext(500);
    } catch (ResponseContextException e) {
      return createErrorResponse(e);
    }
  }
View Full Code Here

  public ResponseContext postEntry(RequestContext request) {
    try {
      Entry entry = getEntryFromRequest(request);
      if (entry != null) {
        if (!ProviderHelper.isValidEntry(entry))
          return new EmptyResponseContext(400);
 
        entry.setUpdated(new Date());
       
       
          T entryObj = postEntry(entry.getTitle(),
                                 entry.getId(),
                                 entry.getSummary(),
                                 entry.getUpdated(),
                                 entry.getAuthors(),
                                 entry.getContentElement(), request);
          entry.getIdElement().setValue(getId(entryObj));
       
          IRI feedIri = getFeedIRI(entryObj, request);   
          String link = getLink(entryObj, feedIri, request);
         
          entry.addLink(link, "edit");
   
          return buildCreateEntryResponse(link, entry);
      } else {
        return new EmptyResponseContext(400);
      }
    } catch (ResponseContextException e) {
      return createErrorResponse(e);
    }
  }
View Full Code Here

        deleteEntry(id, request);
      } catch (ResponseContextException e) {
        return createErrorResponse(e);
      }
     
      return new EmptyResponseContext(204);
    } else {
      // TODO: is this right?
      return new EmptyResponseContext(404);
    }
  }
View Full Code Here

        deleteMedia(resourceName, request);
      } catch (ResponseContextException e) {
        return createErrorResponse(e);
      }
     
      return new EmptyResponseContext(204);
    } else {
      // TODO: is this right?
      return new EmptyResponseContext(404);
    }
  }
View Full Code Here

    try {
      Entry entry = getEntryFromCollectionProvider(request);
      if (entry != null) {
        return buildGetEntryResponse(request, entry);
      } else {
        return new EmptyResponseContext(404);
      }
    } catch (ResponseContextException e) {
      return createErrorResponse(e);
    }
  }
View Full Code Here

      T entryObj = getEntry(resourceName, request);

      if (entryObj != null) {
        return buildHeadEntryResponse(request, resourceName, getUpdated(entryObj));
      } else {
        return new EmptyResponseContext(404);
      }
    } catch (ResponseContextException e) {
      return createErrorResponse(e);
    }
  }
View Full Code Here

      T entryObj = getEntry(resourceName, request);

      if (entryObj != null) {
        return buildHeadEntryResponse(request, resourceName, getUpdated(entryObj));
      } else {
        return new EmptyResponseContext(404);
      }
    } catch (ResponseContextException e) {
      return createErrorResponse(e);
    }
  }
View Full Code Here

    try {
      String resource = getResourceName(request);
      T entryObj = getEntry(resource, request);

      if (entryObj == null) {
        return new EmptyResponseContext(404);
      }

      return buildGetMediaResponse(resource, entryObj);
    } catch (ParseException pe) {
      return new EmptyResponseContext(415);
    } catch (ClassCastException cce) {
      return new EmptyResponseContext(415);
    } catch (ResponseContextException e) {
      return e.getResponseContext();
    } catch (Exception e) {
      log.warn(e.getMessage(), e);
      return new EmptyResponseContext(400);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.abdera.protocol.server.context.EmptyResponseContext

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.