java-ee

Get SQL String from Hibernate query

前提是你 提交于 2019-12-18 04:41:45
问题 I need to get the string from an Hibernate query and process it later (so I can't solve it with "hibernate.show_sql" ). I have already looked at How to get SQL from Hibernate Criteria API (*not* for logging) but with that workaround I get the SQL query string but instead of showing the parameters value it shows '?'... Is there any way to get the full SQL string with the parameters values? I mean, with that solution I get "SELECT * FROM USER WHERE NAME=? AND SURNAME=?" but I need to get

How do I upgrade an existing enterprise project from Java EE5 to Java EE 6 in Netbeans (6.9)

一世执手 提交于 2019-12-18 04:24:16
问题 The project has an EJB module & a web module. Changing the server is easy, but I'd like to switch to EJB 3.1 also but I believe I need to change all kind of configuration files since I can't do it from the project properties window(s). Any tips or links do useful documentation will be greatly appreciated. Thank you! 回答1: Apparently it's not that complicated. It worked for me by modifying the following files: <project-folder> /nbproject/project.properties change the following lines: j2ee

Implementing chat application with Java EE

吃可爱长大的小学妹 提交于 2019-12-18 04:24:06
问题 I have developed my web application by using Java EE framework EJB 3, at front using JSF. Now I plan to add chat tool to my web application. All online users can chat with each other. Can you please guide me which tool I should use to Integrate it with Java EE to develop my chat application? I also appreciate if you provide code or any link. 回答1: 1- You have to install a pre developed Chat server. There is many available solutions I advice you to choose Ejabberd ( http://www.ejabberd.im/ ).

Returning CSV file from Servlet using ServletOutputStream over HTTPS in Internet Explorer

社会主义新天地 提交于 2019-12-18 04:19:05
问题 I have a Servlet which is returning a csv file that is 'working' over HTTP in both internet explorer and firefox. When I execute the same Servlet over HTTPS only firefox continues to download the csv file over HTTPS. I don't think this is necessarily an Internet 6 or 7 issue described on MSDN : The message is: Internet Explorer cannot download data.csv from mydomain.com Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found.

Start / stop a web application from itself?

陌路散爱 提交于 2019-12-18 04:16:38
问题 I've made a web application using Java, Struts and running over Apache Server and Tomcat. It would be very useful to be able to restart the application from the web. I don't want to restart Tomcat, only this webapp, the same way as Tomcat Manager does it. Do you know how can I do it? If not, any way to simulate that behaviour (reload config.properties, make Hibernate init process, etc)? Thank you a lot. 回答1: I took a quick look at the source code for the Tomcat Manager. It looks like there's

java- using a filter to check remote address

六眼飞鱼酱① 提交于 2019-12-18 04:16:14
问题 What would be the best approach to detect if a web application is accessed locally? I am interested in checking this in a filter ( javax.servlet.Filter ). I could check the ServletRequest#getRemoteAddr() if it is 127.0.0.1 but if it is running in a IPv6 machine, the address would be 0:0:0:0:0:0:0:1 . Are there any other pitfalls I should be aware of, or if I just check for these 2 string patterns, I would be ok? Thanks 回答1: In theory, the following ought to be sufficient. if (request

How to determine by what IP Address my website has been accessed? [duplicate]

旧城冷巷雨未停 提交于 2019-12-18 04:12:49
问题 This question already has answers here : How do I get the remote address of a client in servlet? (10 answers) Closed 3 years ago . I have a web application and for that I want to capture the IP address of the clients who are accessing my website so that I can know what region is the most accessing the application. I am using Java EE in my application. Probably there is some solution if we talk about header and when request is sent from the end-user. 回答1: Use method getRemoteAddr() from

How to integrate JAX-RS with CDI in a Servlet 3.0 container

六月ゝ 毕业季﹏ 提交于 2019-12-18 04:08:29
问题 I have a web application running on a Servlet 3.0 container (Jetty 9.0.4) using JSF 2.2 (Mojorra 2.1.3) & CDI 1.1 (Weld 2.0.3). No full-fledged application server is used. In this application I also have a JAX-RS 2.0 (Jersey 2.2) resource class serving REST requests. I have integrated JAXB binding and also JSON marshalling (Jackson 2.2). I use Maven 3.0.5 for the build management. These are the relevant parts of my project setup: Maven pom.xml: ... <dependencies> <!-- Servlet 3.0 API -->

JPA 2.0 : what is javax.validation.* package?

假如想象 提交于 2019-12-18 03:56:32
问题 What is the javax.validation package in Java EE? How to use this with JPA? I want to validate my JPA Entity with the @NotNull annotation. My JPA implementation is Hibernate. Here's my Entity: public class Employee implements Serializable , EmployeeDetail { private static final long serialVersionUID = 1L; @Id @GeneratedValue private int id; private String name; private long salary; ... 回答1: Using the Bean Validation Api you can quite easy ensure standard validation (not null, patterns, email)

GWT app - deploying on Tomcat or any other servlet container

吃可爱长大的小学妹 提交于 2019-12-18 03:49:07
问题 Is there a plugin for Eclipse GWT or any other method to automatically deploy and run GWT app on Tomcat (or any other Serlvet container)? For the moment the only method I know is copying the compiled classes into WEB-INF directory but this is an arduous work. Additionally you have to configure Apache Tomcat manually. I'd like to have something like in Eclipse Dynamic Web Project where you can run your servlets directly by spawning tomcat process. Thanks 回答1: You could write an Ant task to