java-ee

Spring security custom AuthenticationException message

試著忘記壹切 提交于 2019-12-18 13:27:54
问题 Hi i needed to add a new exception in Spring security login form, everything work perfectly except that i want to have my own error message (until now it display the "wrong login/password" one). I have override default attempt authentication method from Username password Authentication Filter : @Override public Authentication attemptAuthentication(final HttpServletRequest request, final HttpServletResponse response) { if (!myTest()) { throw new CustomAuthenticationException("custom message");

How to write an XML MessageBodyWriter provider with jersey

十年热恋 提交于 2019-12-18 13:27:45
问题 I am not trying to solve any problem in particular, but rather I am on a learning path to jersey. I have an entity class marked like this: @Entity @Table(name = "myentity") @XmlRootElement public class MyEntity implements serializable { // lots of methods... } and the corresponding jersey service @Stateless @Path("entity") public class EntityFacade { @GET @Path("{param}") @Produces({"application/xml;charset=UTF-8"}) public List<MyEntity> find(@PathParam("param") String param) { List entities

How to set a connection timeout when using JAXRPC-RI web services client?

雨燕双飞 提交于 2019-12-18 13:22:08
问题 I'm working with a bit of a legacy component in which we interact with a SOAP web service (a technology which I absolutely, positively abhor) using some client code built using the JAXRPC-RI (reference implementation) library. I'm interested in being able to set a timeout with the stubs so that in case the web services server does not reply within X seconds, the application isn't setting there forever waiting for a response. I'm using to working with clients/stubs generated by Apache Axis, in

How to implement push to client using Java EE 7 WebSockets?

 ̄綄美尐妖づ 提交于 2019-12-18 13:09:27
问题 I've browsed a lot of Web Socket examples, presentation slides and they are mostly concentrated on a rather simple scenarios in which client-server communication is initiated by the client. I am interested in another scenario, which seems to be equally practical: pure server push to client. Example I have in mind is an application that updates stocks value on a website. Imagine there is an external system stock exchange system, which is sending a JMS message for every subscribed stock value

How to enable Kerberos authentication for remote EJB call on WebSphere?

与世无争的帅哥 提交于 2019-12-18 12:57:09
问题 My application is a stand-alone Swing client invoking EJB Stateless Session beans thanks to classical JNDI lookup and RMI-IIOP method calls. It is started as a Java WebStart application. My aim is to retrieve the client user's identity from EJBContext with getCallerPrincipal method thanks to Kerberos SSO between the Windows workstation, ActiveDirectory and WebSphere server running on Linux. I have already successfully configured my WebSphere cell in network deployment mode to support Kerberos

Have an EJB schedule tasks with “crontab syntax”

被刻印的时光 ゝ 提交于 2019-12-18 12:33:19
问题 I am trying to figure out the possibilities I have to solve the following problem. a) I want to have a database table that uses "crontab syntax" to schedule tasks, the structure would be something like this: |-Id-|---Crontab Syntax---|---------Task----------| | 1 | 30 * * * * * | MyClass.TaskA(args[]) | | 2 | 0 1 * * 1-5 * | MyClass.TaskB(args[]) | | | | | The above table will be modified at any time by an external application. Tasks added or removed should instantly affect the scheduler. b)

How do I reference a file that is placed in the WEB-INF folder when using Arquillian?

早过忘川 提交于 2019-12-18 12:33:05
问题 I am using maven and the standard directory layout. So I have added a testdata.xml file in the src/test/resources folder, and I also added it as: .addAsWebInfResource("testdata.xml", "testdata.xml") in the deployment method, and I have confirmed that it is there. This will make the file appear in /WEB-INF/testdata.xml . Now I need to have a reference to this file in my code and I tried several different getClass().getResourceAsStream(...) and failing again and again so I need some advise now.

Can EJB2 and EJB3 coexists in one application?

若如初见. 提交于 2019-12-18 12:30:49
问题 does anybody know if it is possible to iteratively replace EJB2.1 beans with EJB3 beans in Java EE application? That is: at one time remove one 2.1 bean from the code and add corresponding EJB3 bean that implements the same behavior without touching the rest of the code (+ be able to inject the legacy EJBs via annotations in the new EJB3). I am not expert at EJB specs (and I have experience only with EJB3), but to me EJB is a simply component with given business interface that is managed by

How to use a property-file with GlassFish

◇◆丶佛笑我妖孽 提交于 2019-12-18 12:27:21
问题 I'm creating a web service, which run in GlassFish, and I want to have some custom properties. For this I'm using the Properties class. The code I'm using is: Properties p=new Properties(); File f=new File(System.getProperty("user.dir"), "settings.properties"); p.load(new FileInputStream(f)); But how do I get the settings.properties -file in my config directory? I'm not sure about my classpath, since this is managed by NetBeans and GlassFish. I assume my .war -file is added to the classpath,

Is there any syntax like : #{systemProperties['environment_variable_name']} to get the system variable?

Deadly 提交于 2019-12-18 12:24:01
问题 Does using #{systemProperties['environment']} in the applicationcontext.xml file of Spring return the value associated with environment? Or is there any way to ge the system variable value in the spring applicationcontext.xml file. 回答1: When I remember right, then there is a difference between: You can access the system properties in different ways: #{systemProperties['databaseName']} #{systemProperties.databaseName} ${databaseName} //$ instead of # !! With #{systemProperties['databaseName']}