java-ee

Tomcat and proxy settings

老子叫甜甜 提交于 2019-12-30 06:17:14
问题 There is a servlet running on tomcat7 and it makes a webservice call to a third party website. The call works fine from the windows machine but when run from tomcat it fails. Wont Tomcat automatically use the Windows' proxy settings? I added set JAVA_OPTS=%JAVA_OPTS% "-Dhttp.proxySet=true" set JAVA_OPTS=%JAVA_OPTS% "-Dhttp.proxyHost=IP" set JAVA_OPTS=%JAVA_OPTS% "-Dhttp.proxyPort=8080" to CATALINA.BAT and http.proxyHost=IP http.proxyPort=8080 to catalina.properties But still there is no

Servlet containers and classpath

泪湿孤枕 提交于 2019-12-30 06:00:36
问题 To what is the class path of a Servlet container set? As per my understanding there are three components involved. The JAR files in the lib directory of the Servlet container and then the classes in the WEB-INF/classes and JAR files in the WEB-INF/lib directory. The classes in lib directory of the Servlet container are added to the system classpath and the dynamic classpath includes the JAR files in the lib directory and classes in the classes directory. To what is the dynamic classpath set?

How to write response filter?

旧巷老猫 提交于 2019-12-30 05:27:04
问题 Is there a way to handle only response in a filter . Is the code written below correct ? public void doFilter(request , response , chain) { //code to handle request chain.doFilter(request, response); //code to handle response . } 回答1: It depends on what you want. In general, your sample is not correct though. After chain.doFilter has returned, it's too late to do anything with the response. At this point, entire response was already sent to the client and your code has no access to it. What

EJB3 & How JAAS subject/principal is propagated to EJB Tier from servlet container?

前提是你 提交于 2019-12-30 05:24:04
问题 I'm trying to understand how the JAAS principal propagates to the Business/EJB tier from web tier. I've read that the if the roles/realm is configured in login-config & security-context of web.xml then the servlet container will also transparently pass the authenticated principal to the EJB Tier. Two questions 1.) First & more importantly is that true ? Without any intervention from the developer ! 2.) And secondly any idea how that works under the hood. 回答1: yes it's true. that's generally

With Java EL 2.2 / JSF2 Is it possible to do field access rather than getters/setters?

女生的网名这么多〃 提交于 2019-12-30 05:14:10
问题 I'm serious tired of getters/setters clogging my code, when I don't need to control access to the internal state of an object. The only real reason I have to still generate getters/setters is because JSF2.0 / EL 2.2 works by locating methods, not fields: ${myBean.fieldName} . where fieldName refers to the function getFieldName() . Would it be possible to extend an EL Resolver to just return the public field value unless a getter was found? EDIT: I hope this helps someone else. Notice how I

Open source survey/questionnaire engine for Java [closed]

一个人想着一个人 提交于 2019-12-30 04:38:06
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Is there an open source survey engine for java that will allow branching of questions? i.e. Question 1 has the options of A, B, or C and they each take you to a different set of follow-up questions. I've found a couple (JSurveyLib and Socrates QE), but those seem to be very tied to a GUI. The application that I

Send data to front end when back end updates

做~自己de王妃 提交于 2019-12-30 04:24:50
问题 The backend of my web application receives updates from several clients. When such an update happens it should be communicated to all other clients. How can I initiate an update from the server to all web browser clients when my backend is updated? I'm using JBoss, JSF and the Spring framework. 回答1: See similar Stack overflow quetion : WebSockets vs. Server-Sent events/EventSource I'm assuming, as DarthVader did, that your frontend is a (generally) stateless HTML page of some sort. Something

What are the differences between Hibernate and JPA?

北慕城南 提交于 2019-12-30 04:11:27
问题 When i was in college learning about web programming, they told us about hibernate. We used it for a while, i even had the chance to work with it in a real scenario in a company for almost 8 months. Now that i completely switching to Java EE 6 ( Im in love :) ), I use JPA for my ORM needs. It is being a few months since i use it, but i dont really understand what are the differences between one and other. Why some people say one or other is better or worse? The way i do my mappings and

Java mock database connection [closed]

余生长醉 提交于 2019-12-30 04:00:28
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I want to test class with make db connection. Class that I want to test accept as param in constructor Connection class. I want to pass mock object to the constructor. Can you tell me good framework with example how to mock db connection? 回答1: You can use MockRunner, which has support for JDBC. General mocking

Using BoneCP: Handling connections from the pool

此生再无相见时 提交于 2019-12-30 03:19:06
问题 I have just started using BoneCP and this is my first time using a connection pool. I'm somewhat confused as to how I am supposed to use it. Currently I am saving the BoneCP-object as a static variable, and thus I can use it between different connections. When I'm done with the connection, I close it with connection.close() . Should I do this, or should I not close it to enable it to be reused by the pool? This is my current implementation to get a connection: private static BoneCP