java-ee-6

How to get the client IP address in a JAX-RS resource class without injecting the HttpServletRequest?

守給你的承諾、 提交于 2021-01-24 12:07:55
问题 We are using JAX-RS 1.0 and I want to get the client IP address in my resource class. Currently I inject the HttpServletRequest as a method parameter and then get the IP address. I want to make my code cleaner. I am thinking if I can use a MessageBodyReader class and set the IP address. But if I use a MessageBodyReader I have to unmarshall the XML to a Java object which is additional logic as far as I believe. Can anyone please let me know how to get the client IP address without having to

How to get the client IP address in a JAX-RS resource class without injecting the HttpServletRequest?

北城以北 提交于 2021-01-24 12:06:49
问题 We are using JAX-RS 1.0 and I want to get the client IP address in my resource class. Currently I inject the HttpServletRequest as a method parameter and then get the IP address. I want to make my code cleaner. I am thinking if I can use a MessageBodyReader class and set the IP address. But if I use a MessageBodyReader I have to unmarshall the XML to a Java object which is additional logic as far as I believe. Can anyone please let me know how to get the client IP address without having to

ASM jar - Why my java project has a dependency on this?

倖福魔咒の 提交于 2021-01-20 18:12:53
问题 I have a Java project and internally it is dependent on asm jar . Strangely, I don't even know why my project somehow is dependent on this library ( might be brought in by maven as a transitive dependency )? Can anyone help me know why some one needs asm jar ? Thanks in advance ! EDIT: Can you also mention for what purposes/use-cases one might need asm jar? 回答1: ASM is a bytecode manipulation framework (see this page for a nice introduction) and is used by many things performing... bytecode

ASM jar - Why my java project has a dependency on this?

巧了我就是萌 提交于 2021-01-20 18:12:41
问题 I have a Java project and internally it is dependent on asm jar . Strangely, I don't even know why my project somehow is dependent on this library ( might be brought in by maven as a transitive dependency )? Can anyone help me know why some one needs asm jar ? Thanks in advance ! EDIT: Can you also mention for what purposes/use-cases one might need asm jar? 回答1: ASM is a bytecode manipulation framework (see this page for a nice introduction) and is used by many things performing... bytecode

Transaction cannot proceed STATUS_MARKED_ROLLBACK when running on jboss standalone

£可爱£侵袭症+ 提交于 2020-08-24 07:24:46
问题 Does anyone experience the following issue? I'm able to successfully build, deploy and run my javaee6 application in jboss inside eclipse using jboss tools. But when we deployed it on another server running on standalone we got an error. I tried it the same machine where eclipse is and run on jboss as standalone and got the same error. See error below, I've removed some parts. 06:53:46,423 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/127.0.0.1:8080-1) Transaction cannot

Transaction cannot proceed STATUS_MARKED_ROLLBACK when running on jboss standalone

北慕城南 提交于 2020-08-24 07:24:27
问题 Does anyone experience the following issue? I'm able to successfully build, deploy and run my javaee6 application in jboss inside eclipse using jboss tools. But when we deployed it on another server running on standalone we got an error. I tried it the same machine where eclipse is and run on jboss as standalone and got the same error. See error below, I've removed some parts. 06:53:46,423 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-/127.0.0.1:8080-1) Transaction cannot

h:commandbutton, how to redirect to external site?(JSF 2) [duplicate]

家住魔仙堡 提交于 2020-02-08 08:49:40
问题 This question already has an answer here : Redirect to external URL in JSF (1 answer) Closed 4 years ago . When i use command button to redirect to pages, inside my project, u just need to give the name of the page with no extention, followed by ?faces-redirect=true in the action attribute and i will get redirected. But what if i want to get redirected to an external page(example:www.google.com)? I tried in many ways: www.google.com, google.com, http://google.com but i failed. This is what i

How to make portable AND native ID generation in JPA 2 / Hibernate?

纵然是瞬间 提交于 2020-02-03 07:52:24
问题 I would like to have native and portable id generation on my JPA 2 entities, currently running Hibernate and MySQL When using @GeneratedValue(strategy=AUTO), hibernate defaults to the "hibernate_sequence" table on MySQL, i would like IDENTITY If i solve it using @GeneratedValue(strategy=IDENTITY), i loose Oracle/Postgres portability How can i set Hibernate to use IDENTITY as default for mysql when @GeneratedValue strategy=AUTO? 回答1: You can write your own custom generator and maybe invoke a