java-ee

Session Tracking using J2EE

余生颓废 提交于 2019-12-13 07:19:55
问题 I'm trying to implement session tracking on my website. Basically I want the users to be able to login in my website using their username and their password, pass throw my website pages (only available for logged users) and then logout. Currently I'm thinking about what is the right architecture to accomplish this. So, is it right to do it like this: use a servlet which validates whether the user is logged or not or if this one is doing a login using a httpSession object (kinda like this

Wildfly, JAAS and SecurityContext

落花浮王杯 提交于 2019-12-13 07:17:18
问题 I'm still playin with Wildfly-9.0.1.Final and JAAS (see my previous question Wildfly and JAAS login module) in a web application that use a BASIC auth-method . While my custom login module works I got some problems about authorization. I use a RESTeasy RESTFul web service with annotation to test, here is the code: package it.bytebear.web.mongo; import it.bytebear.web.mongo.jaas.MongoModuleCallbackHandler; import it.bytebear.web.mongo.model.User; import java.security.Principal; import java

Getting a null value for where i expect a string set by the mutator

♀尐吖头ヾ 提交于 2019-12-13 07:17:01
问题 Following is the servlet class that sets the name by invoking a method on the object of a bean class and then forwards to a jsp page . package BeanTesters; import javax.servlet.*; import javax.servlet.http.*; import java.io.IOException; public class Controller extends HttpServlet { @Override public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException { Bean bean = new Bean(); bean.setName("Suhail Gupta"); //request.setAttribute("name", bean);

How to code in java to run unix shell script which use rSync internally in windows environment using cygwin?

微笑、不失礼 提交于 2019-12-13 07:16:08
问题 I am using cygwin to get unix environment on windows. I have some shell script that run on cygwin to perform syncing works and other things. I want to executes these script through java code. Also during executing of scripts on cygwin , certain information is displayed on terminal by using simple echo command.. I want to show all that information in my application. How can I do this?? 回答1: Use the Runtime class to run Cygwin. This is very brittle, and dependent upon your setup, but on my

Java EE Module Dependencies page in Eclipse missing projects

本秂侑毒 提交于 2019-12-13 06:52:04
问题 We're developing a web application using Tomcat and a number of other libraries, and we're having issues using the "Java EE Module Dependencies" page in Eclipse to assign dependencies to be placed in the lib/ directory of the webapp. (See screenshot) The issue we're having is that while most of our projects show up as available dependencies, a few are missing. We've done our research, and on some machines all of our projects appear properly, but not on others. Is there any rhyme or reason to

How to run Different commands from Java Code?

我的未来我决定 提交于 2019-12-13 06:41:26
问题 I want to run different commands which can be executed on my command prompt or terminal through Java. I did search few place but did not get appropriate reply. I want to run a compiler which is set in the environment as VISAGE_HOME as well as run GRADLE so as to do all my build tasks. I want to invoke all these commands from within Java Program. Since it is a swing application I would like to invoke these commands on click of button or some other events. My Problem is that I am not able to

How to get database connection through websphere ORB call?

妖精的绣舞 提交于 2019-12-13 06:40:57
问题 i've got a websphere 6.1 cluster environment which is composed of two nodes with 2 appservers each. Let's call NodeA including Server1(2809) & Server2(2810) , NodeB including Server3(2811) & Server4(2812) . Meanwhile, i created a cluster-scope datasource with JNDI local_db . Right now i want to get database connection in a java client through WAS ORB call from above environment. The specific part of java code would look like this: Hashtable env = new Hashtable(); env.put(Context.INITIAL

How perform Junit tests with Struts - Ibatis

南笙酒味 提交于 2019-12-13 06:32:02
问题 im using Struts 1.2.x and Ibatis 2.x version for development, so i finish yesterday and now i want to perform test this is my first time trying to work with JUnit, I already make test but in JavaApp not running on server, so how can I simulate or generate mocks with server behavior, and wich mocks are recommended for Struts and Ibatis built-in Environment? for example how can i set accerts for login screen? I know about StrutsTestCase im using it, and about Cactus are for containers and

integration test with openejb container and hibernate fails

旧时模样 提交于 2019-12-13 06:26:29
问题 I'm trying to write integration tests for my java ee 6 application. This works with open jpa and also with eclipselink. But is doesn't work with hibernate. I've created a minimal project on github to debug the problem here: https://github.com/Crydust/guestbooktwo These work D:\Projects\guestbooktwo>mvn clean verify -P openjpa D:\Projects\guestbooktwo>mvn clean verify -P eclipselink These don't work D:\Projects\guestbooktwo>mvn clean verify -P hibernate-a D:\Projects\guestbooktwo>mvn clean

Frequently getting exceptions in java while downloading files from third party download managers in struts2-tiles2 framework

江枫思渺然 提交于 2019-12-13 05:59:43
问题 In logs, i have found that i am getting following exception in stacktrace of tomcat logs & log4j file : org.apache.tiles.impl.BasicTilesContainer - Error rendering tile org.apache.tiles.util.TilesIOException: ServletException including path '/WEB-INF/jsp/layout.jsp'. at org.apache.tiles.servlet.context.ServletTilesRequestContext.wrapServletException(ServletTilesRequestContext.java:298) at org.apache.tiles.servlet.context.ServletTilesRequestContext.include(ServletTilesRequestContext.java:219)