java-ee

Vaadin - How to open BrowserWindowOpener from a SINGLE BUTTON

谁都会走 提交于 2019-12-23 02:22:11
问题 In the Vaadin example of how to print a dynamically generated PDF they have a two step approach, first you click on the OkButton and then the PrintButton . The problem is that their code to open the PDF relies on creating a new BrowserWindowOpener which then extends the Print button in the ClickListener for the OKButton . In other words they have: okButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { // Dynamically generate PDF - this is greatly

Vaadin - How to open BrowserWindowOpener from a SINGLE BUTTON

不问归期 提交于 2019-12-23 02:22:05
问题 In the Vaadin example of how to print a dynamically generated PDF they have a two step approach, first you click on the OkButton and then the PrintButton . The problem is that their code to open the PDF relies on creating a new BrowserWindowOpener which then extends the Print button in the ClickListener for the OKButton . In other words they have: okButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { // Dynamically generate PDF - this is greatly

Remove duplicated elements in array by using Set in my case

守給你的承諾、 提交于 2019-12-23 01:59:11
问题 I have a Array of object, since I am using a 3rd party library, the array is got by calling one method from the library, I am not able to access the MyObject class . //I have no access to MyObject class, I am sure the objects contain duplicated elements. MyObject[] objects = SOME_LIB_CLASS.getObjects(); System.out.println("length is "+ objects.length); //length is 6 I try to remove duplicated elements in objects, I use Set : Set<MyObject> objectSet = new HashSet<MyObject>(Arrays.asList

Drop-wizard request response logging

懵懂的女人 提交于 2019-12-23 01:57:39
问题 I want to log each request and response in dropwizard into different files. For example I want all the requests to be logged in /var/log/applicationname-request.log and all responses into /var/log/applicationname-response.log Is there any way in which we can achieve the same? 回答1: Unfortunately DropWizard currently doesn't support this natively. See this lively discussion for more information. Fortunately there's a workaround if you're willing to forego configuring logging with DropWizard all

refresh property placeholder mechanism at Spring

 ̄綄美尐妖づ 提交于 2019-12-23 01:54:39
问题 I have a Spring context xml file and a specific bean into it that created by a PropertyPlaceholderConfigurer mechanism. My problem is: When the application is working related properties file changes and I don't want restart application. I want reload related bean without restart application. What is best solution for my goal? 回答1: you can have a look at ReloadablePropertiesAnnotation on github https://github.com/jamesemorgan/ReloadablePropertiesAnnotation this should just work by annotating

Can't get Remote EJB to work with EJB Client API on Wildfly

旧城冷巷雨未停 提交于 2019-12-23 01:36:22
问题 I'm currently struggling with getting remote EJB invocation to work on wildfly (8.x and 9.x). In detail it's about remote invocation from a standalone client application (not from another app server) using the EJB Client API approach. The remote naming approach works for me but isn't applicable in my scenario because I need to use client-side interceptors for passing context data to a server-side interceptor for the remote invocations. But for now I try to get remote invocations with the

how can I invoke a webservice from another webservice

醉酒当歌 提交于 2019-12-23 01:31:34
问题 I have two webservices A and B. A needs to invoke one of the webMethods in B. How can I achieve this? I am using maven's wsimport plugin to build A. This is to generate the necessary stubs for B and include them as part of the Webservice A. However, when I try to Invoke the webmethod o f B, I get an Exception. Can anyone please tell me what is going on? Below Is the code and the exception trace: Code: BBeanService bbs = new BBeanService(); BBean bb = bbs.getBBeanPort(); bb.invokeWebService();

How to mix inheritance type in JPA

这一生的挚爱 提交于 2019-12-23 01:11:38
问题 How to mix single table type inheritance with join table type in the same inheritance tree? I'm not using hibernate just JPA. I know there is no official support for mixed inheritance by reading the JPA spec. I can't change the architecture. It did worked with hibernate but now I need to implement this using openjpa. I'm looking for some workaround. 回答1: this is working for me: Superclass: @Entity @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "TYPE

what are the different ways of creating beanfactory object?

青春壹個敷衍的年華 提交于 2019-12-22 18:46:31
问题 1. BeanFactory fac=new ClassPathXmlApplicationContext("Spring-Config.xml"); 2. Resource res=new Classpathresource("Spring-Config.xml"); BeanFactory fac=new XmlBeanFactory(res); (I found 2nd type only i can specify a parent Configration file for using 3. ApplicationContext context = new ClassPathXmlApplicationContext("Spring-Config.xml"); I have 3 ways of loading beanfactory and I want know what is the difference between them. How can I define the parent configuration file in all those methods

Security access audit

放肆的年华 提交于 2019-12-22 18:45:11
问题 I have the following spring security configuration: <security:http> ...... <security:intercept-url pattern="/auth/**" access="ROLE_ADMIN"/> ......... </security:http> I would like to log every case when "ROLE_ADMIN" user hits any of "/auth/**" URL pattern. Can I put some kind of interceptor on this pattern? 回答1: I had to do the same thing. Use an @Aspect which fires for every execution of a handler method in your /auth/ controller. Annotate the class as a @Component so its a Spring bean, add