Pojahn Moradi

Greenhorn
+ Follow
since Apr 26, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pojahn Moradi

Hi!! Sorry for disappearing. The page have to be very simple, thus no login function. You pass username and password along with your entity(which is a string).
I added a locking mechanism, where each request locks the username. So the overhead will be minimal. Grabbing a lock is very trivial.
8 years ago
For my project, a unique user can register an entity(unimportant) which a he or she owns. Here is the flow of the backend code:

1. Checks if user name exist. If not, jump to stage 3.
2. Compare if the supplied user name & password match with the data stored in the database.
3. Create the user if not exist.

If everything was single threaded, this would work fine. But since it's not, this wont. A thread for example can pass step 1, and before it has a chance to save an other thread passes that stage as well. Result: a duplicate entry!

Now to my questions:
- Since the chance of duplicate entry is utterly tiny, do I really need to handle this?
- If so, what is the best strategy? The current implementation is a locking mechanism, where you lock a user name during the steps above. This means other threads wanting to operate on the same username will block until a lock can be grabbed.
The blocking technique is however unpleasant due to the performance penalty. Are there better ways?
8 years ago
Using Tomcat 7. For my Jersey servlets(resources) to be initialized, I had to include the dependency org.glassfish.jersey.bundles:jaxrs-ri, which worked great. The runtime now recognize my Application class annotated with ApplicationPath.
Using jaxrs-ri gave birth to a new problem though; DefaultServlet no longer works. For example, navigating to a url in a browser, say localhost:9090/project/page.html will not work with this dependency present.

Did some googling but was unable to find anything useful.
8 years ago
Thanks Stefan Evans. That solved the issue. Suppose I should copy and modify the original web.xml if I want to expand it?
8 years ago
Are you referring to target/tomcat/webapps? That one seems empty. There is target/tomcat/work/Tomcat/localhost/clicky, but that one is empty as well.
I can post the file structure of click.counter-1.0-SNAPSHOT.war when I get home from work.
8 years ago
I am trying to open index.html. Looking at the project file structure, we can se there is one index.html directly under WebContent and one in WEB-INF. They are duplicated for testing purposes.

I use the following URL: localhost:9090/clicky/index.html
Tried to alter the url in may ways with no luck.

When the server started, tomcat prints that the server has been deployed to localhost:9090/clicky.
8 years ago
Well I get a 404 page generated by Tomcat, explaining that the page was not fond.
8 years ago
I am using Maven Tomcat Plugin to deploy and run a Tomcat server.

While accessing a servlet works fine, accessing web pages isn't. I am having trouble resolving this and need some help.

Here is the file structure of the project:
http://pastebin.com/2hHJ8u4y

Example of a servlet. Can be accessed with url localhost:9090/clicky/servlet

pom.xml

Web.xml, which I will probably be omitted:
8 years ago
You are right. It makes more sense now. Sill clueless on how to resolve this issue.
10 years ago
JSP


When I click on the submit button, the specified item shoud be added to the item-list/cart. However, I am not getting the result I am expecting.
What is happening is that when the page have loaded, the "onclick" function have executed on all the items in the loop.

How do I resolve this?
What options do I have besides "onclick", which seems buggy?
10 years ago
JSP