1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.resource.internal.entity

File EntityResourceReferenceHandler.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart8.png
54% of files have more coverage

Code metrics

0
3
2
1
77
34
2
0.67
1.5
2
1

Classes

Class Line # Actions
EntityResourceReferenceHandler 47 3 0% 2 1
0.880%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.resource.internal.entity;
21   
22    import java.util.Collections;
23    import java.util.List;
24   
25    import javax.inject.Inject;
26    import javax.inject.Named;
27    import javax.inject.Singleton;
28   
29    import org.xwiki.component.annotation.Component;
30    import org.xwiki.resource.AbstractResourceReferenceHandler;
31    import org.xwiki.resource.ResourceReferenceHandlerChain;
32    import org.xwiki.resource.ResourceReferenceHandlerException;
33    import org.xwiki.resource.ResourceReference;
34    import org.xwiki.resource.ResourceReferenceHandlerManager;
35    import org.xwiki.resource.ResourceType;
36    import org.xwiki.resource.entity.EntityResourceAction;
37   
38    /**
39    * Handles Entity Resource References.
40    *
41    * @version $Id: 6ed93b435ff1405c70b214f35038ec9933d5d31c $
42    * @since 6.1M2
43    */
44    @Component
45    @Named("bin")
46    @Singleton
 
47    public class EntityResourceReferenceHandler extends AbstractResourceReferenceHandler<ResourceType>
48    {
49    @Inject
50    private ResourceReferenceHandlerManager<EntityResourceAction> entityResourceReferenceHandlerManager;
51   
 
52  14717 toggle @Override
53    public List<ResourceType> getSupportedResourceReferences()
54    {
55    // At this point in time we want that the "bin" type be handled by the legacy XWikiAction code and thus must
56    // not have any ResourceReferenceHandler that handles "bin" Resource Type ATM. This will cause the Routing
57    // Filter to bypass the new Resource Reference Handler Servlet and thus call the Struts Servlet (and thus call
58    // XWikiAction).
59    // Also note that since the StandardExtendedURLResourceTypeResolver returns a "bin" Resource Type for all
60    // resource types ATM (in order to handl short urls in the "standard" URL Scheme), we will need to find ways
61    // to handle all Resource Types properly once we start having this EntityResourceReferenceHandler handle "bin"
62    // Resource Types!
63    // In the future, modify this to return: Arrays.asList(EntityResourceReference.TYPE);
64  14715 return Collections.emptyList();
65    }
66   
 
67  9497 toggle @Override
68    public void handle(ResourceReference reference, ResourceReferenceHandlerChain chain)
69    throws ResourceReferenceHandlerException
70    {
71  9501 this.entityResourceReferenceHandlerManager.handle(reference);
72   
73    // Be a good citizen, continue the chain, in case some lower-priority Handler has something to do for this
74    // Resource Reference.
75  0 chain.handleNext(reference);
76    }
77    }