Package org.apache.abdera.protocol.server

Examples of org.apache.abdera.protocol.server.Target


    protected abstract TargetBuilder getTargetBuilder(RequestContext request);

    protected abstract Resolver<Target> getTargetResolver(RequestContext request);

    public ResponseContext process(RequestContext request) {
        Target target = request.getTarget();
        if (target == null || target.getType() == TargetType.TYPE_NOT_FOUND) {
            return ProviderHelper.notfound(request);
        }

        TargetType type = target.getType();
        RequestProcessor processor = this.requestProcessors.get(type);
        if (processor == null) {
            return ProviderHelper.notfound(request);
        }
View Full Code Here


            !MimeTypeHelper.isXml(contentType))
          return ProviderHelper.notsupported(request);
        Abdera abdera = request.getAbdera();
        Parser parser = abdera.getParser();
        Entry inputEntry = (Entry) request.getDocument(parser).getRoot();
        Target target = request.getTarget();
        String entryId =
          !createFlag ?
            target.getParameter(
              BasicProvider.PARAM_ENTRY) : null;
        Entry newEntry = createFlag
            ? createEntry(inputEntry)
            : updateEntry(entryId, inputEntry);
        if (newEntry != null) {
View Full Code Here

      return createOrUpdateEntry(request, true);
  }
 
  public ResponseContext deleteEntry(
    RequestContext request) {
      Target target = request.getTarget();
      String entryId = target.getParameter(BasicProvider.PARAM_ENTRY);
      try {
        return deleteEntry(entryId) ?
          ProviderHelper.nocontent() :
          ProviderHelper.notfound(request);
      } catch (Exception e) {
View Full Code Here

      return createOrUpdateEntry(request, false);
  }

  public ResponseContext getEntry(
    RequestContext request) {
      Target target = request.getTarget();
      String entryId = target.getParameter(BasicProvider.PARAM_ENTRY);
      try {
        Entry entry = getEntry(entryId);
        return entry != null ?
          ProviderHelper.returnBase(entry.getDocument(),200,null) :
          ProviderHelper.notfound(request);
View Full Code Here

     
  }
 
  protected Target initTarget() {
    try {
      Target target = provider.resolveTarget(this);
      return target != null ? target : new SimpleTarget(TargetType.TYPE_NOT_FOUND, this);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

 
  public ResponseContext filter(
    RequestContext request,
    FilterChain chain) {
   
      Target target = request.getTarget();
      TargetType type = target.getType();
      if (type == TYPE_OPENSEARCH_DESCRIPTION) {
        return getOpenSearchDescription(request);
      } else {
        for (Entry<String,String> entry : map.entrySet()) {
          String value = target.getParameter(entry.getKey());
          if (value != null)
            request.setAttribute(
              OS_PREFIX + "_" + entry.getValue(), value);
        }
        return chain.next(request);
View Full Code Here

        vars.add(toVar(Variable.SESSION_ATTRIBUTE,var));     
      for (String var : request.getAttributeNames(Scope.REQUEST))
        vars.add(toVar(Variable.REQUEST_ATTRIBUTE,var));     
      for (String var : request.getHeaderNames())
        vars.add(toVar(Variable.REQUEST_HEADER, var));       
      Target target = request.getTarget();
      for (String var : target.getParameterNames())
        vars.add(toVar(Variable.TARGET_PARAMETER, var));     
      vars.add(Variable.REQUEST_CONTEXT_PATH.name().toLowerCase());
      vars.add(Variable.REQUEST_CONTENT_TYPE.name().toLowerCase());
      vars.add(Variable.REQUEST_URI.name().toLowerCase());
      vars.add(Variable.REQUEST_RESOLVED_URI.name().toLowerCase());
View Full Code Here

     *
     * @return a ResponseContext indicating the disposition of the request
     */
    @SuppressWarnings({"ConstantConditions"})
    public ResponseContext extensionRequest(RequestContext request) {
        Target target = request.getTarget();
        final TargetType type = target.getType();
        if (!(target instanceof ResourceTarget)) {
            if (type.equals(ResponseTarget.RESPONSE_TYPE)) {
                return ((ResponseTarget) target).getResponse();
            }
            // Deal with non-resource URLs, like "/tags..."
View Full Code Here

    }

    protected Target initTarget() {
        try {
            Target target = provider.resolveTarget(this);
            return target != null ? target : new SimpleTarget(TargetType.TYPE_NOT_FOUND, this);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        getEntries(request, feed, root);
        return ProviderHelper.returnBase(feed.getDocument(), 200, null);
    }

    public ResponseContext deleteEntry(RequestContext request) {
        Target target = request.getTarget();
        String key = target.getParameter("entry");
        File file = getFile(key, false);
        if (file.exists())
            file.delete();
        return ProviderHelper.nocontent();
    }
View Full Code Here

TOP

Related Classes of org.apache.abdera.protocol.server.Target

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.