当前位置: 首页>>代码示例>>Java>>正文


Java Parameter类代码示例

本文整理汇总了Java中org.glassfish.jersey.server.model.Parameter的典型用法代码示例。如果您正苦于以下问题:Java Parameter类的具体用法?Java Parameter怎么用?Java Parameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Parameter类属于org.glassfish.jersey.server.model包,在下文中一共展示了Parameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createValueFactory

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Override
protected Factory<?> createValueFactory(Parameter parameter) {

    if (!parameter.isAnnotationPresent(Prop.class)) {
        return null;
    }

    String parameterName = parameter.getSourceName();
    if (parameterName == null || parameterName.length() == 0) {
        // Invalid parameter name
        return null;
    }

    MultivaluedParameterExtractor e = get(parameter);
    if (e == null) {
        return null;
    }

    PropertyFactory factory = new PropertyFactory(e, parameter, i18nEnabled);
    serviceLocator.inject(factory);
    return factory;
}
 
开发者ID:psamsotha,项目名称:jersey-properties,代码行数:23,代码来源:PropertiesValueFactoryProvider.java

示例2: getEntityStream

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
/**
 * Converts {@link Parameter} to {@link InputStream} or {@link List} of
 * {@link InputStream} by {@link Parameter} nature
 * 
 * @param parameter
 * @return {@link Object}
 */
private Object getEntityStream(Parameter parameter) {

    Object stream;

    List<String> paramValues = uriParams.get(parameter.getSourceName());
    String value;
    if (CollectionUtils.valid(paramValues)) {
        if (paramValues.size() == PARAM_VALIES_LENGTH) {
            value = CollectionUtils.getFirst(paramValues);
            stream = RequestUtils.textToStream(value);
        } else {
            stream = RequestUtils.textsToStreams(paramValues);
        }
    } else {
        stream = null;
    }

    return stream;
}
 
开发者ID:levants,项目名称:lightmare,代码行数:27,代码来源:ParamBuilder.java

示例3: fillParamList

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
/**
 * Reads from {@link InputStream} or {@link List} of {@link InputStream} in
 * case that parameters are multi valued
 * 
 * @param stream
 * @param parameter
 * @throws IOException
 */
private void fillParamList(Object stream, Parameter parameter) throws IOException {

    InputStream entityStream;

    if (stream instanceof InputStream) {
        entityStream = ObjectUtils.cast(stream, InputStream.class);
        readFromStream(entityStream, parameter);
    } else if (stream instanceof List) {
        List<InputStream> streamsList = ObjectUtils.cast(stream);
        Iterator<InputStream> streams = streamsList.iterator();
        while (streams.hasNext()) {
            entityStream = streams.next();
            readFromStream(entityStream, parameter);
        }
    }
}
 
开发者ID:levants,项目名称:lightmare,代码行数:25,代码来源:ParamBuilder.java

示例4: extractParams

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
/**
 * Extracts parameters from {@link ContainerRequestContext} instance
 * 
 * @return {@link List}<Object>
 * @throws IOException
 */
public List<Object> extractParams() throws IOException {

    paramsList = new ArrayList<Object>();

    check = check();
    httpHeaders = request.getHeaders();
    uriParams = extractParameters(request);
    Object stream;
    for (Parameter parameter : parameters) {
        reader = RequestUtils.getReader(workers, parameter, mediaType);
        stream = getEntityStream(request, parameter);
        if (ObjectUtils.notNull(stream)) {
            fillParamList(stream, parameter);
        } else {
            addNullParam(parameter);
        }
    }

    return paramsList;
}
 
开发者ID:levants,项目名称:lightmare,代码行数:27,代码来源:ParamBuilder.java

示例5: RateLimitingFactoryProvider

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Inject
public RateLimitingFactoryProvider(final MultivaluedParameterExtractorProvider extractorProvider,
                                   final ServiceLocator injector,
                                   final RateLimiterFactoryProvider rateLimiterFactoryProvider) {
    super(extractorProvider, injector, Parameter.Source.UNKNOWN);
    this.requestRateLimiterFactory = rateLimiterFactoryProvider.factory;
}
 
开发者ID:mokies,项目名称:ratelimitj,代码行数:8,代码来源:RateLimitBundle.java

示例6: createValueFactory

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Override
protected Factory<RequestRateLimiterFactory> createValueFactory(final Parameter parameter) {
    final RateLimiting annotation = parameter.getAnnotation(RateLimiting.class);
    if (null == annotation) {
        return null;
    } else {
        return new AbstractContainerRequestValueFactory<RequestRateLimiterFactory>() {
            public RequestRateLimiterFactory provide() {
                return requestRateLimiterFactory;
            }
        };
    }
}
 
开发者ID:mokies,项目名称:ratelimitj,代码行数:14,代码来源:RateLimitBundle.java

示例7: createValueFactory

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Override
protected Factory<?> createValueFactory(final Parameter parameter) {
    final RateLimiting annotation = parameter.getAnnotation(RateLimiting.class);
    if (null == annotation) {
        return null;
    } else {
        return new AbstractContainerRequestValueFactory<RequestRateLimiterFactory>() {
            public RequestRateLimiterFactory provide() {
                return requestRateLimiterFactory;
            }
        };
    }
}
 
开发者ID:mokies,项目名称:ratelimitj,代码行数:14,代码来源:RateLimit429EnforcerFilterTest.java

