Spring MVC: url passing variable page style not working - url

I am using spring mvc for my app. So far everything is going all. However, when I get to a page that has a variable in the url (ie, /edit/{id}), the style doesn't work on that page. In addition when I submit the form on that custom path page and try to go to another page (from the controller using the ModelAndView), the style doesn't work on that destination page which is weird cause the style works fine on that when I access it from elsewhere.
I think the reason the style is not working on the destination page is because the url still stay at the custom path with the url passing variable (localhost:8080/app/edit/5).

Late answer, but I've just experienced this myself and am having a few issues. As far as style sheets or JS files (basically any static resource) not being found after using a path variable, I was able to fix that by prefixing all of my style sheet or JS file links with ${pageContext.request.contextPath}. This ensures that the server always searches for them from WebContent, rather than from the offending path variable. I am also now having the issue of not being able to send proper requests to the other pages, but as my controllers only return Strings for the view resolver rather than ModelAndView objects, I'm not sure your solution will fit for me.

Related

TYPO3 8.7 is it possible to output a specific page with multiple url path s

I'm trying to integrate a vue.js application into a typo3 page.
I have a full functional TYPO3 instance where I can create own pages, edit the content and more. Now I want to add an existing vue.js application within this page.
Therefore I created an extension which added all necessary resources (js, css) and added an own content type which controls the integrations and configurations. The content type outputs a vue.js entry point. So far everything works. Smaller vue.js applications works as they should.
Now comes the challenge: When I want to create a more complex application which relies on the router functionality, I run into a problem.
Let's assume, I integrate my application into the page /shop and my application tries to render a product under /shop/product/some-id. This doesn't work. The URL processing is done by TYPO3 (as designed).
I tried to find a solution within the documentation but I'm not sure what I should search. I need a way to output the same page (/shop) regardless the following path. Does someone have a hint?
I found a solution. Within TYPO3 v8 is it possible to use the realurl extension for this purpose.
It is possible to define an own decode preprocessing function and analyse the current url.
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['decodeSpURL_preProc'][] = RealUrlManipulation::class . '->decodeSpURL_preProc';
Within this method is it possible to change the url for TYPO3 inner processing and set it to an known url.

Webapp in iOS opens popup when outside scope

Since Apple iOS 13.1+ all webapps without the proper manifest and/or scope directive will be left with a popup IN the webapp when changing URL's. When the manifest is OK and holds the right scope (e.g. "/") all navigates like before. The problem is when my clients want to pay on my website and they are redirected to my payment provider. This URL change (also domain change) is again opened IN this popup instead in a flow from my shop.
Does anyone know how to solve this?
After long search i found the way of loading the manifest was the problem. We added this in correct (and checked) syntax in the head segment of the HTML. However we used the JSON type inclusion. We found that when using inline link tag, using rel="manifest", we should not put the JSON within the tags but in the href attribute like so: href="data:application/manifest+json,{}"/>. The same JSON output goes between the acculade brackets and then the scope and starturl are processed by the browsers.

Does .html in the end of a URL mean that the webpage is static?

I know it's not a good question to ask, but sometimes I really need to know if a webpage or website is static or not.
Sometimes I see .html extension in many URL, Does that mean that those pages are static?
.html extension means that page contains only front-end code and does not have any server side language included in it (I'm not talking about URL rewriters that adds .html to the end of virtual path).
This does not prevent these things:
Page can load it's content via Ajax depending on inputs, URL params, time of day, etc.
Page can be generated as static HTML page, but still be re-generated from time-to-time.
You can have iFrame in static HTML page that leads to .php file.
Not really, .html does not mean webpage is static. Ajax can be used to load dynamic data in html page.
Also there is no proper method defined to find whether page is static or dynamic.
One way is, you can check requests in Developer Options of browser.
You can read more here.
No.
There is no guarantee of a direct relationship between a thing that looks like a file extension in a URL and how the server handles things behind the scenes.
It might be resolved using basic static file handling rules to a static file with that name.
It might use a tool like mod_write to map the URL onto a server side script with the same name but a different file extension (e.g. if the site used to be made of static files, but was changed to be dynamic with steps taken to keep the URLs unchanged).
It might use a tool like mod_write to map the URL onto a server side script that has no relation to the name of the file but implements the front controller pattern for the whole site.
It might map onto a server side script which looks at the end of the URL to determine what type of data to return the content in (e.g. cars.html and cards.json might both be be handled by the same script, which outputs a list of cars, but it might output it in JSON or HTML depending on the URL).
It might hit a 404 error or a 302 redirect.
It might do any number of other things.
Not always, sometimes it can be a generated page from a Servlet or a PHP script that generates them. you can have a .htaccess rule to add .html to all documents.

Sitecore gives a blank page with just the text "Default page" in my MVC solution

When I browse to my startpage, e.g. /sv I get a blank page that just says "Default Page". However when I try /sv/ it works. Subpages like /sv/example work without slash though. I'm using Sitecore 7.1 with only MVC views.
Remove the default.aspx file from the web root.
That will fix your problem.
When requesting URLs without a slash at the end, the "StripLanguage" processor of the preprocessRequest pipeline rewrites path to the value of the Settings.DefaultPageName setting ("default.aspx" by default). Since such page physically exists on your site, ASP.NET MVC routing system does not handle such request, and the file itself is served. This behavior is controlled over the RouteCollection.RouteExistingFiles property (false by default), please refer to the following article for the details:
http://msdn.microsoft.com/en-us/library/system.web.routing.routecollection.routeexistingfiles.aspx.
In other case, when a slash is added after a language, this won't happen, since the "StripLanguage" processor does not rewrite the path (which is also not an expected behavior). As a result, request URL does not match the "default.aspx" static file in the site and request is getting processed by ASP.NET MVC.
I suggest you to add the following setting to the "Web.config" file (instead of creating a "default.aspx" page), which points to the "default" page without extension:
<settings>
<setting name="DefaultAspxPageName" value="default"/>
</settings>
After that, the /default URL, without ".aspx" extension, will be processed by MVC and the appropriate item will be rendered independently of a slash after the language URL section.
On my side it works.
I want to point out that the answer to this is not my own but given from the support over at Sitecore who I want to extend a big "Thank you!" to. I had googled this forever until they helped me and I thought that I want to have this document and easily found when others struggle with it. A bug is filed and they are working on fixing it.
DefaultAspxPageName is Hidden Setting.. We can find more such hidden settings..#
http://www.newguid.net/sitecore/2014/sitecore-hidden-string-configuration-settings/

magento custom url rewrites to .html for cms pages

I am moving an ecommerce site into magento and would like to preserve as many indexed links as possible. For example: the about page's url is domain.com/about.html. Magento writes the url as domain.com/about. If I add a custom rewrite and force the .html to be re-written to the end I get a 404 page not found error.
Is what I am trying to do possible? I have also tried re-indexing the store and that did not help.
If you can make a small module, you can use the cms_controller_router_match_before event, dispatched in the Mage_Cms_Controller_Router class, to handle the .html suffix in the URL keys of the CMS pages (by removing it when it is present in the identifier passed in the condition object).
Otherwise, you can get almost the same result by adding .html at the end of the URL keys.

Resources