本文整理汇总了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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
};
}
}
示例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;
}
};
}
}
示例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;
}
示例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;
}
示例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;
}
示例11: CustomAnnotationProvider
import org.glassfish.jersey.server.model.Parameter; //导入依赖的package包/类
@Inject
protected CustomAnnotationProvider(
MultivaluedParameterExtractorProvider mpep,
ServiceLocator locator) {
super(mpep, locator, Parameter.Source.UNKNOWN);
}
示例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) { }
};
}
示例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;
}
示例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;
}
示例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;
}