示例8: createValueFactory

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Override
    protected Factory<?> createValueFactory(Parameter parameter) {

        LOGGER.debug("{}", parameter);
//        parameter.getSourceName()
        JsonParamValueFactory factory = new JsonParamValueFactory(parameter);
        getLocator().inject(factory);
        return factory;
    }
 
开发者ID:protoxme,项目名称:protox-webapp-archetype,代码行数:10,代码来源:JsonParamValueFactoryProvider.java

示例9: Pac4JProfileValueFactoryProvider

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Inject
protected Pac4JProfileValueFactoryProvider(ProfileManagerFactoryBuilder manager,
        OptionalProfileFactoryBuilder opt, ProfileFactoryBuilder profile,
        MultivaluedParameterExtractorProvider mpep, ServiceLocator locator) {
    super(mpep, locator, Parameter.Source.UNKNOWN);
    this.manager = manager;
    this.optProfile = opt;
    this.profile = profile;
}
 
开发者ID:pac4j,项目名称:jax-rs-pac4j,代码行数:10,代码来源:Pac4JValueFactoryProvider.java

示例10: createValueFactory

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Override
protected Factory<?> createValueFactory(Parameter parameter) {
    if (parameter.isAnnotationPresent(Pac4JProfileManager.class)) {
        if (ProfileManager.class.isAssignableFrom(parameter.getRawType())) {
            return manager.get();
        }

        throw new IllegalStateException("Cannot inject a Pac4J profile manager into a parameter of type "
                + parameter.getRawType().getName());
    }

    if (parameter.isAnnotationPresent(Pac4JProfile.class)) {
        if (CommonProfile.class.isAssignableFrom(parameter.getRawType())) {
            return profile.get();
        }

        if (Optional.class.isAssignableFrom(parameter.getRawType())) {
            List<ClassTypePair> ctps = ReflectionHelper.getTypeArgumentAndClass(parameter.getRawType());
            ClassTypePair ctp = (ctps.size() == 1) ? ctps.get(0) : null;
            if (ctp == null || CommonProfile.class.isAssignableFrom(ctp.rawClass())) {
                return optProfile.get();
            }
        }

        throw new IllegalStateException(
                "Cannot inject a Pac4J profile into a parameter of type " + parameter.getRawType().getName());
    }

    return null;
}
 
开发者ID:pac4j,项目名称:jax-rs-pac4j,代码行数:31,代码来源:Pac4JValueFactoryProvider.java

示例11: CustomAnnotationProvider

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Inject
protected CustomAnnotationProvider(
		MultivaluedParameterExtractorProvider mpep,
		ServiceLocator locator) {

	super(mpep, locator, Parameter.Source.UNKNOWN);
}
 
开发者ID:Maddoc42,项目名称:JaxRs2Retrofit,代码行数:8,代码来源:CustomAnnotationTest.java

示例12: createValueFactory

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Override
protected Factory<String> createValueFactory(Parameter parameter) {
	return new Factory<String>() {
		@Override
		public String provide() {
			return "hello world";
		}

		@Override
		public void dispose(String instance) {  }
	};
}
 
开发者ID:Maddoc42,项目名称:JaxRs2Retrofit,代码行数:13,代码来源:CustomAnnotationTest.java

示例13: AuthValueFactoryProvider

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Inject
public AuthValueFactoryProvider(final MultivaluedParameterExtractorProvider extractorProvider,
    final ServiceLocator injector, ClientAuthFactory clientAuthFactory,
    AutomationClientAuthFactory automationClientAuthFactory, UserAuthFactory userAuthFactory) {
  super(extractorProvider, injector, Parameter.Source.UNKNOWN);
  this.clientAuthFactory = clientAuthFactory;
  this.automationClientAuthFactory = automationClientAuthFactory;
  this.userAuthFactory = userAuthFactory;
}
 
开发者ID:square,项目名称:keywhiz,代码行数:10,代码来源:AuthResolver.java

示例14: createValueFactory

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Override protected Factory<?> createValueFactory(final Parameter parameter) {
  final Class<?> classType = parameter.getRawType();
  final Auth auth = parameter.getAnnotation(Auth.class);

  if (auth == null) {
    return null;
  }

  if (classType.equals(Client.class)) {
    return new AbstractContainerRequestValueFactory<Client>() {
      @Override public Client provide() {
        return clientAuthFactory.provide(getContainerRequest());
      }
    };
  }

  if (classType.equals(AutomationClient.class)) {
    return new AbstractContainerRequestValueFactory<AutomationClient>() {
      @Override public AutomationClient provide() {
        return automationClientAuthFactory.provide(getContainerRequest());
      }
    };
  }

  if (classType.equals(User.class)) {
    return new AbstractContainerRequestValueFactory<User>() {
      @Override public User provide() {
        return userAuthFactory.provide(getContainerRequest());
      }
    };
  }

  return null;
}
 
开发者ID:square,项目名称:keywhiz,代码行数:35,代码来源:AuthResolver.java

示例15: ConfigurationFactoryProvider

import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Inject
protected ConfigurationFactoryProvider(final MultivaluedParameterExtractorProvider extractorProvider,
        final ServiceLocator injector, final ConfigurationFactoryInfo configInfo) {
    super(extractorProvider, injector, Parameter.Source.UNKNOWN);
    this.configuration = configInfo.configuration;
    this.dataSource = configInfo.dataSource;
    this.multiTenantConnectionProvider = configInfo.multiTenantConnectionProvider;
}
 
开发者ID:tbugrara,项目名称:dropwizard-jooq,代码行数:9,代码来源:ConfigurationFactoryProvider.java


注:本文中的org.glassfish.jersey.server.model.Parameter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。