Package org.apache.abdera.protocol.server.impl

Examples of org.apache.abdera.protocol.server.impl.RegexTargetResolver$RegexTarget


  public CustomProvider() {
   
    this.adapter = new SimpleAdapter();
   
    setTargetResolver(     
      new RegexTargetResolver()
        .setPattern("/atom(\\?[^#]*)?", TargetType.TYPE_SERVICE)
        .setPattern("/atom/([^/#?]+);categories", TargetType.TYPE_CATEGORIES, "collection")
        .setPattern("/atom/([^/#?;]+)(\\?[^#]*)?", TargetType.TYPE_COLLECTION, "collection")
        .setPattern("/atom/([^/#?]+)/([^/#?]+)(\\?[^#]*)?", TargetType.TYPE_ENTRY, "collection","entry")
        .setPattern("/search", OpenSearchFilter.TYPE_OPENSEARCH_DESCRIPTION)
View Full Code Here


    private List<String> entries;
    private List<String> media;
    private List<String> categories;

    public Object getObject() throws Exception {
        RegexTargetResolver resolver = new RegexTargetResolver();

        init(resolver, services, TargetType.TYPE_SERVICE);
        init(resolver, collections, TargetType.TYPE_COLLECTION);
        init(resolver, entries, TargetType.TYPE_ENTRY);
        init(resolver, media, TargetType.TYPE_MEDIA);
View Full Code Here

    public CustomProvider() {
        // Create the adapter that will handle all of the requests processed by this provider
        this.adapter = new SimpleAdapter();

        // The target resolver provides the URL path mappings
        super.setTargetResolver(new RegexTargetResolver().setPattern("/atom(\\?[^#]*)?", TargetType.TYPE_SERVICE)
            .setPattern("/atom/([^/#?]+);categories", TargetType.TYPE_CATEGORIES, "collection")
            .setPattern("/atom/([^/#?;]+)(\\?[^#]*)?", TargetType.TYPE_COLLECTION, "collection")
            .setPattern("/atom/([^/#?]+)/([^/#?]+)(\\?[^#]*)?", TargetType.TYPE_ENTRY, "collection", "entry"));

        // The target builder is used to construct url's for the various targets
View Full Code Here

    public CustomProvider() {

        this.adapter = new SimpleAdapter();

        setTargetResolver(new RegexTargetResolver().setPattern("/atom(\\?[^#]*)?", TargetType.TYPE_SERVICE)
            .setPattern("/atom/([^/#?]+);categories", TargetType.TYPE_CATEGORIES, "collection")
            .setPattern("/atom/([^/#?;]+)(\\?[^#]*)?", TargetType.TYPE_COLLECTION, "collection")
            .setPattern("/atom/([^/#?]+)/([^/#?]+)(\\?[^#]*)?", TargetType.TYPE_ENTRY, "collection", "entry")
            .setPattern("/search", OpenSearchFilter.TYPE_OPENSEARCH_DESCRIPTION));

View Full Code Here

    public void init(Abdera abdera, Map<String, String> properties) {
        // can receive servlet init params here
        super.init(abdera, properties);

        // map paths to handlers
        RegexTargetResolver resolver = new OrderedRegexTargetResolver();
        resolver.setPattern("/service", TargetType.TYPE_SERVICE)
                .setPattern("/(http[^#?]*)/([0-9a-fA-F]{11})",
                        TargetType.TYPE_ENTRY, "collection", "entry")
                // external entry
                .setPattern("/(http[^#?]*)", TargetType.TYPE_COLLECTION,
                        "collection")
View Full Code Here

  public CustomProvider() {
   
    this.adapter = new SimpleAdapter();
   
    setTargetResolver(     
      new RegexTargetResolver()
        .setPattern("/atom(\\?[^#]*)?", TargetType.TYPE_SERVICE)
        .setPattern("/atom/([^/#?]+);categories", TargetType.TYPE_CATEGORIES, "collection")
        .setPattern("/atom/([^/#?;]+)(\\?[^#]*)?", TargetType.TYPE_COLLECTION, "collection")
        .setPattern("/atom/([^/#?]+)/([^/#?]+)(\\?[^#]*)?", TargetType.TYPE_ENTRY, "collection","entry")
        .setPattern("/search", OpenSearchFilter.TYPE_OPENSEARCH_DESCRIPTION)
View Full Code Here

    // Create the adapter that will handle all of the requests processed by this provider
    this.adapter = new SimpleAdapter();
   
    // The target resolver provides the URL path mappings
    super.setTargetResolver(     
      new RegexTargetResolver()
        .setPattern("/atom(\\?[^#]*)?", TargetType.TYPE_SERVICE)
        .setPattern("/atom/([^/#?]+);categories", TargetType.TYPE_CATEGORIES, "collection")
        .setPattern("/atom/([^/#?;]+)(\\?[^#]*)?", TargetType.TYPE_COLLECTION, "collection")
        .setPattern("/atom/([^/#?]+)/([^/#?]+)(\\?[^#]*)?", TargetType.TYPE_ENTRY, "collection","entry")
    );
View Full Code Here

    private List<String> entries;
    private List<String> media;
    private List<String> categories;
   
    public Object getObject() throws Exception {
        RegexTargetResolver resolver = new RegexTargetResolver();
       
        init(resolver, services, TargetType.TYPE_SERVICE);
        init(resolver, collections, TargetType.TYPE_COLLECTION);
        init(resolver, entries, TargetType.TYPE_ENTRY);
        init(resolver, media, TargetType.TYPE_MEDIA);
View Full Code Here

    assertEquals(etag2.toString(), "W/\"foo\"");
  }
 
  public static void testRegexTargetResolver() throws Exception {
   
    RegexTargetResolver r = new RegexTargetResolver();
    r.setPattern("", TargetType.TYPE_SERVICE);
    r.setPattern("/([^/?#]+)", 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

    private List<String> entries;
    private List<String> media;
    private List<String> categories;
   
    public Object getObject() throws Exception {
        RegexTargetResolver resolver = new RegexTargetResolver();
       
        init(resolver, services, TargetType.TYPE_SERVICE);
        init(resolver, collections, TargetType.TYPE_COLLECTION);
        init(resolver, entries, TargetType.TYPE_ENTRY);
        init(resolver, media, TargetType.TYPE_MEDIA);
View Full Code Here

TOP

Related Classes of org.apache.abdera.protocol.server.impl.RegexTargetResolver$RegexTarget

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.