ajax-content not displayed in soapUI using REST - ajax

I'm not entirely sure I am asking the question correctly but here goes.
I am trying to view customer data via the REST service. I've gotten the login and and can view the servlet(Response as HTML), atleast i thought it was the servlet, i just realized its just the path to the servlet/start.
I think what I am seeing is just the hardcoded HTML messages that get viewed depending on customer data. Viewing as JSON doesn't work either i get "The content you are trying to view cannot be viewed as JSON"
I'm sorry I don't know enough to ask this properly

Well, it was a n00b mistake. I didnt call the action prior to loading the page so there was no data to ever load.

Related

handling a controller in spring

I'm working on a web application but it seems have a problem but I can't figure it out whats wrong, and yes there are so many questions asked about this but none of them haved helped me..
I'm using ajax to get some information then I'm trying to pass it to a controller, here is my problem: It seems never get to the controller but I'm not sure what's the problem, also when I try to use the tag's mvc annotation driven it shows me an error, the ajax looks fine. I'm quite sure my problem is the controller or the way I'm calling it or passing the data.
I'll attach some images to show the error it shows up and the files I'm using.

CakePHP Completely Random 403 AJAX Errors

I using CakePHP with Backbone.JS, I set up a controller just to give me a JSON output for getting my data, e.g. client names etc, to pass into each Backbone model.
This was all working, or appeared to be, however, it seems that it now gives me some random 403 errors when the page / from is saved or reloaded. But I have no idea why? If it can access it to start with, and does, then why would it not have access after a save or reload?
I have tried, $this->Auth->allow and it dose appear to fix the problem but this data is or could be important and need it not to be access my everybody who might guest at my access path.
Now I have read a number of articles on her, most point to read/write access on the files your accessing, but in my case its just a path /XXXX/XXXXX/myjson/clients For example.
Now I can post my code, if needed, but I am not sure what the problem is, is this a CakePHP issue or is Backbone not requesting the data right?
Please be aware that I am dyslexic, please be kind about my question, if I have not explained myself right. Then please be me some time to re-word / edit my post.
Thanks,
For any one else looking at this, I had added autoRegenerate to the Configure Write Session. For some reason it looks like CakePHP was taking to long to regenerate a new cookie and request my information at the same time.

How can I make my AngularJS Wordpress AJAX blog searchable and SEO-friendly?

I'm working on a Wordpress site which displays posts through a JSON api and AngularJS. I render all post thumbnails on a page and when one is clicked the post is rendered in an overlay on the same page. The post url becomes something like mysite.com/#!/post-name.
Here's the development page http://givakt.kund.griffel.se/blogg-jobb/
Since everything is fetched by AJAX calls none of this info is available to search engines. I have tried to figure out a good approach to make it indexable but it's all very new ground to me.
Would it be possible to get content from or redirect the search engine to a php-rendered (wordpress) page, say like mysite.com/post-name, while thinking it's getting the correct content at mysite.com/#!/post-name. Is it even allowed or even frowned upon? The actual content would of course be as identical as possible at both sources.
Not sure if this is legit approach however, or if it could even work. Is there any other easier or preferred approach that I'm missing?
BTW, I have read http://www.yearofmoo.com/2012/11/angularjs-and-seo.html and how to use PhantomJS and so on to provide indexable pages. So what I'm basically asking is if there's a way to utilize wordpress pages to serve the content instead.
I'm not exactly sure how to do it in terms of technicalities, but Google is usually not happy if you show one version of the page to search engines and something else to actually visitors. It's called cloaking. Just keep it in mind.

Spring web mvc 3.0 Form data and image upload issue

I am new to spring and JSP. My web application is spring powered, which I run locally in apache tomcat.
In my JSP page I have multiple file-upload inputs and many text input fields.
Every time, when I press any of the upload buttons, a HTTP POST request goes to my controller from where on I may save the image to the database.
But, what I want is:
I will upload the images one by one ( preferably by staying in the page) but won't save them in database and then when I press submit to get the rest of the input text fields data, I commit all the data, including image, texts to the database in one try.
I have heard of scope="session" for my controller(bean) in the dispatcher-servlet.xml ... but I am unsure as to if I upload image to my controller and get back to my JSP form, will the bean keep my already uploaded images?
I think it is hard for me to explain, so please let me know if my question is not clear.
It would be nice if anybody can come up with a suggestion that may help to obtain my goal.
Are you uploading a varying number of images, as in if someone wants to upload only 2 they'll have 2 file fields on the form, or does everyone get 5 fields for example?
To be honest, the whole scheme of incremental upload sounds a bit overcomplicated at this stage. (Unless you have an explicit need to show progress bars on each upload, etc.) What if the user abandons the form after uploading the first image? You'd need a pretty solid mechanism to keep track of the entire visit, keeping it in the session wouldn't help here. Can a user pick up where they left off? If you make the whole thing work with single form submit click first, you can break it out and fine tune the process later. I mention that since you stated you're new to jsp and Spring (what's your experience with web dev otherwise?)
I think the best way is to upload file using ajax control rather than submitting form for each upload and store the file references in session scope variable(attribute). there are lot of libraries have ajax based file uploading like extJS, JQuery, GWT, DWR , whatever ajax library you are using in your web application.

specific limitations of AJAX?

I'm still pretty new to AJAX and javascript, but I'm getting there slowly.
I have a web-based application that relies heavily on mySQL and there are individual user accounts that are accessed and the UI is populated with user specific data.
I'm working on getting rid of a tabbed navigation bar that currently loads new pages because all that changes from page to page is information within one box.
The thing is that box needs to reload info from the database, etc.
I have had great help from users here showing that I need to call the database within the php page that ajax is calling.
OK-so pardon the lengthy intro-what I'm wondering is are there any specific limitations to what ajax can call that I need to know about? IE: someone mentioned that it's best not to call script files and that I should remove scripts from the php page that is being called and keep those in the 'parent' page. Any other things like this I need to keep in mind?
To clarify: I'm not looking to discuss the merits/drawbacks of the technology. I'm wondering about specific coding implementation that I need to be aware of (for example-I didn't until yesterday realize that if even if I had established a mySQL connection on the page, that I would need to re establish that connection in my called page as well...makes perfect sense now).
XMLHttpRequest which powers ajax has a number of limitations. I recommend brushing up on the same origin policy. This is a pivotal rule because it limits where AJAX calls can be made.
First, you can't have Javascript embedded in the HTTP response to an AJAX call. That's a security issue.
No mention of the dynamics of the database, but if the data to be displayed in tabs doesn't have to be real-time, why not cache it server-side?
I find that like any other protocol, Ajax works best in tightly controlled conditions. It wouldn't make much sense for updating nearly the whole page, unless you find that the user experience is improved with an on-page 'loader'. Without going into workarounds, disadvantages will include losing the browser back button / history, issues such as the one your friend mentioned, and also embedded resources and other rich content can suffer as well, and just having an extra layer of complexity to deal with in your app. Don't treat it as magic sauce for your app - make sure every use delivers specific results that benefit your client / audience.
IMHO, it's best to put your client side javascript in a separate page and then import it - neater container. one thing I've faced before is how to call xml back which contains code to run such as more javascript - it's worth checking if this is likely earlier on and avoiding, than having to look at evals.
Mildly interesting.

Resources