All Downloads are FREE. Search and download functionalities are using the official Maven repository.

OSGI-INF.blueprint.blueprint.xml Maven / Gradle / Ivy

Go to download

REST API for the Apache Unomi Context Server extension that integrates with the Geonames database

There is a newer version: 2.6.1
Show newest version
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
           xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
  http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd">

    <bean id="cors-filter" class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"/>
    <bean id="jacksonMapper" class="org.apache.unomi.persistence.spi.CustomObjectMapper"/>
    <bean id="jaxb-provider" class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider">
        <argument index="0" ref="jacksonMapper" type="com.fasterxml.jackson.databind.ObjectMapper "/>
        <argument index="1" type="com.fasterxml.jackson.jaxrs.cfg.Annotations[]">
            <array>
                <value>JACKSON</value>
                <value>JAXB</value>
            </array>
        </argument>
    </bean>
    <bean id="jaas-filter" class="org.apache.cxf.jaxrs.security.JAASAuthenticationFilter">
        <!-- Name of the JAAS Context -->
        <property name="contextName" value="karaf"/>
        <!-- Hint to the filter on how to have Principals representing users and roles separated
             while initializing a SecurityContext -->
        <property name="rolePrefix" value="ROLE_"/>

        <property name="realmName" value="cxs"/>
        <!-- Activate this if you want to force a redirect if auth is missing, by default it will trigger a 403 which
             is usually preferred -->
        <!--property name="redirectURI" value="/login.jsp"/-->
    </bean>

    <jaxrs:server address="/geonames" id="restGeonamesService">
        <jaxrs:providers>
            <ref component-id="jaxb-provider"/>
            <ref component-id="cors-filter"/>
            <ref component-id="jaas-filter"/>
        </jaxrs:providers>

        <jaxrs:serviceBeans>
            <ref component-id="geonamesServiceEndPoint"/>
        </jaxrs:serviceBeans>
    </jaxrs:server>

    <reference id="geonamesService" interface="org.apache.unomi.geonames.services.GeonamesService"/>

    <bean id="geonamesServiceEndPoint" class="org.apache.unomi.geonames.rest.GeonamesEndPoint">
        <property name="geonamesService" ref="geonamesService"/>
    </bean>
</blueprint>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy