java-ee

Assign a pool to a specific stateless bean in JBoss EAP 6.1

ぃ、小莉子 提交于 2019-12-24 00:22:58
问题 I can see how one can control the size of the global pool for all the stateless session beans. However, I would like to be able to have a new pool that only applies to one type of stateless bean. This way, all my stateless beans but one would be pooled from the usual slsb-strict-max-pool , and one bean would have its own pool. Is it possible to do that in JBoss EAP 6.1? 回答1: Use @org.jboss.ejb3.annotation.Pool(value="myPoolName") annotation on the EJB referencing your custom pool as defined

Display list of files in webpage using servlet

懵懂的女人 提交于 2019-12-24 00:16:15
问题 I'm new to Java EE, and I want to display in a webpage a list of PDF thumbnails. These PDF are stored in a folder in src/main/webapp/pdf , and I want to read this folder to get all the filenames. Here is my code : @Override public void doGet(HttpServletRequest req, HttpServletResponse res) { try { res.setContentType("application/json"); res.setCharacterEncoding("UTF-8"); PrintWriter out = res.getWriter(); File pdfFolder = new File("/pdf"); for (File pdf : pdfFolder.listFiles()) { // Line 27

How can I do a 301 redirect from http to https in Wildfly 8.2?

一世执手 提交于 2019-12-23 23:51:42
问题 My web.xml has the following security constraint: <security-constraint> <web-resource-collection> <web-resource-name>App</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint> This configuration redirects all http URLs to https via 302 redirects. Is there a way to accomplish the same except via 301 redirects in Wildfly 8.2? 回答1: One way I can

Catch KeyCode in AjaxBehaviorEvent of JSF 2

旧时模样 提交于 2019-12-23 23:07:53
问题 I have a JSF ajax keyup event linked to an event listner in a backing bean. The code in the JSF file is like below. <h:inputText id="txtDescription" value="#{institutionController.current.description}" disabled="#{institutionController.modifyControlDisable}" > <f:ajax event="keyup" listener="#{institutionController.changeDetailsEvent}" /> </h:inputText> The code in the backing bean is like below. public void changeDetailsEvent(AjaxBehaviorEvent event) { } I want to achieve different logic

CDI ambiguous dependency when adding @Named qualifier to existing bean via @Produces

冷暖自知 提交于 2019-12-23 23:07:04
问题 I have a CDI bean implementation in a dependency jar file: @ApplicationScoped public class MyService { public String doSomething() {...} } In my webapp, I want to access that service via EL Expression, therefore I have to give it a @Named annotation. But I cannot add the annotation on the MyService implementation because I don't have the rights to change that code. Therefore I tried creating a producer like public class MyServiceProducer { @Inject MyService myService; @Produces @Named(

@Resource error: “Naming binding already exists for foo.NewServlet/userName in namespace”

自作多情 提交于 2019-12-23 22:52:04
问题 I am looking at using the "@Resource String ..." injection available in servlet 3.0+ containers for providing configuration parameters easily to servlets. I would like for the defaults to work and fail if the key is not present in JNDI (indicating a configuration error) I have toyed with a simple servlet in Netbeans 8.2 with Glassfish 4.1.1 where I would like to have the userName field, and the setFullName(String fullName) set: package foo; import java.io.IOException; import java.io

What are the available Java EE Websockets implementations?

笑着哭i 提交于 2019-12-23 22:36:39
问题 For the JSR 356 - Java API for WebSocket i know the reference implementation is Tyrus. Are there any others? If not, then i guess Tyrus is the implementation in all Application Servers (Glassfish, JBossAS/Wildfly etc...) 回答1: As far as I know, there are a few JSR 356 Java API for WebSocket implementations besides Tyrus (the reference implementation): Apache Tomcat Jetty Undertow used by WildFly Glassfish is the Java EE reference implementation and uses Tyrus. According to my researches: IBM

Upgrading to maven 3 from maven 2

自闭症网瘾萝莉.ら 提交于 2019-12-23 22:25:04
问题 I have upgraded from Maven 2 to Maven 3 and it seems to be working fine to clean install . However, in the Maven 3.x Compatibility Notes, it is mentioned that the <reporting> tag is no longer supported and should be moved up to the <build> tag. <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> <version>2.1</version> <reportSets> <reportSet> <reports> <report>dependencies</report> <report>dependency-convergence

group memberships in (AD) ldap Realm

我的未来我决定 提交于 2019-12-23 22:24:12
问题 I use the JAAS Framework for the authentification and authorization process in a java ee enterprise application. I use GlassFish as the application server. My realm configuration looks like: <auth-realm name="ads-realm" classname="com.sun.enterprise.security.auth.realm.ldap.LDAPRealm"> <property name="jaas-context" value="ldapRealm" /> <property name="base-dn" value="CN=Users,DC=company,DC=intern" /> <property name="directory" value="ldap://ad.company.intern:389" /> <property name="search

Issue with log4j log not writing to file

风流意气都作罢 提交于 2019-12-23 21:51:11
问题 Does anyone see why this log is not writing to file. It is writing to standard out twice but not to the file: Also, I tried removing the "Stdout" appender and then I don't get any logging at all. package org.berlin.wicket; import org.apache.log4j.Logger; private static final Logger LOG = Logger.getLogger(QuickstartPage.class); LOG.info("Loading constructor"); log4j.rootLogger=DEBUG,Stdout,mainAppender log4j.appender.Stdout=org.apache.log4j.ConsoleAppender log4j.appender.Stdout.layout=org