
org.tynamo.resteasy.ResteasyModule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tapestry-resteasy Show documentation
Show all versions of tapestry-resteasy Show documentation
RESTEasy Tapestry5 Integration
The newest version!
package org.tynamo.resteasy;
import java.util.Collection;
import javax.ws.rs.ext.Provider;
import org.apache.tapestry5.commons.Configuration;
import org.apache.tapestry5.commons.MappedConfiguration;
import org.apache.tapestry5.commons.ObjectLocator;
import org.apache.tapestry5.commons.OrderedConfiguration;
import org.apache.tapestry5.http.services.HttpServletRequestFilter;
import org.apache.tapestry5.http.services.HttpServletRequestHandler;
import org.apache.tapestry5.internal.InternalConstants;
import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.Contribute;
import org.apache.tapestry5.ioc.annotations.InjectService;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.services.ClassNameLocator;
import org.apache.tapestry5.ioc.services.FactoryDefaults;
import org.apache.tapestry5.ioc.services.SymbolProvider;
import org.jboss.resteasy.util.GetRestful;
import org.slf4j.Logger;
/**
* This module is automatically included as part of the Tapestry IoC Registry
*/
public class ResteasyModule
{
public static void bind(ServiceBinder binder)
{
// Make bind() calls on the binder object to define most IoC services.
// Use service builder methods (example below) when the implementation
// is provided inline, or requires more initialization than simply
// invoking the constructor.
binder.bind(javax.ws.rs.core.Application.class, org.tynamo.resteasy.Application.class);
binder.bind(HttpServletRequestFilter.class, ResteasyRequestFilter.class).withId("ResteasyRequestFilter");
binder.bind(HttpServletRequestFilter.class, JSAPIRequestFilter.class).withId("JSAPIRequestFilter");
}
@Contribute(HttpServletRequestHandler.class)
public static void httpServletRequestHandler(OrderedConfiguration configuration,
@InjectService("ResteasyRequestFilter") HttpServletRequestFilter resteasyRequestFilter,
@InjectService("JSAPIRequestFilter") HttpServletRequestFilter jsapiRequestFilter)
{
configuration.add("ResteasyRequestFilter", resteasyRequestFilter, "after:IgnoredPaths", "before:GZIP");
configuration.add("JSAPIRequestFilter", jsapiRequestFilter, "after:ResteasyRequestFilter");
}
@Contribute(SymbolProvider.class)
@FactoryDefaults
public static void setupSymbols(MappedConfiguration configuration)
{
configuration.add(ResteasySymbols.MAPPING_PREFIX, "/rest");
configuration.add(ResteasySymbols.MAPPING_PREFIX_JSAPI, "/jsapi");
configuration.add(ResteasySymbols.AUTOSCAN_REST_PACKAGE, true);
configuration.add(ResteasySymbols.CORS_ENABLED, false);
}
@Contribute(javax.ws.rs.core.Application.class)
public static void javaxWsRsCoreApplication(Configuration
© 2015 - 2025 Weber Informatics LLC | Privacy Policy