org.apache.clerezza.triaxrs
Class JaxRsHandler

java.lang.Object
  extended by org.apache.clerezza.triaxrs.JaxRsHandler
All Implemented Interfaces:
org.wymiwyg.wrhapi.Handler

public class JaxRsHandler
extends Object
implements org.wymiwyg.wrhapi.Handler

Am implementation of JAX-RS (aka JSR 311) based on wrhapi. It supports both injection of javax.ws.rs.core.Application instances, as well as direct injection of Providers and root resources. For direct injection a component just need to expose a service of type java.lang.Object and have the property "javax.ws.rs" set to true.

Author:
reto

Field Summary
static ThreadLocal<WebRequest> localRequest
          Keeps the WebRequest for a thread.
static AggregatedProviders providers
          Provides access to the providers, this aggregation of (in order): - applicationProviders (if available) - componentSpecifiedProviders - built-in providers
 
Constructor Summary
JaxRsHandler()
           
 
Method Summary
protected  void activate(org.osgi.service.component.ComponentContext componentContext)
          The activate method is called when SCR activates the component configuration
protected  void bindApplicationConfig(org.osgi.framework.ServiceReference serviceReference)
          this is called when a new application config arrives
protected  void bindBundlePrefixManager(org.apache.clerezza.jaxrs.extensions.prefixmanager.BundlePrefixManager prefixManager)
           
protected  void bindComponent(org.osgi.framework.ServiceReference serviceReference)
          Binds the specified JAX-RS root-resource or provider.
 void handle(org.wymiwyg.wrhapi.Request origRequest, org.wymiwyg.wrhapi.Response response)
           
protected  void registerApplicationConfig(javax.ws.rs.core.Application applicationConfig, String pathPrefix)
           
protected  void registerComponent(Object component, String pathPrefix)
           
protected  void registerSingleComponentOfApplication(Class<?> clazz, Object instance, CascadingProviders applicationProviders, String pathPrefix)
           
protected  void unbindApplicationConfig(javax.ws.rs.core.Application applicationConfig)
           
protected  void unbindBundlePrefixManager(org.apache.clerezza.jaxrs.extensions.prefixmanager.BundlePrefixManager prefixManager)
           
protected  void unbindComponent(org.osgi.framework.ServiceReference serviceReference)
          Unbinds the specified JAXRS component referred by the parameter.
protected  void unregisterApplicationConfig(javax.ws.rs.core.Application applicationConfig)
           
protected  void unregisterComponent(Object component, String pathPrefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

providers

public static final AggregatedProviders providers
Provides access to the providers, this aggregation of (in order): - applicationProviders (if available) - componentSpecifiedProviders - built-in providers


localRequest

public static ThreadLocal<WebRequest> localRequest
Keeps the WebRequest for a thread.

Constructor Detail

JaxRsHandler

public JaxRsHandler()
Method Detail

bindBundlePrefixManager

protected void bindBundlePrefixManager(org.apache.clerezza.jaxrs.extensions.prefixmanager.BundlePrefixManager prefixManager)

unbindBundlePrefixManager

protected void unbindBundlePrefixManager(org.apache.clerezza.jaxrs.extensions.prefixmanager.BundlePrefixManager prefixManager)

bindComponent

protected void bindComponent(org.osgi.framework.ServiceReference serviceReference)
Binds the specified JAX-RS root-resource or provider.

Parameters:
component - The new JAX-RS component to bind.

registerComponent

protected void registerComponent(Object component,
                                 String pathPrefix)

unbindComponent

protected void unbindComponent(org.osgi.framework.ServiceReference serviceReference)
Unbinds the specified JAXRS component referred by the parameter.


unregisterComponent

protected void unregisterComponent(Object component,
                                   String pathPrefix)

bindApplicationConfig

protected void bindApplicationConfig(org.osgi.framework.ServiceReference serviceReference)
this is called when a new application config arrives

Parameters:
applicationConfig -

registerApplicationConfig

protected void registerApplicationConfig(javax.ws.rs.core.Application applicationConfig,
                                         String pathPrefix)

registerSingleComponentOfApplication

protected void registerSingleComponentOfApplication(Class<?> clazz,
                                                    Object instance,
                                                    CascadingProviders applicationProviders,
                                                    String pathPrefix)

unbindApplicationConfig

protected void unbindApplicationConfig(javax.ws.rs.core.Application applicationConfig)

unregisterApplicationConfig

protected void unregisterApplicationConfig(javax.ws.rs.core.Application applicationConfig)

activate

protected void activate(org.osgi.service.component.ComponentContext componentContext)
The activate method is called when SCR activates the component configuration

Parameters:
componentContext -

handle

public void handle(org.wymiwyg.wrhapi.Request origRequest,
                   org.wymiwyg.wrhapi.Response response)
            throws org.wymiwyg.wrhapi.HandlerException
Specified by:
handle in interface org.wymiwyg.wrhapi.Handler
Throws:
org.wymiwyg.wrhapi.HandlerException


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.