Search in sources :

Example 41 with PostConstruct

use of jakarta.annotation.PostConstruct in project jans by JanssenProject.

the class DataMapperService method init.

@PostConstruct
public void init() {
    this.objectMapper = new ObjectMapper();
    this.cborFactory = new CBORFactory();
    this.cborObjectMapper = new ObjectMapper(cborFactory);
}
Also used : CBORFactory(com.fasterxml.jackson.dataformat.cbor.CBORFactory) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) PostConstruct(jakarta.annotation.PostConstruct)

Example 42 with PostConstruct

use of jakarta.annotation.PostConstruct in project jans by JanssenProject.

the class SearchResourcesWebService method setup.

@PostConstruct
public void setup() {
    // Do not use getClass() here... a typical weld issue...
    endpointUrl = appConfiguration.getBaseEndpoint() + SearchResourcesWebService.class.getAnnotation(Path.class).value();
    mapper = new ObjectMapper();
    // Do not alter the order of appearance (see getListResponseTree)
    resourceClasses = new Class[] { UserResource.class, GroupResource.class, FidoDeviceResource.class, Fido2DeviceResource.class };
    NUM_RESOURCE_TYPES = resourceClasses.length;
}
Also used : Path(jakarta.ws.rs.Path) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) PostConstruct(jakarta.annotation.PostConstruct)

Example 43 with PostConstruct

use of jakarta.annotation.PostConstruct in project jans by JanssenProject.

the class ProtectionServiceSelector method init.

/**
 * Builds a map around url patterns and service beans that are aimed to perform
 * actual protection
 */
@SuppressWarnings("unchecked")
@PostConstruct
private void init() {
    mapping = new HashMap<>();
    Set<Bean<?>> beans = beanManager.getBeans(JansRestService.class, Any.Literal.INSTANCE);
    for (Bean bean : beans) {
        Class beanClass = bean.getBeanClass();
        Optional.ofNullable(beanClass.getAnnotation(BindingUrls.class)).map(BindingUrls.class::cast).map(BindingUrls::value).map(Arrays::asList).orElse(Collections.emptyList()).forEach(pattern -> {
            if (pattern.length() > 0) {
                mapping.put(pattern, beanClass);
            }
        });
    }
}
Also used : Arrays(java.util.Arrays) Bean(jakarta.enterprise.inject.spi.Bean) PostConstruct(jakarta.annotation.PostConstruct)

Example 44 with PostConstruct

use of jakarta.annotation.PostConstruct in project faces by jakartaee.

the class Issue2674Bean method setup.

@PostConstruct
private void setup() {
    HtmlInputText inputText = (HtmlInputText) FacesContext.getCurrentInstance().getApplication().createComponent(HtmlInputText.COMPONENT_TYPE);
    AjaxBehavior ajaxBehavior = (AjaxBehavior) FacesContext.getCurrentInstance().getApplication().createBehavior(AjaxBehavior.BEHAVIOR_ID);
    inputText.setId("input");
    ajaxBehavior.addAjaxBehaviorListener(this);
    ajaxBehavior.setTransient(true);
    ajaxBehavior.setDisabled(false);
    inputText.addClientBehavior("focus", ajaxBehavior);
    text = inputText;
}
Also used : HtmlInputText(jakarta.faces.component.html.HtmlInputText) AjaxBehavior(jakarta.faces.component.behavior.AjaxBehavior) PostConstruct(jakarta.annotation.PostConstruct)

Example 45 with PostConstruct

use of jakarta.annotation.PostConstruct in project faces by jakartaee.

the class ButtonOnlySubmitsOneBean method init.

@PostConstruct
public void init() {
    strings = new ArrayList();
    strings.add("value1");
    strings.add("value2");
}
Also used : ArrayList(java.util.ArrayList) PostConstruct(jakarta.annotation.PostConstruct)

Aggregations

PostConstruct (jakarta.annotation.PostConstruct)76 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 IOException (java.io.IOException)6 Date (java.util.Date)6 PostBean (it.vige.rubia.dto.PostBean)4 JSFUtil.handleException (it.vige.rubia.ui.JSFUtil.handleException)4 ArrayList (java.util.ArrayList)4 ForumBean (it.vige.rubia.dto.ForumBean)3 FacesContext (jakarta.faces.context.FacesContext)3 Method (java.lang.reflect.Method)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)3 ApplicationAssociate (com.sun.faces.application.ApplicationAssociate)2 HTTPServer (io.prometheus.client.exporter.HTTPServer)2 ModuleException (it.vige.rubia.ModuleException)2 CategoryBean (it.vige.rubia.dto.CategoryBean)2 TopicBean (it.vige.rubia.dto.TopicBean)2 SessionScoped (jakarta.enterprise.context.SessionScoped)2 Typed (jakarta.enterprise.inject.Typed)2 ClientWindow (jakarta.faces.lifecycle.ClientWindow)2 Serializable (java.io.Serializable)2