Package org.apache.abdera.protocol.server.provider

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


    if (provider == null) {
      noprovider(response);
      return false;
    }
    // Check The Target
    Target target = request.getTarget();
    if (target == null) {
      notfound(response);
      return false;
    }
    // Check The Method
    if (!checkMethod(request)) {
      notallowed(
        response,
        request.getMethod(),
        getAllowedMethods(target.getType()));
      return false;
    }
    // Check The Conditions
    ResponseInfo info = provider.getInfo(request);
    switch(checkConditions(info, request)) {
View Full Code Here


 
  protected boolean checkMethod(
    RequestContext context)
      throws IOException {
    String method = context.getMethod();
    Target target = context.getTarget();
    String[] methods = getAllowedMethods(target.getType());
    java.util.Arrays.sort(methods);
    return (java.util.Arrays.binarySearch(methods, method) >= 0);
  }
View Full Code Here

    RegexTargetResolver r = new RegexTargetResolver();
    r.setPattern("/test", TargetType.TYPE_SERVICE);
    r.setPattern("/test/([^/?#]+)", TargetType.TYPE_COLLECTION);
   
    DummyRequestContext drc = null;
    Target target = null;
   
    drc = new DummyRequestContext("/test","http://example.org/");
    target = r.resolve(drc);
    assertNotNull(target);
    assertEquals(target.getType(), TargetType.TYPE_SERVICE);
   
    drc = new DummyRequestContext("/test/foo","http://example.org/");
    target = r.resolve(drc);
    assertNotNull(target);
    assertEquals(target.getType(), TargetType.TYPE_COLLECTION);
   
    drc = new DummyRequestContext("/test/foo/","http://example.org/");
    target = r.resolve(drc);
    assertNull(target);
View Full Code Here

TOP

Related Classes of org.apache.abdera.protocol.server.provider.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.