Examples of EmptyResponseContext


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

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

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

        MultipartRelatedPost post = getMultipartRelatedData(request);
        //Post object is a wrapper for the media resource and the media link entry.
        //Once we get it we can save them following the rfc specification.
      }
     
      return new EmptyResponseContext(201);
    } catch (ParseException pe) {     
      return new EmptyResponseContext(415, pe.getLocalizedMessage());
    } catch (IOException ioe) {     
      return new EmptyResponseContext(500, ioe.getLocalizedMessage());
    } catch (MessagingException e) {     
      return new EmptyResponseContext(500, e.getLocalizedMessage());
    }
  }
View Full Code Here

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

     * Creates the ResponseContext for a HEAD entry request. By default, an 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

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

                MultipartRelatedPost post = getMultipartRelatedData(request);
                // Post object is a wrapper for the media resource and the media link entry.
                // Once we get it we can save them following the rfc specification.
            }

            return new EmptyResponseContext(201);
        } catch (ParseException pe) {
            return new EmptyResponseContext(415, pe.getLocalizedMessage());
        } catch (IOException ioe) {
            return new EmptyResponseContext(500, ioe.getLocalizedMessage());
        } catch (MessagingException e) {
            return new EmptyResponseContext(500, e.getLocalizedMessage());
        }
    }
View Full Code Here

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

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

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

        return unavailable(request, "Service Unavailable");
    }

    public static ResponseContext notmodified(RequestContext request, String reason) {
        log.debug(Localizer.get("NOT.MODIFIED"));
        return new EmptyResponseContext(304, reason);
    }
View Full Code Here

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

            String id = getResourceName(request);
            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.impl.EmptyResponseContext

      Parser parser = abdera.getParser();
      try {
        MimeType contentType = request.getContentType();
        String ctype = (contentType != null) ? contentType.toString() : null;
        if (ctype != null && !MimeTypeHelper.isAtom(ctype) && !MimeTypeHelper.isXml(ctype))
          return new EmptyResponseContext(415);

        Document<Entry> entry_doc =
          (Document<Entry>) request.getDocument(parser).clone();
        if (entry_doc != null) {
          Entry entry = entry_doc.getRoot();
          if (!isValidEntry(entry))
            return new EmptyResponseContext(400);
          entry.setUpdated(new Date());
          entry.getIdElement().setValue(factory.newUuidUri());
          entry.addLink("feed/" + entry.getId().toString(), "edit");
          Feed feed = get_feed_doc(abdera).getRoot();
          feed.insertEntry(entry);
          feed.setUpdated(new Date());
          BaseResponseContext rc = new BaseResponseContext(entry);
          IRI baseUri = resolveBase(request);
          rc.setLocation(baseUri.resolve(entry.getEditLinkResolvedHref()).toString());
          rc.setContentLocation(rc.getLocation().toString());
          rc.setEntityTag(calculateEntityTag(entry));
          rc.setStatus(201);
          return rc;
        } else {
          return new EmptyResponseContext(400);
        }
      } catch (ParseException pe) {
        return new EmptyResponseContext(415);
      } catch (ClassCastException cce) {
        return new EmptyResponseContext(415);
      } catch (Exception e) {
        return new EmptyResponseContext(400);
      }
  }
View Full Code Here

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

  public ResponseContext deleteEntry(
    RequestContext request) {
      Entry entry = getAbderaEntry(request);
      if (entry != null)
        entry.discard();
      return new EmptyResponseContext(204);
  }
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.