Java Code Examples for javax.portlet.PortletContext#getInitParameter()

The following examples show how to use javax.portlet.PortletContext#getInitParameter() . 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: VariableValidatorProducer.java    From portals-pluto with Apache License 2.0 6 votes vote down vote up
@Produces
@ApplicationScoped
public VariableValidator getVariableValidator(PortletConfig portletConfig, PortletContext portletContext) {

	boolean includeStandardBeans = false;

	String initParameter = portletConfig.getInitParameter(VariableValidator.INCLUDE_STANDARD_BEANS);

	if (initParameter != null) {
		includeStandardBeans = Boolean.valueOf(initParameter.toString());
	}

	initParameter = portletContext.getInitParameter(VariableValidator.INCLUDE_STANDARD_BEANS);

	if (initParameter != null) {
		includeStandardBeans = Boolean.valueOf(initParameter.toString());
	}

	return new CDIVariableValidator(includeStandardBeans);
}
 
Example 2
Source File: ContextInitParameterTest.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
protected TestResult checkGetInitParameter(PortletContext context) {
    TestResult result = new TestResult();
    result.setDescription("Ensure that init parameters are retrieveable.");
    result.setSpecPLT("10.3.1");

    String value = context.getInitParameter(TEST_PARAM_NAME);
    if (TEST_PARAM_VALUE.equals(value)) {
    	result.setReturnCode(TestResult.PASSED);
    } else {
    	TestUtils.failOnAssertion("init parameter", value, TEST_PARAM_VALUE, result);
    }
    return result;
}
 
Example 3
Source File: SpringVariableValidator.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isIncludeStandardBeans() {

	Boolean include = this.includeStandardBeans;

	// First check without locking (not yet thread-safe)
	if (include == null) {

		synchronized (this) {
			include = this.includeStandardBeans;

			// Second check with locking (thread-safe)
			if (include == null) {

				PortletConfig portletConfig = getPortletConfig();
				String initParameterValue = portletConfig.getInitParameter(
						VariableValidator.INCLUDE_STANDARD_BEANS);

				boolean initParameterFlag = false;

				if (initParameterValue != null) {
					initParameterFlag = Boolean.valueOf(initParameterValue.toString());
				}

				PortletContext portletContext = getPortletContext();
				initParameterValue = portletContext.getInitParameter(VariableValidator.INCLUDE_STANDARD_BEANS);

				if (initParameterValue != null) {
					initParameterFlag = Boolean.valueOf(initParameterValue.toString());
				}

				include = this.includeStandardBeans = initParameterFlag;
			}
		}
	}

	return include;
}