com.sun.jersey.core.util.FeaturesAndProperties Java Examples

The following examples show how to use com.sun.jersey.core.util.FeaturesAndProperties. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebApp.java    From hadoop with Apache License 2.0 6 votes vote down vote up
protected void configureWebAppServlets() {
  // Add in the web services filters/serves if app has them.
  // Using Jersey/guice integration module. If user has web services
  // they must have also bound a default one in their webapp code.
  if (this.wsName != null) {
    // There seems to be an issue with the guice/jersey integration
    // where we have to list the stuff we don't want it to serve
    // through the guicecontainer. In this case its everything except
    // the the web services api prefix. We can't just change the filter
    // from /* below - that doesn't work.
    String regex = "(?!/" + this.wsName + ")";
    serveRegex(regex).with(DefaultWrapperServlet.class);

    Map<String, String> params = new HashMap<String, String>();
    params.put(ResourceConfig.FEATURE_IMPLICIT_VIEWABLES, "true");
    params.put(ServletContainer.FEATURE_FILTER_FORWARD_ON_404, "true");
    params.put(FeaturesAndProperties.FEATURE_XMLROOTELEMENT_PROCESSING, "true");
    params.put(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, GZIPContentEncodingFilter.class.getName());
    params.put(ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS, GZIPContentEncodingFilter.class.getName());
    filter("/*").through(getWebAppFilterClass(), params);
  }
}
 
Example #2
Source File: WebApp.java    From big-c with Apache License 2.0 6 votes vote down vote up
protected void configureWebAppServlets() {
  // Add in the web services filters/serves if app has them.
  // Using Jersey/guice integration module. If user has web services
  // they must have also bound a default one in their webapp code.
  if (this.wsName != null) {
    // There seems to be an issue with the guice/jersey integration
    // where we have to list the stuff we don't want it to serve
    // through the guicecontainer. In this case its everything except
    // the the web services api prefix. We can't just change the filter
    // from /* below - that doesn't work.
    String regex = "(?!/" + this.wsName + ")";
    serveRegex(regex).with(DefaultWrapperServlet.class);

    Map<String, String> params = new HashMap<String, String>();
    params.put(ResourceConfig.FEATURE_IMPLICIT_VIEWABLES, "true");
    params.put(ServletContainer.FEATURE_FILTER_FORWARD_ON_404, "true");
    params.put(FeaturesAndProperties.FEATURE_XMLROOTELEMENT_PROCESSING, "true");
    params.put(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, GZIPContentEncodingFilter.class.getName());
    params.put(ResourceConfig.PROPERTY_CONTAINER_RESPONSE_FILTERS, GZIPContentEncodingFilter.class.getName());
    filter("/*").through(getWebAppFilterClass(), params);
  }
}
 
Example #3
Source File: JerseyModuleProvidesTest.java    From dagger-servlet with Apache License 2.0 5 votes vote down vote up
@Inject
public ProvidesResource(DaggerContainer daggerContainer, WebApplication webApplication, Providers providers,
                        FeaturesAndProperties featuresAndProperties, MessageBodyWorkers messageBodyWorkers,
                        ExceptionMapperContext exceptionMapperContext, ResourceContext resourceContext) {
    assertNotNull(daggerContainer);
    assertNotNull(webApplication);
    assertNotNull(providers);
    assertNotNull(featuresAndProperties);
    assertNotNull(messageBodyWorkers);
    assertNotNull(exceptionMapperContext);
    assertNotNull(resourceContext);
}
 
Example #4
Source File: JerseyModule.java    From dagger-servlet with Apache License 2.0 4 votes vote down vote up
@Provides
public FeaturesAndProperties provideFeaturesAndProperties(WebApplication webApplication) {
    return webApplication.getFeaturesAndProperties();
}