Changeset 5826


Ignore:
Timestamp:
11/14/14 13:09:53 (10 years ago)
Author:
Twan Goosen
Message:

added and configured swagger.io

Location:
ComponentRegistry/trunk/ComponentRegistry
Files:
29 added
5 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentRegistry/pom.xml

    r5781 r5826  
    2222        <packaging>war</packaging>
    2323        <!-- Properties to configure ComponentRegistry override on commandline
    24                         with -D or change here -->
     24        with -D or change here -->
    2525        <serviceRootUrl>http://localhost:8080/${project.artifactId}</serviceRootUrl>
    2626        <!-- Will be inserted in context.xml -->
     
    133133            <exclusions>
    134134                <!-- Jersey has dependencies with different group ids therefore maven
    135                                                 cannot resolve the conflict and gives me both jars (two of stax and two of
    136                                                 jaxb-impl). Excluding them manually to overcome the problem -->
     135                cannot resolve the conflict and gives me both jars (two of stax and two of
     136                jaxb-impl). Excluding them manually to overcome the problem -->
    137137                <exclusion>
    138138                    <groupId>stax</groupId>
     
    146146            <version>${jersey.version}</version>
    147147            <scope>test</scope>
     148        </dependency>
     149        <dependency>
     150            <groupId>com.wordnik</groupId>
     151            <artifactId>swagger-jersey-jaxrs_2.10</artifactId>
     152            <version>1.3.0</version>
    148153        </dependency>
    149154        <dependency>
     
    539544
    540545    <!--
    541                 <reporting>
    542                                 <plugins>
    543                                                 <plugin>
    544                                                                 <groupId>org.codehaus.mojo</groupId>
    545                                                                 <artifactId>findbugs-maven-plugin</artifactId>
    546                                                         <version>2.5.4-SNAPSHOT</version>
    547                                                                 <configuration>
    548                                                                         <excludeFilterFile>${basedir}/src/main/resources/findbugs-exclude.xml</excludeFilterFile>
    549                                                                         <threshold>Normal</threshold>
    550                                                                         <effort>Min</effort>
    551                                                                 </configuration>
    552                                                 </plugin>
    553                                 </plugins>
    554                 </reporting>
     546                <reporting>
     547                                <plugins>
     548                                                <plugin>
     549                                                                <groupId>org.codehaus.mojo</groupId>
     550                                                                <artifactId>findbugs-maven-plugin</artifactId>
     551                                                        <version>2.5.4-SNAPSHOT</version>
     552                                                                <configuration>
     553                                                                        <excludeFilterFile>${basedir}/src/main/resources/findbugs-exclude.xml</excludeFilterFile>
     554                                                                        <threshold>Normal</threshold>
     555                                                                        <effort>Min</effort>
     556                                                                </configuration>
     557                                                </plugin>
     558                                </plugins>
     559                </reporting>
    555560    -->
    556561    <repositories>
     
    561566        </repository>
    562567        <!--
    563                 <repository>
    564                                 <id>sonatype</id>
    565                                 <url>https://oss.sonatype.org/content/groups/public</url>
    566                 </repository>
    567                 -->
     568        <repository>
     569                        <id>sonatype</id>
     570                        <url>https://oss.sonatype.org/content/groups/public</url>
     571        </repository>
     572        -->
    568573    </repositories>
    569574</project>
  • ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java

    r5817 r5826  
    3131import com.sun.jersey.api.core.InjectParam;
    3232import com.sun.jersey.multipart.FormDataParam;
     33import com.wordnik.swagger.annotations.ApiOperation;
     34import com.wordnik.swagger.annotations.ApiResponse;
     35import com.wordnik.swagger.annotations.ApiResponses;
    3336
    3437import java.io.IOException;
     
    8992public class ComponentRegistryRestService implements
    9093        IComponentRegistryRestService {
    91    
     94
    9295    private final static Logger LOG = LoggerFactory
    9396            .getLogger(ComponentRegistryRestService.class);
     
    108111    @Autowired
    109112    private GroupService groupService;
    110    
     113
    111114    private ComponentRegistry getBaseRegistry() throws AuthenticationRequiredException {
    112115        Principal userPrincipal = security.getUserPrincipal();
     
    118121        }
    119122    }
    120    
     123
    121124    private ComponentRegistry getRegistry(RegistrySpace space, Number groupId) {
    122125        Principal userPrincipal = security.getUserPrincipal();
     
    145148        return principal;
    146149    }
    147    
     150
    148151    private UserCredentials getUserCredentials(Principal userPrincipal) {
    149152        UserCredentials userCredentials = null;
     
    153156        return userCredentials;
    154157    }
    155    
     158
    156159    private ComponentRegistry initialiseRegistry(String space, String groupId) throws AuthenticationRequiredException {
    157160        //checking credentials
     
    166169            groupIdNumber = Integer.parseInt(groupId);
    167170        }
    168        
     171
    169172        return this.getRegistry(regSpace, groupIdNumber);
    170173    }
    171    
     174
    172175    private boolean checkRegistrySpaceString(String registrySpace) {
    173176        return (registrySpace.equalsIgnoreCase(REGISTRY_SPACE_GROUP) || registrySpace.equalsIgnoreCase(REGISTRY_SPACE_PRIVATE) || registrySpace.equalsIgnoreCase(REGISTRY_SPACE_PUBLISHED));
    174177    }
    175    
     178
    176179    @Override
    177180    @GET
     
    185188            throws ComponentRegistryException, IOException {
    186189        long start = System.currentTimeMillis();
    187        
     190
    188191        // deprecated parameter, processed here for backwards compatibility
    189192        if (!Strings.isNullOrEmpty(userSpace)) {
     
    193196            }
    194197        }
    195        
     198
    196199        if (!checkRegistrySpaceString(registrySpace)) {
    197200            response.sendError(Status.NOT_FOUND.getStatusCode(), "illegal registry space");
    198201            return new ArrayList<ComponentDescription>();
    199202        }
    200        
     203
    201204        try {
    202205            ComponentRegistry cr = this.initialiseRegistry(registrySpace, groupId);
     
    205208                    "Releasing {} registered components into the world ({} millisecs)",
    206209                    result.size(), (System.currentTimeMillis() - start));
    207            
     210
    208211            return result;
    209212        } catch (AuthenticationRequiredException e) {
    210213            response.sendError(Status.UNAUTHORIZED.getStatusCode(), e.toString());
    211214            return new ArrayList<ComponentDescription>();
    212            
     215
    213216        } catch (UserUnauthorizedException e) {
    214217            response.sendError(Status.FORBIDDEN.getStatusCode(), e.toString());
    215218            return new ArrayList<ComponentDescription>();
    216            
     219
    217220        } catch (ItemNotFoundException e) {
    218221            response.sendError(Status.NOT_FOUND.getStatusCode(), e.toString());
    219222            return new ArrayList<ComponentDescription>();
    220223        }
    221        
    222     }
    223    
     224
     225    }
     226
    224227    @Override
    225228    @GET
     
    234237    )
    235238            throws ComponentRegistryException, IOException {
    236        
     239
    237240        long start = System.currentTimeMillis();
    238241
     
    244247            }
    245248        }
    246        
     249
    247250        if (!checkRegistrySpaceString(registrySpace)) {
    248251            response.sendError(Status.NOT_FOUND.getStatusCode(), "illegal registry space");
     
    255258                    "Releasing {} registered components into the world ({} millisecs)",
    256259                    result.size(), (System.currentTimeMillis() - start));
    257            
     260
    258261            return result;
    259262        } catch (AuthenticationRequiredException e) {
    260263            response.sendError(Status.UNAUTHORIZED.getStatusCode(), e.toString());
    261264            return new ArrayList<ProfileDescription>();
    262            
     265
    263266        } catch (UserUnauthorizedException e) {
    264267            response.sendError(Status.FORBIDDEN.getStatusCode(), e.toString());
    265268            return new ArrayList<ProfileDescription>();
    266            
     269
    267270        } catch (ItemNotFoundException e) {
    268271            response.sendError(Status.NOT_FOUND.getStatusCode(), e.toString());
     
    270273        }
    271274    }
    272    
     275
    273276    @Override
    274277    @GET
     
    292295        }
    293296    }
    294    
     297
    295298    @Override
    296299    @GET
     
    298301    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
    299302        MediaType.APPLICATION_JSON})
     303    @ApiOperation(value = "Get the component specification XML a single profile", response = CMDComponentSpec.class)
     304    @ApiResponses(value = {
     305        @ApiResponse(code = 403, message = "Profile does not exist")
     306    })
    300307    public Response getRegisteredProfile(
    301308            @PathParam("profileId") String profileId) throws IOException {
     
    314321        }
    315322    }
    316    
     323
    317324    @Override
    318325    @GET
     
    321328    public Response getRegisteredComponentRawType(
    322329            @PathParam("componentId") final String componentId, @PathParam("rawType") String rawType) throws ComponentRegistryException {
    323        
     330
    324331        LOG.debug("Component with id: {} and rawType: {} is requested.", componentId, rawType);
    325332        try {
     
    356363                                            .build());
    357364                                }
    358                                
     365
    359366                            } catch (UserUnauthorizedException e2) {
    360367                                LOG.error(e2.toString());
     
    393400                                LOG.error(e2.toString());
    394401                            }
    395                            
     402
    396403                        }
    397404                    };
     
    400407                    return Response.status(Status.NOT_FOUND).entity("Usupported raw type " + rawType).build();
    401408                }
    402                
     409
    403410            } catch (UserUnauthorizedException e2) {
    404411                return Response.status(Status.FORBIDDEN).build();
     
    410417        }
    411418    }
    412    
     419
    413420    @Override
    414421    @GET
     
    418425    public List<BaseDescription> getComponentUsage(
    419426            @PathParam("componentId") String componentId) throws ComponentRegistryException, IOException {
    420        
     427
    421428        final long start = System.currentTimeMillis();
    422429        try {
     
    424431            List<ComponentDescription> components = registry.getUsageInComponents(componentId);
    425432            List<ProfileDescription> profiles = registry.getUsageInProfiles(componentId);
    426            
     433
    427434            LOG.debug(
    428435                    "Found {} components and {} profiles that use component {} ({} millisecs)",
    429436                    components.size(), profiles.size(), componentId,
    430437                    (System.currentTimeMillis() - start));
    431            
     438
    432439            List<BaseDescription> usages = new ArrayList<BaseDescription>(components.size() + profiles.size());
    433440            usages.addAll(components);
    434441            usages.addAll(profiles);
    435            
     442
    436443            return usages;
    437444        } catch (ComponentRegistryException e) {
     
    444451        }
    445452    }
    446    
     453
    447454    @Override
    448455    @GET
     
    474481        }
    475482    }
    476    
     483
    477484    @Override
    478485    @GET
     
    504511        }
    505512    }
    506    
     513
    507514    @Override
    508515    @GET
     
    514521            @PathParam("commentId") String commentId)
    515522            throws IOException {
    516        
     523
    517524        LOG.debug("Comments of profile with id {} are requested.", commentId);
    518525        try {
    519            
     526
    520527            return this.getBaseRegistry().getSpecifiedCommentInProfile(profileId, commentId);
    521528        } catch (ComponentRegistryException e) {
     
    533540        }
    534541    }
    535    
     542
    536543    @Override
    537544    @GET
     
    584591        }
    585592    }
    586    
     593
    587594    @Override
    588595    @POST
     
    598605        }
    599606    }
    600    
     607
    601608    @Override
    602609    @POST
     
    625632            @FormDataParam(GROUP_FORM_FIELD) String group,
    626633            @FormDataParam(DOMAIN_FORM_FIELD) String domainName) {
    627        
     634
    628635        try {
    629636            Principal principal = checkAndGetUserPrincipal();
     
    645652                        .build();
    646653            }
    647            
     654
    648655        } catch (AuthenticationRequiredException e) {
    649656            return Response.serverError().status(Status.UNAUTHORIZED)
     
    661668        }
    662669    }
    663    
     670
    664671    @Override
    665672    @POST
     
    680687                    return Response.status(Status.CONFLICT).entity("Cannot update already published profile.")
    681688                            .build();
    682                    
     689
    683690                }
    684691                Number groupId;
     
    692699                    space = RegistrySpace.GROUP;
    693700                }
    694                
     701
    695702                updateDescription(desc, name, description, domainName, group);
    696703                ComponentRegistry cr = this.getRegistry(space, groupId);
     
    709716            return Response.serverError().status(Status.INTERNAL_SERVER_ERROR)
    710717                    .build();
    711            
     718
    712719        } catch (UserUnauthorizedException ex) {
    713720            return Response.status(Status.FORBIDDEN).entity(ex.getMessage())
    714721                    .build();
    715            
     722
    716723        } catch (ItemNotFoundException ex2) {
    717724            return Response.status(Status.NOT_FOUND).entity(ex2.getMessage())
     
    721728                    .build();
    722729        }
    723        
     730
    724731    }
    725732
     
    760767            @FormDataParam(GROUP_FORM_FIELD) String group,
    761768            @FormDataParam(DOMAIN_FORM_FIELD) String domainName) {
    762        
     769
    763770        try {
    764771            Principal principal = checkAndGetUserPrincipal();
     
    801808        }
    802809    }
    803    
     810
    804811    @Override
    805812    @POST
     
    831838                    space = RegistrySpace.GROUP;
    832839                }
    833                
     840
    834841                this.updateDescription(desc, name, description, domainName, group);
    835842                ComponentRegistry cr = this.getRegistry(space, groupId);
     
    858865                    .build();
    859866        }
    860        
    861     }
    862    
     867
     868    }
     869
    863870    private void updateDescription(BaseDescription desc, String name,
    864871            String description, String domainName, String group) {
     
    869876        desc.setRegistrationDate(new Date());
    870877    }
    871    
     878
    872879    @Override
    873880    @DELETE
     
    909916                    .build();
    910917        }
    911        
     918
    912919        LOG.info("Component with id: {} deleted.", componentId);
    913920        return Response.ok("Component with id" + componentId + " deleted.").build();
    914921    }
    915    
     922
    916923    @Override
    917924    @DELETE
    918925    @Path("/profiles/{profileId}")
     926    @ApiOperation(value = "Deletes a profile from the registry")
     927    @ApiResponses(value = {
     928        @ApiResponse(code = 401, message = "User is not logged authenticated"),
     929        @ApiResponse(code = 403, message = "Profile is not owned by current user and user is no administrator or profile is published and has been consolidated into the registry"),
     930        @ApiResponse(code = 404, message = "Profile does not exist")
     931    })
    919932    public Response deleteRegisteredProfile(
    920933            @PathParam("profileId") String profileId) {
     
    950963                    .build();
    951964        }
    952        
     965
    953966        LOG.info("Profile with id: {} deleted.", profileId);
    954967        return Response.ok().build();
    955968    }
    956    
     969
    957970    @Override
    958971    @DELETE
    959972    @Path("/profiles/{profileId}/comments/{commentId}")
     973    @ApiOperation(value = "Deletes a comment from a profile")
     974    @ApiResponses(value = {
     975        @ApiResponse(code = 401, message = "User is not authenticated"),
     976        @ApiResponse(code = 403, message = "Comment is not owned by current user and user is no administrator"),
     977        @ApiResponse(code = 404, message = "Comment does not exist")
     978    })
    960979    public Response deleteCommentFromProfile(
    961980            @PathParam("profileId") String profileId,
     
    980999                        .entity("" + e1.getMessage()).build();
    9811000            }
    982            
     1001
    9831002        } catch (DeleteFailedException e) {
    9841003            LOG.info("Comment with id: {} deletion failed: {}", commentId,
     
    10051024                    .build();
    10061025        }
    1007        
     1026
    10081027        LOG.info("Comment with id: {} deleted.", commentId);
    10091028        return Response.ok("Comment with id " + commentId + " deleted.").build();
    10101029    }
    1011    
     1030
    10121031    @Override
    10131032    @DELETE
    10141033    @Path("/components/{componentId}/comments/{commentId}")
     1034    @ApiOperation(value = "Deletes a comment from a component")
     1035    @ApiResponses(value = {
     1036        @ApiResponse(code = 401, message = "User is not authenticated"),
     1037        @ApiResponse(code = 403, message = "Comment is not owned by current user and user is no administrator"),
     1038        @ApiResponse(code = 404, message = "Comment does not exist")
     1039    })
    10151040    public Response deleteCommentFromComponent(
    10161041            @PathParam("componentId") String componentId,
     
    10571082                    .build();
    10581083        }
    1059        
     1084
    10601085        LOG.info("Comment with id: {} deleted.", commentId);
    10611086        return Response.ok("Comment with id " + commentId + " deleted.").build();
    10621087    }
    1063    
     1088
    10641089    @Override
    10651090    @GET
     
    10691094            @PathParam("profileId") final String profileId,
    10701095            @PathParam("rawType") String rawType) throws ComponentRegistryException, IllegalArgumentException {
    1071        
     1096
    10721097        LOG.debug("Profile with id {} and rawType {} is requested.", profileId,
    10731098                rawType);
    10741099        try {
    10751100            final ComponentRegistry registry = this.getBaseRegistry();
    1076            
     1101
    10771102            ProfileDescription desc = registry.getProfileDescriptionAccessControlled(profileId);
    10781103            if (desc == null) {
    10791104                return Response.status(Status.NOT_FOUND).build();
    10801105            }
    1081            
     1106
    10821107            StreamingOutput result = null;
    10831108            String fileName = desc.getName() + "." + rawType;
     
    11311156                    .build();
    11321157        }
    1133        
    1134     }
    1135    
     1158
     1159    }
     1160
    11361161    private Response createDownloadResponse(StreamingOutput result,
    11371162            String fileName) {
     
    11441169                .entity(result).build();
    11451170        return response;
    1146        
    1147     }
    1148    
     1171
     1172    }
     1173
    11491174    @Override
    11501175    @POST
     
    11871212        }
    11881213    }
    1189    
     1214
    11901215    @Override
    11911216    @POST
     
    12281253        }
    12291254    }
    1230    
     1255
    12311256    @Override
    12321257    @POST
     
    12411266            ComponentRegistry registry = this.getBaseRegistry();
    12421267            ComponentDescription description = registry.getComponentDescriptionAccessControlled(componentId);
    1243            
     1268
    12441269            LOG.debug("Trying to register comment to {}", componentId);
    1245            
     1270
    12461271            return this.registerComment(input, description, registry);
    12471272        } catch (AuthenticationRequiredException e) {
     
    12731298            ProfileDescription description = registry
    12741299                    .getProfileDescriptionAccessControlled(profileId);
    1275            
     1300
    12761301            LOG.debug("Trying to register comment to {}", profileId);
    1277            
     1302
    12781303            return this.registerComment(input, description, registry);
    12791304        } catch (AuthenticationRequiredException e) {
     
    12891314        }
    12901315    }
    1291    
     1316
    12921317    @Override
    12931318    @GET
     
    13161341                                stillActive)).build();
    13171342    }
    1318    
     1343
    13191344    private Response register(InputStream input, BaseDescription desc, RegisterAction action, ComponentRegistry registry) throws UserUnauthorizedException, AuthenticationRequiredException {
    13201345        try {
    1321            
     1346
    13221347            DescriptionValidator descriptionValidator = new DescriptionValidator(
    13231348                    desc);
     
    13281353            this.validate(response, descriptionValidator, validator);
    13291354            if (response.getErrors().isEmpty()) {
    1330                
     1355
    13311356                CMDComponentSpec spec = validator.getCMDComponentSpec();
    13321357
     
    13341359                // recursion over all the components
    13351360                setFileNamesFromListToNull(Collections.singletonList(spec.getCMDComponent()));
    1336                
     1361
    13371362                try {
    13381363                    checkForRecursion(validator, registry, desc);
     
    14041429        }
    14051430    }
    1406    
     1431
    14071432    private Response registerComment(InputStream input, BaseDescription description, ComponentRegistry registry) throws UserUnauthorizedException, AuthenticationRequiredException {
    14081433        try {
    14091434            CommentValidator validator = new CommentValidator(input, description, marshaller);
    14101435            CommentResponse responseLocal = new CommentResponse();
    1411            
     1436
    14121437            responseLocal.setIsPrivate(!description.isPublic());
    14131438            this.validateComment(responseLocal, validator);
     
    14691494        }
    14701495    }
    1471    
     1496
    14721497    private ComponentDescription createNewComponentDescription() {
    14731498        ComponentDescription desc = ComponentDescription.createNewDescription();
     
    14751500        return desc;
    14761501    }
    1477    
     1502
    14781503    private ProfileDescription createNewProfileDescription() {
    14791504        ProfileDescription desc = ProfileDescription.createNewDescription();
     
    14811506        return desc;
    14821507    }
    1483    
     1508
    14841509    private String createXlink(String id) {
    14851510        URI uri = uriInfo.getRequestUriBuilder().path(id).build();
     
    15001525        return servletContext.getInitParameter(APPLICATION_BASE_URL_PARAM);
    15011526    }
    1502    
     1527
    15031528    private void validate(RegisterResponse response, Validator... validators) throws UserUnauthorizedException {
    15041529        for (Validator validator : validators) {
     
    15101535        }
    15111536    }
    1512    
     1537
    15131538    private void validateComment(CommentResponse response,
    15141539            Validator... validators) throws UserUnauthorizedException {
     
    15391564    public void setFileNamesFromListToNull(
    15401565            List<CMDComponentType> listofcomponents) {
    1541        
     1566
    15421567        for (CMDComponentType currentcomponent : listofcomponents) {
    15431568            setFileNamesToNullCurrent(currentcomponent);
    15441569        }
    1545        
     1570
    15461571    }
    15471572
     
    15551580        setFileNamesFromListToNull(currentcomponent.getCMDComponent());
    15561581    }
    1557    
     1582
    15581583    private String helpToMakeTitleForRssDescriptions(String registrySpace, String groupId, String resource, ComponentRegistry cr) throws ItemNotFoundException {
    15591584        if (registrySpace == null || (registrySpace.equalsIgnoreCase(REGISTRY_SPACE_GROUP) && groupId == null)
     
    15671592            return "Private " + resource;
    15681593        }
    1569        
     1594
    15701595        if (registrySpace.equalsIgnoreCase(REGISTRY_SPACE_GROUP) && groupId != null) {
    15711596            return resource + " of group " + groupId + " '" + cr.getGroupName(Integer.parseInt(groupId)) + "'";
    15721597        }
    1573        
     1598
    15741599        return "Undefined registry space or uindefined type of resource";
    15751600    }
     
    16101635            return new Rss();
    16111636        }
    1612        
     1637
    16131638        final RssCreatorDescriptions instance = new RssCreatorDescriptions(getApplicationBaseURI(), "components",
    16141639                Integer.parseInt(limit), components,
     
    16511676            response.sendError(Status.FORBIDDEN.getStatusCode(), e.toString());
    16521677            return new Rss();
    1653            
     1678
    16541679        } catch (ItemNotFoundException e) {
    16551680            response.sendError(Status.NOT_FOUND.getStatusCode(), e.toString());
     
    16641689        return rss;
    16651690    }
    1666    
     1691
    16671692    private String helpToMakeTitleForRssComments(String itemId, String resource) {
    16681693        if (itemId == null || resource == null) {
     
    16951720            ParseException {
    16961721        try {
    1697            
     1722
    16981723            ComponentRegistry cr = this.getBaseRegistry();
    1699            
     1724
    17001725            final List<Comment> comments = cr.getCommentsInProfile(profileId);
    17011726            final ProfileDescription pd = cr.getProfileDescriptionAccessControlled(profileId);
    17021727            final String profileName = pd.getName();
    1703            
     1728
    17041729            String title = this.helpToMakeTitleForRssComments(profileId, "profile");
    17051730            final RssCreatorComments instance = new RssCreatorComments(
     
    17691794            return new Rss();
    17701795        }
    1771        
    1772     }
    1773    
     1796
     1797    }
     1798
    17741799    @Override
    17751800    @GET
     
    17771802    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
    17781803        MediaType.APPLICATION_JSON})
     1804    @ApiOperation(
     1805            value = "A listing of values that are allowed as element or attribute type by the CMDI schema",
     1806            response = AllowedAttributetypesXML.class)
    17791807    public AllowedAttributetypesXML getAllowedAttributeTypes()
    17801808            throws ComponentRegistryException, IOException, JAXBException,
     
    17821810        return (new AllowedAttributetypesXML());
    17831811    }
    1784    
     1812
    17851813    @Override
    17861814    @GET
     
    17961824        return groups;
    17971825    }
    1798    
     1826
    17991827    @Override
    18001828    @GET
     
    18051833        return groupService.getGroupsTheItemIsAMemberOf(itemId);
    18061834    }
    1807    
     1835
    18081836    @Override
    18091837    @POST
     
    18211849        }
    18221850    }
    1823    
     1851
    18241852    @Override
    18251853    @GET
     
    18271855    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
    18281856        MediaType.APPLICATION_JSON})
     1857    @ApiOperation(value = "The description (metadata) of a single component or profile item")
     1858    @ApiResponses(value = {
     1859        @ApiResponse(code = 401, message = "User is not authenticated and authentication is required"),
     1860        @ApiResponse(code = 403, message = "Item is not accessible to the current user"),
     1861        @ApiResponse(code = 404, message = "Item does not exist")
     1862    })
    18291863    public BaseDescription getBaseDescription(@PathParam("itemId") String itemId) throws ComponentRegistryException, IOException {
    18301864        LOG.debug("Item with id: {} is requested.", itemId);
     
    18421876            response.sendError(Status.BAD_REQUEST.getStatusCode());
    18431877            return new BaseDescription();
    1844            
     1878
    18451879        } catch (UserUnauthorizedException ex2) {
    18461880            response.sendError(Status.FORBIDDEN.getStatusCode(), ex2.getMessage());
     
    18781912        MediaType.APPLICATION_JSON})
    18791913    public List<Group> getGroupsOwnedByUser(@QueryParam("principalName") String pricipalName) throws IOException {
    1880        
     1914
    18811915        try {
    18821916            Principal principal = this.checkAndGetUserPrincipal();
     
    18871921        }
    18881922    }
    1889    
     1923
    18901924    @Override
    18911925    @GET
    18921926    @Path("/groups/names")
    18931927    public Response listGroupNames() throws IOException {
    1894        
     1928
    18951929        try {
    18961930            Principal principal = this.checkAndGetUserPrincipal();
     
    19051939        }
    19061940    }
    1907    
     1941
    19081942    @Override
    19091943    @GET
    19101944    @Path("/groups/ownership")
    19111945    public Response isOwner(@QueryParam("groupName") String groupName) throws IOException {
    1912        
     1946
    19131947        try {
    19141948            Principal principal = this.checkAndGetUserPrincipal();
     
    19191953        }
    19201954    }
    1921    
     1955
    19221956    @Override
    19231957    @POST
     
    19341968        } catch (ItemNotFoundException e) {
    19351969            return Response.status(Status.NOT_FOUND).entity(e.getMessage()).build();
    1936            
     1970
    19371971        } catch (AuthenticationRequiredException e) {
    19381972            return Response.status(Status.UNAUTHORIZED).build();
     
    19631997    @Path("/groups/profiles")
    19641998    public Response listProfiles(@QueryParam(GROUPID_PARAM) String groupId) throws IOException {
    1965        
     1999
    19662000        try {
    19672001            Principal principal = this.checkAndGetUserPrincipal();
     
    19742008        }
    19752009    }
    1976    
     2010
    19772011    @Override
    19782012    @GET
    19792013    @Path("/groups/components")
    19802014    public Response listComponents(@QueryParam(GROUPID_PARAM) String groupId) throws IOException {
    1981        
     2015
    19822016        try {
    19832017            Principal principal = this.checkAndGetUserPrincipal();
     
    19912025        }
    19922026    }
    1993    
     2027
    19942028    @Override
    19952029    @GET
    19962030    @Path("/groups/nameById")
    19972031    public Response getGroupNameById(@QueryParam(GROUPID_PARAM) String groupId) throws IOException {
    1998        
     2032
    19992033        try {
    20002034            Principal principal = this.checkAndGetUserPrincipal();
     
    20072041        }
    20082042    }
    2009    
     2043
    20102044    @Override
    20112045    @GET
    20122046    @Path("/groups/idByName")
    20132047    public Response getGroupIdByName(@QueryParam("groupName") String groupName) throws IOException {
    2014        
     2048
    20152049        try {
    20162050            Principal principal = this.checkAndGetUserPrincipal();
     
    20232057        }
    20242058    }
    2025    
     2059
    20262060    @XmlRootElement(name = "Identifiers")
    20272061    public static class StringsWrapper {
    2028        
     2062
    20292063        @XmlElement(name = "item")
    20302064        List<String> strings = new ArrayList<String>();
    2031        
     2065
    20322066        StringsWrapper() {
    20332067        }
    2034        
     2068
    20352069        public void setStrings(List<String> strings) {
    20362070            this.strings = strings;
  • ComponentRegistry/trunk/ComponentRegistry/src/main/webapp/WEB-INF/web-shib.xml

    r4109 r5826  
    22
    33<!--
    4         Configuration file for ComponentRegistry in shibbolized context, which
    5         any production environment should be.
     4        Configuration file for ComponentRegistry in shibbolized context, which
     5        any production environment should be.
    66-->
    77
    88<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    9   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
     9         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    1010    <display-name>ComponentRegistry</display-name>
    1111    <description>Clarin Metadata Component Registry</description>
     
    1717    </context-param>
    1818    <context-param>
    19                 <param-name>contextConfigLocation</param-name>
    20                 <param-value>classpath:spring-config/applicationContext.xml,classpath:spring-config/container-environment.xml
    21                 </param-value>
    22         </context-param>
     19        <param-name>contextConfigLocation</param-name>
     20        <param-value>classpath:spring-config/applicationContext.xml,classpath:spring-config/container-environment.xml
     21        </param-value>
     22    </context-param>
    2323
    2424    <listener>
     
    3636        </init-param>
    3737    </filter>
    38         <filter>
    39                 <filter-name>NoCachingFilter</filter-name>
    40                 <filter-class>clarin.cmdi.componentregistry.servlet.DontCacheFilter</filter-class>
    41         </filter>
    42         <filter-mapping>
    43                 <filter-name>NoCachingFilter</filter-name>
    44                 <url-pattern>/rest/registry/*</url-pattern>
    45         </filter-mapping>
     38    <filter>
     39        <filter-name>NoCachingFilter</filter-name>
     40        <filter-class>clarin.cmdi.componentregistry.servlet.DontCacheFilter</filter-class>
     41    </filter>
     42    <filter-mapping>
     43        <filter-name>NoCachingFilter</filter-name>
     44        <url-pattern>/rest/registry/*</url-pattern>
     45    </filter-mapping>
    4646   
    4747   
     
    5151    </filter-mapping>
    5252 
    53 <!-- Make sure this one is declared before the wicket filter, the order matters. Shibboleth should trigger the login, before continuing with the wicket filter.-->
     53    <!-- Make sure this one is declared before the wicket filter, the order matters. Shibboleth should trigger the login, before continuing with the wicket filter.-->
    5454    <filter>
    5555        <filter-name>AAIFilter</filter-name>
     
    7474        <init-param>
    7575            <param-name>configuration</param-name>
    76 <!--      <param-value>development</param-value>-->
     76            <!--      <param-value>development</param-value>-->
    7777            <param-value>deployment</param-value>
    78       <!-- you can override with -Dwicket.configuration=development -->
     78            <!-- you can override with -Dwicket.configuration=development -->
    7979        </init-param>
    8080    </filter>
     
    8383        <url-pattern>/admin/*</url-pattern>
    8484    </filter-mapping>
    85         <servlet>
    86                 <servlet-name>ComponentRegistry Web Application</servlet-name>
    87                 <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
    88                 <init-param> <param-name>com.sun.jersey.config.property.classnames</param-name>
    89                         <param-value>com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider</param-value>
    90                 </init-param>
    91                 <load-on-startup>1</load-on-startup>
    92         </servlet>
     85    <servlet>
     86        <servlet-name>ComponentRegistry Web Application</servlet-name>
     87        <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
     88        <init-param>
     89            <param-name>com.sun.jersey.config.property.classnames</param-name>
     90            <param-value>com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider</param-value>
     91        </init-param>
     92        <init-param>
     93            <param-name>com.sun.jersey.config.property.packages</param-name>
     94            <param-value>com.wordnik.swagger.jersey.listing</param-value>
     95        </init-param>
     96        <load-on-startup>1</load-on-startup>
     97    </servlet>
    9398    <servlet-mapping>
    9499        <servlet-name>ComponentRegistry Web Application</servlet-name>
     
    105110        <url-pattern>/isocat/*</url-pattern>
    106111    </servlet-mapping>
     112    <servlet>
     113        <servlet-name>JerseyJaxrsConfig</servlet-name>
     114        <servlet-class>com.wordnik.swagger.jersey.config.JerseyJaxrsConfig</servlet-class>
     115        <init-param>
     116            <param-name>api.version</param-name>
     117            <param-value>1.0.0</param-value>
     118        </init-param>
     119        <init-param>
     120            <param-name>swagger.api.basepath</param-name>
     121            <param-value>http://localhost:8080/ComponentRegistry/rest</param-value>
     122        </init-param>
     123        <load-on-startup>2</load-on-startup>
     124    </servlet>
    107125
    108126</web-app>
  • ComponentRegistry/trunk/ComponentRegistry/src/main/webapp/WEB-INF/web-test.xml

    r4109 r5826  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<!-- Configuration file for ComponentRegistry in NON-SHIBBOLIZED context,
    3         i.e. development or testing environments. -->
     3i.e. development or testing environments. -->
    44
    55<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    6         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    7         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    8         <display-name>ComponentRegistry</display-name>
    9         <description>Clarin Metadata Component Registry</description>
    10         <listener>
    11                 <listener-class>org.springframework.web.context.ContextLoaderListener
    12                 </listener-class>
    13         </listener>
     6         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     7         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
     8    <display-name>ComponentRegistry</display-name>
     9    <description>Clarin Metadata Component Registry</description>
     10    <listener>
     11        <listener-class>org.springframework.web.context.ContextLoaderListener
     12        </listener-class>
     13    </listener>
    1414
    15         <context-param>
    16                 <param-name>contextConfigLocation</param-name>
    17                 <param-value>classpath:spring-config/applicationContext.xml,classpath:spring-config/container-environment.xml
    18                 </param-value>
    19         </context-param>
     15    <context-param>
     16        <param-name>contextConfigLocation</param-name>
     17        <param-value>classpath:spring-config/applicationContext.xml,classpath:spring-config/container-environment.xml
     18        </param-value>
     19    </context-param>
    2020
    21         <filter>
    22                 <filter-name>characterEncodingFilter</filter-name>
    23                 <filter-class>clarin.cmdi.componentregistry.servlet.CharacterEncodingFilter
    24                 </filter-class>
    25                 <init-param>
    26                         <param-name>encoding</param-name>
    27                         <param-value>UTF-8</param-value>
    28                 </init-param>
    29         </filter>
    30         <filter-mapping>
    31                 <filter-name>characterEncodingFilter</filter-name>
    32                 <url-pattern>/*</url-pattern>
    33         </filter-mapping>
    34         <filter>
    35                 <filter-name>NoCachingFilter</filter-name>
    36                 <filter-class>clarin.cmdi.componentregistry.servlet.DontCacheFilter</filter-class>
    37         </filter>
    38         <filter-mapping>
    39                 <filter-name>NoCachingFilter</filter-name>
    40                 <url-pattern>/rest/registry/*</url-pattern>
    41         </filter-mapping>
    42         <filter>
    43                 <filter-name>wicket.componentregistry</filter-name>
    44                 <filter-class>org.apache.wicket.protocol.http.WicketFilter
    45                 </filter-class>
    46                 <init-param>
    47                         <param-name>applicationClassName</param-name>
    48                         <param-value>clarin.cmdi.componentregistry.frontend.AdminApp
    49                         </param-value>
    50                 </init-param>
    51                 <init-param>
    52                         <param-name>configuration</param-name>
    53                         <!-- <param-value>development</param-value> -->
    54                         <param-value>deployment</param-value>
    55                         <!-- you can override with -Dwicket.configuration=development -->
    56                 </init-param>
    57         </filter>
    58         <filter-mapping>
    59                 <filter-name>wicket.componentregistry</filter-name>
    60                 <url-pattern>/admin/*</url-pattern>
    61         </filter-mapping>
    62         <servlet>
    63                 <servlet-name>ComponentRegistry Web Application</servlet-name>
    64                 <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet
    65                 </servlet-class>
    66                 <init-param>
    67                         <param-name>com.sun.jersey.config.property.resourceConfigClass
    68                         </param-name>
    69                         <param-value>com.sun.jersey.api.core.ClassNamesResourceConfig
    70                         </param-value>
    71                 </init-param>
    72                 <init-param>
    73                         <param-name>com.sun.jersey.config.property.classnames</param-name>
    74                         <param-value>com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider;clarin.cmdi.componentregistry.rest.ComponentRegistryRestService
    75                         </param-value>
    76                 </init-param>
    77                 <!-- <init-param> -->
    78                 <!-- <param-name>com.sun.jersey.config.property.packages</param-name> -->
    79                 <!-- <param-value>clarin.cmdi.componentregistry.rest</param-value> -->
    80                 <!-- </init-param> -->
    81                 <load-on-startup>1</load-on-startup>
    82         </servlet>
    83         <servlet-mapping>
    84                 <servlet-name>ComponentRegistry Web Application</servlet-name>
    85                 <url-pattern>/rest/*</url-pattern>
    86         </servlet-mapping>
    87         <servlet>
    88                 <servlet-name>Isocat Servlet</servlet-name>
    89                 <servlet-class>clarin.cmdi.componentregistry.servlet.IsocatServlet
    90                 </servlet-class>
    91                 <load-on-startup>1</load-on-startup>
    92         </servlet>
    93         <servlet-mapping>
    94                 <servlet-name>Isocat Servlet</servlet-name>
    95                 <url-pattern>/isocat/*</url-pattern>
    96         </servlet-mapping>
    97         <security-constraint>
    98                 <display-name>ComponentRegistry web service</display-name>
    99                 <web-resource-collection>
    100                         <web-resource-name>ComponentRegistry edit</web-resource-name>
    101                         <description />
    102                         <url-pattern>/rest/*</url-pattern>
    103                         <http-method>DELETE</http-method>
    104                         <http-method>PUT</http-method>
    105                         <http-method>POST</http-method>
    106                 </web-resource-collection>
    107                 <auth-constraint>
    108                         <role-name>tomcat</role-name>
    109                 </auth-constraint>
    110         </security-constraint>
    111         <security-constraint>
    112                 <display-name>ComponentRegistry SWF GET</display-name>
    113                 <web-resource-collection>
    114                         <web-resource-name>ComponentRegistry access</web-resource-name>
    115                         <description />
    116                         <url-pattern>/*</url-pattern>
    117                         <http-method>GET</http-method>
    118                 </web-resource-collection>
    119                 <auth-constraint>
    120                         <role-name>tomcat</role-name>
    121                 </auth-constraint>
    122         </security-constraint>
    123         <login-config>
    124                 <auth-method>BASIC</auth-method>
    125         </login-config>
    126         <security-role>
    127                 <description> The role that is required to log in to the Application
    128                 </description>
    129                 <role-name>tomcat</role-name>
    130         </security-role>
     21    <filter>
     22        <filter-name>characterEncodingFilter</filter-name>
     23        <filter-class>clarin.cmdi.componentregistry.servlet.CharacterEncodingFilter
     24        </filter-class>
     25        <init-param>
     26            <param-name>encoding</param-name>
     27            <param-value>UTF-8</param-value>
     28        </init-param>
     29    </filter>
     30    <filter>
     31        <filter-name>NoCachingFilter</filter-name>
     32        <filter-class>clarin.cmdi.componentregistry.servlet.DontCacheFilter</filter-class>
     33    </filter>
     34    <filter-mapping>
     35        <filter-name>NoCachingFilter</filter-name>
     36        <url-pattern>/rest/registry/*</url-pattern>
     37    </filter-mapping>
     38    <filter-mapping>
     39        <filter-name>characterEncodingFilter</filter-name>
     40        <url-pattern>/*</url-pattern>
     41    </filter-mapping>
     42    <filter>
     43        <filter-name>wicket.componentregistry</filter-name>
     44        <filter-class>org.apache.wicket.protocol.http.WicketFilter
     45        </filter-class>
     46        <init-param>
     47            <param-name>applicationClassName</param-name>
     48            <param-value>clarin.cmdi.componentregistry.frontend.AdminApp
     49            </param-value>
     50        </init-param>
     51        <init-param>
     52            <param-name>configuration</param-name>
     53            <!-- <param-value>development</param-value> -->
     54            <param-value>deployment</param-value>
     55            <!-- you can override with -Dwicket.configuration=development -->
     56        </init-param>
     57    </filter>
     58    <filter-mapping>
     59        <filter-name>wicket.componentregistry</filter-name>
     60        <url-pattern>/admin/*</url-pattern>
     61    </filter-mapping>
     62    <servlet>
     63        <servlet-name>ComponentRegistry Web Application</servlet-name>
     64        <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
     65        <init-param>
     66            <param-name>com.sun.jersey.config.property.classnames</param-name>
     67            <param-value>com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider</param-value>
     68        </init-param>
     69        <init-param>
     70            <param-name>com.sun.jersey.config.property.packages</param-name>
     71            <param-value>com.wordnik.swagger.jersey.listing</param-value>
     72        </init-param>
     73        <load-on-startup>1</load-on-startup>
     74    </servlet>
     75    <servlet-mapping>
     76        <servlet-name>ComponentRegistry Web Application</servlet-name>
     77        <url-pattern>/rest/*</url-pattern>
     78    </servlet-mapping>
     79    <servlet>
     80        <servlet-name>Isocat Servlet</servlet-name>
     81        <servlet-class>clarin.cmdi.componentregistry.servlet.IsocatServlet
     82        </servlet-class>
     83        <load-on-startup>1</load-on-startup>
     84    </servlet>
     85    <servlet-mapping>
     86        <servlet-name>Isocat Servlet</servlet-name>
     87        <url-pattern>/isocat/*</url-pattern>
     88    </servlet-mapping>
     89    <servlet>
     90        <servlet-name>JerseyJaxrsConfig</servlet-name>
     91        <servlet-class>com.wordnik.swagger.jersey.config.JerseyJaxrsConfig</servlet-class>
     92        <init-param>
     93            <param-name>api.version</param-name>
     94            <param-value>1.0.0</param-value>
     95        </init-param>
     96        <init-param>
     97            <param-name>swagger.api.basepath</param-name>
     98            <param-value>http://localhost:8080/ComponentRegistry/rest</param-value>
     99        </init-param>
     100        <load-on-startup>2</load-on-startup>
     101    </servlet>
     102    <security-constraint>
     103        <display-name>ComponentRegistry web service</display-name>
     104        <web-resource-collection>
     105            <web-resource-name>ComponentRegistry edit</web-resource-name>
     106            <description />
     107            <url-pattern>/rest/*</url-pattern>
     108            <http-method>DELETE</http-method>
     109            <http-method>PUT</http-method>
     110            <http-method>POST</http-method>
     111        </web-resource-collection>
     112        <auth-constraint>
     113            <role-name>tomcat</role-name>
     114        </auth-constraint>
     115    </security-constraint>
     116    <security-constraint>
     117        <display-name>ComponentRegistry SWF GET</display-name>
     118        <web-resource-collection>
     119            <web-resource-name>ComponentRegistry access</web-resource-name>
     120            <description />
     121            <url-pattern>/*</url-pattern>
     122            <http-method>GET</http-method>
     123        </web-resource-collection>
     124        <auth-constraint>
     125            <role-name>tomcat</role-name>
     126        </auth-constraint>
     127    </security-constraint>
     128    <login-config>
     129        <auth-method>BASIC</auth-method>
     130    </login-config>
     131    <security-role>
     132        <description> The role that is required to log in to the Application
     133        </description>
     134        <role-name>tomcat</role-name>
     135    </security-role>
    131136       
    132         <welcome-file-list>
    133                 <welcome-file>index.jsp</welcome-file>
    134         </welcome-file-list>
     137    <welcome-file-list>
     138        <welcome-file>index.jsp</welcome-file>
     139    </welcome-file-list>
    135140       
    136141</web-app>
  • ComponentRegistry/trunk/ComponentRegistry/src/main/webapp/WEB-INF/web.xml

    r5807 r5826  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<!-- Configuration file for ComponentRegistry in NON-SHIBBOLIZED context,
    3         i.e. development or testing environments. -->
     3i.e. development or testing environments. -->
    44
    55<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    6         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    7         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    8         <display-name>ComponentRegistry</display-name>
    9         <description>Clarin Metadata Component Registry</description>
    10         <listener>
    11                 <listener-class>org.springframework.web.context.ContextLoaderListener
    12                 </listener-class>
    13         </listener>
     6         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     7         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
     8    <display-name>ComponentRegistry</display-name>
     9    <description>Clarin Metadata Component Registry</description>
     10    <listener>
     11        <listener-class>org.springframework.web.context.ContextLoaderListener
     12        </listener-class>
     13    </listener>
    1414
    15         <context-param>
    16                 <param-name>contextConfigLocation</param-name>
    17                 <param-value>classpath:spring-config/applicationContext.xml,classpath:spring-config/container-environment.xml
    18                 </param-value>
    19         </context-param>
     15    <context-param>
     16        <param-name>contextConfigLocation</param-name>
     17        <param-value>classpath:spring-config/applicationContext.xml,classpath:spring-config/container-environment.xml
     18        </param-value>
     19    </context-param>
    2020
    21         <filter>
    22                 <filter-name>characterEncodingFilter</filter-name>
    23                 <filter-class>clarin.cmdi.componentregistry.servlet.CharacterEncodingFilter
    24                 </filter-class>
    25                 <init-param>
    26                         <param-name>encoding</param-name>
    27                         <param-value>UTF-8</param-value>
    28                 </init-param>
    29         </filter>
    30         <filter>
    31                 <filter-name>NoCachingFilter</filter-name>
    32                 <filter-class>clarin.cmdi.componentregistry.servlet.DontCacheFilter</filter-class>
    33         </filter>
    34         <filter-mapping>
    35                 <filter-name>NoCachingFilter</filter-name>
    36                 <url-pattern>/rest/registry/*</url-pattern>
    37         </filter-mapping>
    38         <filter-mapping>
    39                 <filter-name>characterEncodingFilter</filter-name>
    40                 <url-pattern>/*</url-pattern>
    41         </filter-mapping>
    42         <filter>
    43                 <filter-name>wicket.componentregistry</filter-name>
    44                 <filter-class>org.apache.wicket.protocol.http.WicketFilter
    45                 </filter-class>
    46                 <init-param>
    47                         <param-name>applicationClassName</param-name>
    48                         <param-value>clarin.cmdi.componentregistry.frontend.AdminApp
    49                         </param-value>
    50                 </init-param>
    51                 <init-param>
    52                         <param-name>configuration</param-name>
    53                         <!-- <param-value>development</param-value> -->
    54                         <param-value>deployment</param-value>
    55                         <!-- you can override with -Dwicket.configuration=development -->
    56                 </init-param>
    57         </filter>
    58         <filter-mapping>
    59                 <filter-name>wicket.componentregistry</filter-name>
    60                 <url-pattern>/admin/*</url-pattern>
    61         </filter-mapping>
    62         <servlet>
    63                 <servlet-name>ComponentRegistry Web Application</servlet-name>
    64                 <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
    65                 <init-param> <param-name>com.sun.jersey.config.property.classnames</param-name>
    66                         <param-value>com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider</param-value>
    67                 </init-param>
    68                 <load-on-startup>1</load-on-startup>
    69         </servlet>
    70         <servlet-mapping>
    71                 <servlet-name>ComponentRegistry Web Application</servlet-name>
    72                 <url-pattern>/rest/*</url-pattern>
    73         </servlet-mapping>
    74         <servlet>
    75                 <servlet-name>Isocat Servlet</servlet-name>
    76                 <servlet-class>clarin.cmdi.componentregistry.servlet.IsocatServlet
    77                 </servlet-class>
    78                 <load-on-startup>1</load-on-startup>
    79         </servlet>
    80         <servlet-mapping>
    81                 <servlet-name>Isocat Servlet</servlet-name>
    82                 <url-pattern>/isocat/*</url-pattern>
    83         </servlet-mapping>
    84         <security-constraint>
    85                 <display-name>ComponentRegistry web service</display-name>
    86                 <web-resource-collection>
    87                         <web-resource-name>ComponentRegistry edit</web-resource-name>
    88                         <description />
    89                         <url-pattern>/rest/*</url-pattern>
    90                         <http-method>DELETE</http-method>
    91                         <http-method>PUT</http-method>
    92                         <http-method>POST</http-method>
    93                 </web-resource-collection>
    94                 <auth-constraint>
    95                         <role-name>tomcat</role-name>
    96                 </auth-constraint>
    97         </security-constraint>
    98         <security-constraint>
    99                 <display-name>ComponentRegistry SWF GET</display-name>
    100                 <web-resource-collection>
    101                         <web-resource-name>ComponentRegistry access</web-resource-name>
    102                         <description />
    103                         <url-pattern>/*</url-pattern>
    104                         <http-method>GET</http-method>
    105                 </web-resource-collection>
    106                 <auth-constraint>
    107                         <role-name>tomcat</role-name>
    108                 </auth-constraint>
    109         </security-constraint>
    110         <login-config>
    111                 <auth-method>BASIC</auth-method>
    112         </login-config>
    113         <security-role>
    114                 <description> The role that is required to log in to the Application
    115                 </description>
    116                 <role-name>tomcat</role-name>
    117         </security-role>
     21    <filter>
     22        <filter-name>characterEncodingFilter</filter-name>
     23        <filter-class>clarin.cmdi.componentregistry.servlet.CharacterEncodingFilter
     24        </filter-class>
     25        <init-param>
     26            <param-name>encoding</param-name>
     27            <param-value>UTF-8</param-value>
     28        </init-param>
     29    </filter>
     30    <filter>
     31        <filter-name>NoCachingFilter</filter-name>
     32        <filter-class>clarin.cmdi.componentregistry.servlet.DontCacheFilter</filter-class>
     33    </filter>
     34    <filter-mapping>
     35        <filter-name>NoCachingFilter</filter-name>
     36        <url-pattern>/rest/registry/*</url-pattern>
     37    </filter-mapping>
     38    <filter-mapping>
     39        <filter-name>characterEncodingFilter</filter-name>
     40        <url-pattern>/*</url-pattern>
     41    </filter-mapping>
     42    <filter>
     43        <filter-name>wicket.componentregistry</filter-name>
     44        <filter-class>org.apache.wicket.protocol.http.WicketFilter
     45        </filter-class>
     46        <init-param>
     47            <param-name>applicationClassName</param-name>
     48            <param-value>clarin.cmdi.componentregistry.frontend.AdminApp
     49            </param-value>
     50        </init-param>
     51        <init-param>
     52            <param-name>configuration</param-name>
     53            <!-- <param-value>development</param-value> -->
     54            <param-value>deployment</param-value>
     55            <!-- you can override with -Dwicket.configuration=development -->
     56        </init-param>
     57    </filter>
     58    <filter-mapping>
     59        <filter-name>wicket.componentregistry</filter-name>
     60        <url-pattern>/admin/*</url-pattern>
     61    </filter-mapping>
     62    <servlet>
     63        <servlet-name>ComponentRegistry Web Application</servlet-name>
     64        <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
     65        <init-param>
     66            <param-name>com.sun.jersey.config.property.classnames</param-name>
     67            <param-value>com.sun.jersey.multipart.impl.FormDataMultiPartDispatchProvider</param-value>
     68        </init-param>
     69        <init-param>
     70            <param-name>com.sun.jersey.config.property.packages</param-name>
     71            <param-value>com.wordnik.swagger.jersey.listing</param-value>
     72        </init-param>
     73        <load-on-startup>1</load-on-startup>
     74    </servlet>
     75    <servlet-mapping>
     76        <servlet-name>ComponentRegistry Web Application</servlet-name>
     77        <url-pattern>/rest/*</url-pattern>
     78    </servlet-mapping>
     79    <servlet>
     80        <servlet-name>Isocat Servlet</servlet-name>
     81        <servlet-class>clarin.cmdi.componentregistry.servlet.IsocatServlet
     82        </servlet-class>
     83        <load-on-startup>1</load-on-startup>
     84    </servlet>
     85    <servlet-mapping>
     86        <servlet-name>Isocat Servlet</servlet-name>
     87        <url-pattern>/isocat/*</url-pattern>
     88    </servlet-mapping>
     89    <servlet>
     90        <servlet-name>JerseyJaxrsConfig</servlet-name>
     91        <servlet-class>com.wordnik.swagger.jersey.config.JerseyJaxrsConfig</servlet-class>
     92        <init-param>
     93            <param-name>api.version</param-name>
     94            <param-value>1.0.0</param-value>
     95        </init-param>
     96        <init-param>
     97            <param-name>swagger.api.basepath</param-name>
     98            <param-value>http://localhost:8080/ComponentRegistry/rest</param-value>
     99        </init-param>
     100        <load-on-startup>2</load-on-startup>
     101    </servlet>
     102    <security-constraint>
     103        <display-name>ComponentRegistry web service</display-name>
     104        <web-resource-collection>
     105            <web-resource-name>ComponentRegistry edit</web-resource-name>
     106            <description />
     107            <url-pattern>/rest/*</url-pattern>
     108            <http-method>DELETE</http-method>
     109            <http-method>PUT</http-method>
     110            <http-method>POST</http-method>
     111        </web-resource-collection>
     112        <auth-constraint>
     113            <role-name>tomcat</role-name>
     114        </auth-constraint>
     115    </security-constraint>
     116    <security-constraint>
     117        <display-name>ComponentRegistry SWF GET</display-name>
     118        <web-resource-collection>
     119            <web-resource-name>ComponentRegistry access</web-resource-name>
     120            <description />
     121            <url-pattern>/*</url-pattern>
     122            <http-method>GET</http-method>
     123        </web-resource-collection>
     124        <auth-constraint>
     125            <role-name>tomcat</role-name>
     126        </auth-constraint>
     127    </security-constraint>
     128    <login-config>
     129        <auth-method>BASIC</auth-method>
     130    </login-config>
     131    <security-role>
     132        <description> The role that is required to log in to the Application
     133        </description>
     134        <role-name>tomcat</role-name>
     135    </security-role>
    118136       
    119         <welcome-file-list>
    120                 <welcome-file>index.jsp</welcome-file>
    121         </welcome-file-list>
     137    <welcome-file-list>
     138        <welcome-file>index.jsp</welcome-file>
     139    </welcome-file-list>
    122140       
    123141</web-app>
Note: See TracChangeset for help on using the changeset viewer.