Win a copy of Head First Android this week in the Android forum!

Jerry Renn

Greenhorn
+ Follow
since Nov 05, 2013
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
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 Jerry Renn

I was afraid someone was gonna say that as I couldn't find anything in the documentation to address this...could this be handled by apache - anything to /api/logout gets redirected - something like a proxyPass?
8 years ago
Getting close - So if I navigate directly to the Servlet it works, but when I use the static web pages, I'm running in to a context issue.

going directly to the servlet, I see the following in the logs:

"POST myApp/api/login HTTP/1.1" 500 409

The 500 is expected as I'm not actually posting any of the expected data

When I do it through the HTML/AngularJS app, here is what I see in the logs:

"POST /api/login HTTP/1.1"

So it's not posting to the context. I can't change the JS files to add in the context and I can't deploy it to ROOT as there's already something there.

thanks for looking!
8 years ago
Thanks - I had finally found the documentation that I couldn't find the hour searching prior to posting that said the same things: https://developers.google.com/appengine/docs/java/gettingstarted/staticfiles

I was gonna delete the previous post so as not to look too amateurish and then you graciously responded!! ;-)

Edit: it is coming up now!
8 years ago
So the (embedded software) architect didn't want me using Spring or any "complicated to learn" frameworks, so I talked him in to letting me use tomcat 7 and servlet 3.0.

Anyways, I've created a few servlets to simulate the backend and using annotations, it hits the servlets just fine, but my question is using the static content I already have. My web.xml has only one real entry:



but when I hit the tomcat server: localhost:8080/myApp it gives a 404 in logs:

"GET /myApp/ HTTP/1.1" 404 963

index.html is located here in the myApp.war (which is deployed to tomcat7/webapps):

myApp.war/WEB-INF/index.html


How I'm looking to handle things is the static pages will work the same as they do, so they html/js will decide where to go as they already contain all of that logic and when the angular JS POST's/GET's it will be handled by the servlet's
8 years ago
Thanks guys, I was hacking around on it last night and have something rudimentary working. I was gonna get good foundation laid today.

In the end, I went with Spring 3.0 because I could use annotations to map the URL's to the servlets as the current HTML/JS interface POST's to approximately 45 different URL's - I figured it would be easier to do this programatically versus XML.

I wanted to go just with servlet 3.0 but I have to stay with tomcat 6 and most of my experience with J2EE has been with struts and Spring and as this is another fire that has to be put out, I decided against what I wanted to do - take a little time and experiment!
8 years ago

Bear Bibeault wrote:If you already have the HTML and Angular front end, you already have the interface. I'd say from your description that you just need to create a faux backend that exposes the same API as the "real" backend, and "point" the front-end to access your new API.

Servlets should be fine, you just need to do a lot of mapping to route the URLs to the correct servlets.

It'd likely be easier to use a framework such as SpringMVC or Play! than using raw servlets. But your call.



This type of response is just what I was looking for. The final summation was a bit poor - I do already have the user-interface (the HTML/JS) and I have most of the back-end simulator (written in pure-java), I just need the plumbing - the code that maps the requests that the Angular calls will make to the simulator (pure-java).

So I have one quick question as it's been a year or so since I had to do the mapping - for the Servlets, wouldn't I just place the servlet that was needed in the war's directory path? for example, if the Angular POST's to /api/wireless/a/b,I would put the servlet for this in /api/wireless/a/b?

thanks
-Jerry
8 years ago
Since my company couldn't hire anyone else that has experience in J2EE, I was tasked with the job of creating a simulator for a current "app" we have on an embedded device. This config app is pure html/Angular JS. All submits on the pages POST/GET (with the possible PUT/DELETE) to /api (some to /api/x/y, etc).

So overall it's fairly simple right now - on the board, it's only ever single use - they login and then can make updates to the board configuration; but I have to create a simulator that will allow upwards of 150 (or more) customer service reps to simulate the steps they're telling the customers to do - so I'll have the app start with a default configuration every time they log in and track the changes - probably in session as they don't want me using a DB.

As I have to set aside what I'm doing today as this is now the next hot thing, I wanted to just verify a few assumptions before I go to far and then realize that I should have taken a different route - my thought is just using something like Servlets 2.5 as that shouldn't be a problem handling the POST's/etc and managing the session. I was thinking of using Spring, not MVC or webflow, but it would probably be overkill just to use a few features...

I've started several projects from scratch that were much more complicated than this, but I struggle a little with this as I can't make changes to the html/JS that is already there - I just have to provide the interface (my question) and the back-end (this is mostly done as my other current project needed a simulator before the board became available to all of the devs).

Is Servlet 2.5 sufficient? Anything else I should consider?

thanks
-Jerry
8 years ago