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

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


            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

        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

            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

    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

            return (ResponseContext) res.getPayload();
        }
        catch (MuleException e)
        {
            log.error(e);
            return new EmptyResponseContext(500);
        }
    }
View Full Code Here

                                  Date updated,
                                  List<Person> authors,
                                  Content content,
                                  Session session) throws ResponseContextException, RepositoryException {
        if (title == null) {
            EmptyResponseContext ctx = new EmptyResponseContext(500);
            ctx.setStatusText("Entry title cannot be empty.");
            throw new ResponseContextException(ctx);
        }

        entry.setProperty(TITLE, title);
View Full Code Here

 
  /**
   * Return a 204 No Content response
   */
  public static ResponseContext nocontent(String reason) {
    return new EmptyResponseContext(204,reason);
  }
View Full Code Here

 
  public static ResponseContext notmodified(
    RequestContext request,
    String reason) {
      log.debug(Localizer.get("NOT.MODIFIED"));
      return new EmptyResponseContext(304,reason);
  }
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.