public void registerExceptionConverter(Class<? extends ExceptionConverter> exceptionConverterClass) { registerExceptionConverter(exceptionConverterClass, false); } public void registerExceptionConverter(Class<? extends ExceptionConverter> exceptionConverterClass, boolean first) {
public String getClassGetterClass() { return MBeanUtil.format( config.getClassGetter() != null ? config.getClassGetter().getClass().getName() : null ); }
public String showConverters() { Converter[] cs = config.getConverters().getConverters(); String[] names = new String[cs.length]; for (int i = 0; i < cs.length; i++) names[i] = cs[i].getClass().getName(); return MBeanUtil.format(names); }
private void forElement(XMap element, boolean custom, String graniteConfigProperties) { String scan = element.get("@scan"); this.scan = Boolean.TRUE.toString().equals(scan); loadCustomAMF3Serializer(element, custom); loadCustomAMF3DeserializerSecurizer(element, custom); loadCustomAMF3MessageInterceptor(element, custom); loadCustomConverters(element, custom); loadCustomMethodMatcher(element, custom); loadCustomInvocationListener(element, custom); loadCustomInstantiators(element, custom); loadCustomClassGetter(element, custom); loadCustomExternalizers(element, custom); loadCustomJMFExtendedCodecs(element, custom); loadCustomJMFDefaultStoredStrings(element, custom); loadCustomJMFReflection(element, custom); loadCustomDescriptors(element, custom); loadCustomExceptionConverters(element, custom); loadCustomTideComponents(element, custom); loadCustomSecurity(element, custom); loadCustomMessageSelector(element, custom); loadCustomGravity(element, custom); loadCustomDistributedDataFactory(element, custom); if (this.scan) scanConfig(graniteConfigProperties); finishCustomConverters(custom); }
private Message authorize(GraniteConfig config, final Message message, final AbstractSecurityContext securityContext) { try { if (config.hasSecurityService() && config.getSecurityService().acceptsContext()) return (Message)config.getSecurityService().authorize(securityContext); return (Message)securityContext.invoke(); } catch (Exception e) { return new ErrorMessage(message, e, true); } }
protected ActionScriptClassDescriptor(String type, byte encoding) { GraniteConfig config = GraniteContext.getCurrentInstance().getGraniteConfig(); this.type = (type == null ? "" : config.getAliasRegistry().getTypeForAlias(type)); this.instantiator = config.getInstantiator(type); this.encoding = encoding; this.externalizer = findExternalizer(); this.converters = config.getConverters(); this.properties = new ArrayList<Property>(); }
graniteConfig.getTideComponentMatchers().add(new TideComponentInstanceOfMatcher(ti.getName(), false)); log.debug("Enabled components implementing %s for Tide remoting", ti); graniteConfig.getTideComponentMatchers().add(new TideComponentAnnotatedWithMatcher(ta.getName(), false)); log.debug("Enabled components annotated with %s for Tide remoting", ta); graniteConfig.getTideComponentMatchers().add(new TideComponentNameMatcher(tn, false)); log.debug("Enabled components with name %s for Tide remoting", tn); graniteConfig.getTideComponentMatchers().add(new TideComponentTypeMatcher(tt, false)); log.debug("Enabled components with type %s for Tide remoting", tt); graniteConfig.registerExceptionConverter(ec, true); log.debug("Registered exception converter %s", ec); graniteConfig.registerExceptionConverter(ec, true); log.debug("Registered exception converter %s", ec.getClass()); graniteConfig.registerExternalizer(ext); log.debug("Registered externalizer %s", ext.getClass()); graniteConfig.setExternalizersByType(BigDecimal.class.getName(), BigDecimalExternalizer.class.getName()); graniteConfig.setExternalizersByType(BigInteger.class.getName(), BigIntegerExternalizer.class.getName()); graniteConfig.setExternalizersByType(Long.class.getName(), LongExternalizer.class.getName()); graniteConfig.setSecurityService(TypeUtil.newInstance(serverFilter.securityServiceClass(), SecurityService.class));
invocationContext = config.getMethodMatcher().findServiceMethod( request, destination, try { if (config.hasSecurityService() && config.getSecurityService().acceptsContext()) result = config.getSecurityService().authorize(invocationContext); else result = invocationContext.invoke(); if (config.hasSecurityService()) result = config.getSecurityService().authorize(invocationContext); else result = invocationContext.invoke();
public String getSecurityServiceClass() { return MBeanUtil.format( config.getSecurityService() != null ? config.getSecurityService().getClass().getName() : null ); }
public Class<? extends JavaClassDescriptor> getJavaDescriptor(String type) { return getElementByType(type, JC_DESCRIPTOR_FACTORY, javaDescriptorsByType, javaDescriptorsByInstanceOf, null, null); }
protected JavaClassDescriptor(Class<?> type) { GraniteConfig config = GraniteContext.getCurrentInstance().getGraniteConfig(); this.type = type; this.name = getClassName(type); this.externalizer = config.getExternalizer(type.getName()); this.converters = config.getConverters(); this.encoding = findEncoding(type); this.properties = introspectProperties(); }
ClassGetter classGetter = ((GraniteConfig)GraniteContext.getCurrentInstance().getGraniteConfig()).getClassGetter(); : manager.getReference(targetBean, Object.class, manager.createCreationalContext(targetBean)); if (value != null && config.isComponentTideDisabled(targetComponentName, beanClasses(targetBean), value)) add = false;
public String getServiceInvocationListenerClass() { return MBeanUtil.format( config.getInvocationListener() != null ? config.getInvocationListener().getClass().getName() : null ); }
public void load() { InputStream is = null; try { is = Thread.currentThread().getContextClassLoader().getResourceAsStream(graniteStdConfigPath); if (graniteConfigPath != null) is = Thread.currentThread().getContextClassLoader().getResourceAsStream(graniteConfigPath); graniteConfig = new GraniteConfig(graniteStdConfigPath, is, null, null); postLoad(graniteConfig); servicesConfig = new ServicesConfig(null, null, false); } catch (Exception e) { graniteConfig = null; servicesConfig = null; throw new RuntimeException("Cannot load configuration", e); } finally { if (is != null) try { is.close(); } catch (IOException e) { } } }
is = StreamUtil.getResourceAsStream("org/granite/config/granite-config.xml", loader); XMap doc = new XMap(is, resolver); forElement(doc, false, null); } finally { if (is != null) is = StreamUtil.getResourceAsStream(stdConfig, loader); XMap doc = new XMap(is, resolver); forElement(doc, false, null); } finally { if (is != null) forElement(doc, true, configuration != null ? configuration.getGraniteConfigProperties() : null);
public String getMethodMatcherClass() { return MBeanUtil.format( config.getMethodMatcher() != null ? config.getMethodMatcher().getClass().getName() : null ); }
private void forElement(XMap element, boolean custom, String graniteConfigProperties) { String scan = element.get("@scan"); this.scan = Boolean.TRUE.toString().equals(scan); loadCustomAMF3Serializer(element, custom); loadCustomAMF3DeserializerSecurizer(element, custom); loadCustomAMF3MessageInterceptor(element, custom); loadCustomConverters(element, custom); loadCustomMethodMatcher(element, custom); loadCustomInvocationListener(element, custom); loadCustomInstantiators(element, custom); loadCustomClassGetter(element, custom); loadCustomExternalizers(element, custom); loadCustomJMFExtendedCodecs(element, custom); loadCustomJMFDefaultStoredStrings(element, custom); loadCustomJMFReflection(element, custom); loadCustomDescriptors(element, custom); loadCustomExceptionConverters(element, custom); loadCustomTideComponents(element, custom); loadCustomSecurity(element, custom); loadCustomMessageSelector(element, custom); loadCustomGravity(element, custom); loadCustomDistributedDataFactory(element, custom); if (this.scan) scanConfig(graniteConfigProperties); finishCustomConverters(custom); }
invocationContext = config.getMethodMatcher().findServiceMethod( request, destination, try { if (config.hasSecurityService() && config.getSecurityService().acceptsContext()) result = config.getSecurityService().authorize(invocationContext); else result = invocationContext.invoke(); if (config.hasSecurityService()) result = config.getSecurityService().authorize(invocationContext); else result = invocationContext.invoke();
GraniteConfig config = context.getGraniteConfig(); if (!config.hasSecurityService()) log.warn("Ignored security operation (no security settings in granite-config.xml): %s", request); else { SecurityService securityService = config.getSecurityService(); try { if (request.isLoginOperation())
@Override public void modifyHandshake(ServerEndpointConfig config, HandshakeRequest request, HandshakeResponse response) { // Tomcat websocket impl returns request headers in lowercase ???? String connectMessageId = getHeaderOrParameter(request, "connectId", true); String clientId = getHeaderOrParameter(request, "GDSClientId", true); String clientType = getHeaderOrParameter(request, "GDSClientType", true); HttpSession session = (HttpSession)request.getHttpSession(); log.debug( "WebSocket configurator handshake ackId %s clientId %s sessionId %s", connectMessageId, clientId, session != null ? session.getId() : "(none)" ); Gravity gravity = (Gravity)config.getUserProperties().get("gravity"); if (gravity.getGraniteConfig().getSecurityService() != null) gravity.getGraniteConfig().getSecurityService().prelogin(session, request, null); String ctype = getHeader(request, "Content-Type", true); String protocol = getHeader(request, "Sec-WebSocket-Protocol", true); ContentType contentType = WebSocketUtil.getContentType(ctype, protocol); // Hack using a thread local to be sure that the endpoint gets the correct values // Jetty and GlassFish GravityWebSocketConfig.set(connectMessageId, clientId, clientType, contentType, session); }