Examples of EmptyResponseContext


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

      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

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

        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

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

        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

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

    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

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

      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

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

      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

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

    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

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

    try {
      String id = getResourceName(request);
      T entryObj = getEntry(id, request);
     
      if (entryObj == null) {
        return new EmptyResponseContext(404);
      }
     
      Entry orig_entry = getEntryFromCollectionProvider(entryObj, new IRI(getFeedIriForEntry(entryObj, request)), request);
      if (orig_entry != null) {

        MimeType contentType = request.getContentType();
        if (contentType != null && !MimeTypeHelper.isAtom(contentType.toString()))
          return new EmptyResponseContext(415);

        Entry entry = getEntryFromRequest(request);
        if (entry != null) {
          if (!entry.getId().equals(orig_entry.getId()))
            return new EmptyResponseContext(409);

          if (!ProviderHelper.isValidEntry(entry))
            return new EmptyResponseContext(400);

          putEntry(entryObj, entry.getTitle(), new Date(), entry.getAuthors(),
                      entry.getSummary(), entry.getContentElement(), request);
          return new EmptyResponseContext(204);
        } else {
          return new EmptyResponseContext(400);
        }
      } else {
        return new EmptyResponseContext(404);
      }
    } catch (ResponseContextException e) {
      return createErrorResponse(e);
    } catch (ParseException pe) {
      return new EmptyResponseContext(415);
    } catch (ClassCastException cce) {
      return new EmptyResponseContext(415);
    } catch (Exception e) {
      log.warn(e.getMessage(), e);
      return new EmptyResponseContext(400);
    }
   
  }
View Full Code Here

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

      addMediaContent(feedUri, entry, entryObj, request);

      String location = getLink(entryObj, feedUri, request, true);
      return buildPostMediaEntryResponse(location, entry);
    } catch (IOException e) {
      return new EmptyResponseContext(500);
    } catch (ResponseContextException e) {
      return createErrorResponse(e);
    }
  }
View Full Code Here

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

  protected ResponseContext createNonMediaEntry(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 feedUri = getFeedIRI(entryObj, request);

        String link = getLink(entryObj, feedUri, request);
        entry.addLink(link, "edit");

        String location = getLink(entryObj, feedUri, request, true);
        return buildCreateEntryResponse(location, entry);
      } else {
        return new EmptyResponseContext(400);
      }
    } catch (ResponseContextException e) {
      return createErrorResponse(e);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.