Masking the URL in Spring MVC - html

In our project we were using Frames.Now we upgraded to HTML 5 where frames are deprecated.
Also we are using SPRING MVC. Earlier because of Frame user was not able to see the total URL, also when user copy link to the other tab/browser, he was redirected to the login page. But now, by using Spring MVC which is more a URL based request mapping framework and by using HTML 5, we are unable to achieve the functionality.
Is there any way to redirect it back to Lo-gin page, if user types in any URL in another tab/browser.
Is there any to mask the URL such that user will able to see only the host and port.
Help is deeply appreciated.

If you convert all your web action to AJAX, url won't show up on browser bar. However they could still snoop with simple javascript debugger tool.

Related

How to map JSON object returned from REST controller to html page

I need to know how data returned from the Spring MVC REST controller attaches to html page and what the Spring configuration do we have to do this.
The browser just prints this data out without view and that's all.
I have some Spring configurations to do it but unfortunatelly it doesn't work.
First, you have to create a spring web-mvc application with a correct configuration that will run without errors. There are plenty of tutorials on how to do it. After that, if you wish to get json data using your rest controllers, the most popular way to do it is by using javascript and the JQuery library. Using them you can make ajax calls to your api. There are plenty of tutorials on how to achive this again. Finnaly, your data will be on the client side and you can manage them (render them in your html-dom etc) using javascript and JQuery again.

Backbone pushState is returning raw JSON data

I am attempting to implement pushstate for my Backbone/NodeJS application. If I go to the following route /testRoute/123 within the browser itself, from another view, the associated views to /testRoute/123 load.
However, if I manually enter /testRoute/123 in the address bar, the browser returns a raw JSON feed for the object with id '123'.
How do I force Backbone to load the views when manually entering a URL?
This is not something Backbone can do (hense why pushState is disabled by default). You have to setup your server to redirect those requests to the root so that your HTML loads and Backbone can handle the route.
This is stated in the Backbone documentation:
Note that using real URLs requires your web server to be able to correctly render those pages, so back-end changes are required as well. For example, if you have a route of /documents/100, your web server must be able to serve that page, if the browser visits that URL directly. For full search-engine crawlability, it's best to have the server generate the complete HTML for the page ... but if it's a web application, just rendering the same content you would have for the root URL, and filling in the rest with Backbone Views and JavaScript works fine.
In case #idbehold's answer wasn't specific enough, here's a more detailed response to the same question.
I highly recommend looking at those links at the bottom of the response as they were exactly what I was looking for when faced with the same bother...

Turned Based Game with Servlet

I want to make a turn based game (Something like Checkers) with the help of Servlets and jsp pages.I created a page that has a newGame button that redircet to the gamePage(It redirect the first into a Black.jsp and the other request will be redirected to Red.jsp).
My problem is ,how could I refresh the other jsp automaticaly if one of them changed.
Note:After the change in one of the jsp it redirect the request to servlet and servlet update the changed jsp graphics.but the other jsp stay inactive.I want to make it active.
Thank You
It sounds like what you need is Comet. Here's an overview of how it works.
http://www.ibm.com/developerworks/web/library/wa-cometjava/
Basically, the "other" user's browser will send a request to a servlet to get an update, but that request won't receive receive its response until the current player makes a move. This gets around the problem posed by the fact that, with traditional HTTP, the browser always has to be the one sending the request to the server, it can't be the other way around.
There are some variations on the technique. Now that you know the name, I'm sure you'll be able to find lots of useful information about it.
There's another technology called WebSocket which can also serve this purpose, but it requires additional capability built into the browser and, as of now, probably not all of your users will be using compatible browsers.

Is there a way to host Razor pages in console application using ServiceTask?

I'm trying to make a console application to expose JSON services.
In addition I'd like to host html and js pages to use them.
I put the *.md (even *.htm) files into Views folder, but I can't reach them.
If I add a route ".Add("/Test")" (where MyMarkdownView : MarkdownViewBase), i even get a "KeyNotFoundException The given key was not present in the dictionary." exception.
Is it generally possible, or I should make my own service (similar to https://github.com/jimschubert/blogs/blob/master/2012-07-15/RazorExample/Main.cs) to host them?
You might be interested in the Razor Rockstars Console Application that uses embedded resource MVC Razor views that work with (or without) existing ServiceStack web services.
i.e. the example project shows the 3 different ways to host MVC Razor pages in ServiceStack:
Service/Controller and Model - Using the Response DTO from the Web Service as a view model
No Service/Controller - Directly using the Request DTO as the view model
No Service/Controller or Model - Directly by using a dynamic view model

Flex navigateToURL method not working

I used navigateToURL method to navigate to aspx web page. I used url request as Post method but when i check this in the webpage the http method turned to Get method. Any one please help. I loaded the Flex page into the windows application
This is most likely due to a security restruction. If you are executing navigateToURL from an AIR app, the POST will be treated as a GET. Please see the security notes at http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/package.html#navigateToURL()
Make sure your URLRequest object has URLVariables attached to it (even if the the variables are empty). If you have no data then the player will convert the POST to GET. This is normal, expected behavior.
http://mate.asfusion.com/forums/topic.php?id=70