Spring Boot Application not changing - ajax

I've done a project before. (https://github.com/sercandorman/CRUD-Operations-With-Spring) Now I wanted to go through it. When I add a html file into resources/templates, I can see the page. And in that page I'm trying to get data from mysql database. Meanwhile I tried to use same ajax/get method but faced 404 no messages found error. And I'm sure that Im using right RequestMapping and Thymeleaf iterations. Already I've used before so I did same things but just from different table. I could not understand 'why'!? ...
Then I've tried changing the RequestMapping method(findAll) that was working before. AND NOTHING CHANGED. Method still running as old way ! I'm trying to broke it, but no, nothing happens. How it can be possible ?!
Note : I've tried to open project Spring Tool Suite and Netbeans. After facing tousands of error, successfuly opened project with STS but look at it. I can not change its original form.
Is this about war/jar files ?! What should I do ?
findAll method (Working)
#RequestMapping(value = "/findAll", method = RequestMethod.GET)
public void findAll() {
mavIndex.addObject("allRecords", personService.findAll());
mavIndex.addObject("mod", "VIEW_RECORDS");
}
with this ;
<div class="row" id="getResultDiv" th:switch="${mod}">
...
<div th:case="VIEW_RECORDS">
...
<tbody>
<tr th:each="result : ${allRecords}">
<td th:text="${result.id}" id="tid"></td>
<td th:text="${result.name}" id="tname"></td>
<td th:text="${result.surname}" id="tsurname"></td>
</tr>
</tbody>
</div>
</div>
But when I do that;
#RequestMapping(value = "/lists", method = RequestMethod.GET)
public void findAllLists() {
mavIndex2.addObject("allLists", listsService.findAllLists());
mavIndex2.addObject("mod2", "VIEW_LISTS");
}
with this ;
...
<tbody>
<tr th:each="res : ${allLists}">
<td th:text="${res.listname}"></td>
</tr>
</tbody>
Also I'm sure that Services and Repositories are same.
As I mentioned above, when I change /findAll method nothing changing and my /lists method not working.
What must I do ?

I'm neither a Netbeans nor an STS expert but to rule out any problems which come from your IDEs you could try the following:
A complete rebuild and start of your project, so that any changes in Java or resource files have a chance to be reflected in your next server start:
mvn clean spring-boot:run
Please make sure that you stop all running servers you started earlier.

Related

kendo ui grid, cannoet get sortable to work. getting error 'sortable': object is null or undefined

I have downloaded the Telerik Kendo UI Web (GPL edition) control library.
i wrote a simple static page with an html table ,
included jquery 1.9.1, kendo.web.js scripts (and the css files), then called:
$('#grid').kendoGrid({
sortable: true
});
in the doc ready function.
i`m getting a JavaScript error on the page, saying "Property 'sortable': object is null or undefined".
i can see in IE dev tools that the scripts are there.
tried to link all the individual scripts instead of the kendo.web.js bundle but just getting another error message : "kendo_module is undefined"
googled around, but no luck.
EDIT: saw this question, but it`s not the case
any help will be appreciated
If your table has the expected format works fine.
Try the following HTML:
<table id="grid">
<thead>
<th>Name</th>
</thead>
<tbody>
<tr><td>Fred</td></tr>
<tr><td>Ted</td></tr>
<tr><td>Ed</td></tr>
</tbody>
</table>
and the JavaScript:
$("#grid").kendoGrid({
sortable: true
});
Or click here : http://jsbin.com/AmECatE/1/edit (tested with IE 9)

FineUploader 3.6.0 object File is not a File or INPUT element Ignoring

I am trying to integrate fine uploader into my hybrid mobile app (using Icenium). I have all the files needed and the uploader runs perfectly when I'm running the app in the simulator. When I run my app on my iphone I get the [FineUploader 3.6.0] [object File] is not a File or INPUT element! Ignoring!. I can't for the life of me figure out why I would be getting this.
This is my config...
$(document).ready(function() {
$('#fineUploader').fineUploader({
request: {
endpoint: 'uploadurl'
}
});
});
I have navigated to the demo page for the jquery wrapper which uses the previous config and the demo runs fine. Any ideas? I'm not sure how to debug this any further.
Thanks
EDIT:
View -
<div data-role="view" id="queue-view" data-title="Queue" data-show="app.queueView.show" data-transition="slide:left" style="display: none;">
<header data-role="header">
<div data-role="navbar">
<a data-align="left" data-icon="menuicon" data-role="button" data-click="app.applicationLayout.onMenuClick"></a>
<span data-role="view-title"></span>
</div>
</header>
<button id="filesButton">Add Files</button>
<div id="fineUploader" class="upload-cont">
</div>
<div id="fineUploader2" class="upload-cont">
</div>
<input id="cameraButton" type="file" name="camera" accept="image/*;capture=camera">
</div>
ViewModel (app.queueView.show) -
$('#fineUploader').fineUploader({
request: {
endpoint: 'uploadurl'
}
});
I have also tried the direct from camera code which simply gives me undefined errors. That's why there is an extra fineUPloader2 and the cameraButton. I have tried a lot of things and all seem to result in either undefined errors or the No files error.
I'm also using require.js to bring in my javascript files (which I have many since I have set my project up using MVVM).
Thanks
Your issue was caused by a bug in Fine Uploader that appeared only when File objects are created in a frame/window/context other than the frame/window/context where the uploader instance was created. There are a couple issues filed here. Yours, (#870) and another, similar issue (#866). The issue was caused by the use of instanceof to determine if an object was a File. Both cited issues have been fixed in the associated hotfix branch in the Github project. I plan on pushing out a 3.6.1 hotfix release with these fixes in the next 24 hours or so.

Wicket Modal Windows empty if behind Proxy

Hi all you genius people!
Has anybody ever had a problem with modal window's content when using the web site from behind a proxy? Sadly I cannot provide any details about the proxy configuration. (It's the proxy of a foreign company.)
I can tell you though that it is a Squid proxy and that there are no explicit error's in Wicket's ajax debug windows or the server log. Proxy admin also says there's nothing blockek in the logs. Wicket actually returns an empty div to be displayed in the modal window's content:
<div id="contentd" style="display:none"></div>
This is what is returned when I do not have the proxy between me and wicket:
<div id="content10">
<form>
<table align="center" cellspacing="5px" width="100%">
<tr>
<td colspan="2" align="center">
<span><p>Möchten Sie den Monitor wirklich löschen?</p></span>
</td>
</tr>
<tr>
<td align="center">
<input type="button" value="Ok" class="button" id="confirm15" onclick="var wcall=wicketAjaxGet('?wicket:interface=:1:uniModal:content:confirm::IBehaviorListener:0:-1',function() { }.bind(this),function() { }.bind(this), function() {return Wicket.$('confirm15') != null;}.bind(this));return !wcall;">
</td>
<td align="center">
<input type="button" value="Abbrechen" class="button" id="confirmNot16" onclick="var wcall=wicketAjaxGet('?wicket:interface=:1:uniModal:content:confirmNot::IBehaviorListener:0:-1',function() { }.bind(this),function() { }.bind(this), function() {return Wicket.$('confirmNot16') != null;}.bind(this));return !wcall;">
</td>
</tr>
</table>
</form>
</div>
(Sry for this horribly dirty html code, not a work of mine. ^^)
My guess is that the proxy captures parameter's that should arrive at wicket but never do. I switched on DEBUG for org.apache.wicket but can't find anything that might seem useful. Does anybody know an instant solution or have any ideas how to look into this further? After DEBUG logging showed nothing I pretty much ran out of ideas.
Maybe someone can read something out of the wicket logs:
Working without proxy - http://pastebin.com/Agi2JMJM
Not working with proxy - http://pastebin.com/hfzXDHtq
Thanks in advance!
The actual solution was quite easy, now that I know the details. Wicket uses two custom headers when handling modal windows:
wicket-ajax
wicket-focusedelementid
Without these headers wicket seems to be unable to identify the correct modal frame object or similar. The company's proxy server blocked all non-whitelisted headers. After tweaking the proxy server to allow the headers above everything worked like a charm.

Problem with MVC3 AllowHtml attribute

I have a web app based on MVC3 (no beta or release candidate, RTM/RTW version) that has an action that accepts XML files for processing.
Of course, this seems evil to MVC because of possible attacks, so it doesn't allow it. Well, I try to put either AllowHtml on the model object as such:
public class XMLModel
{
[AllowHtml]
public string msg { get; set; }
}
Or I set ValidateInput to false on my action method such as this:
[ValidateInput(false)]
public ActionResult AddCDR(XMLModel model)
{
}
The reason for having a "strongly" typed model in the first place was that I originally tried to have a string value named "msg" as the action method parameter, but that always came back empty.
Now, when someone posts to this form, either on the same machine or from a networked computer, the msg field is always blank.
I have verified with WireShark that the data is actually in the request.
Now, one interesting thing. This should not be necessary with MVC 3. Yet it makes a slight difference.
If I add this to my web config:
<httpRuntime requestValidationMode="2.0" />
It works for requests originating from the local computer, but it does NOT work from another system.
I think the AllowHtml version seems elegant - if only it worked.
I have also found out about a bug in RC2 - again, this should not affect me, but I tried to add the following in Application_Start() anyway:
ModelMetadataProviders.Current = new DataAnnotationsModelMetadataProvider();
As expected, it makes no real difference.
Everything works as expected on my development computer (Win7x64, VS2010), but on the target system (Win2008R2x64, IIS7.5) the above problems are giving me a hard time.
Very important point to note: If I post to the action with no angle brackets, I get the form data as expected. As soon as the angle brackets show up, though, either my action isn't called at all, or it doesn't find the form data, neither in action method parameters or in for instance Request.Params["msg"] where it should be.
Any ideas to allow the XML through?
UPDATE
I've tried to work my way around this while waiting for anyone to come up with an answer here. I have not been able to solve it yet, but I have checked a few additional details;
First, I verified that the ASP.NET MVC 3 version installed on both my development computer and on the web server is the same; v3.0.20105.0 (according to Add/Remove programs).
The web application was actually created with the MVC3 beta, then converted to RC1 and RC2 as they came out, and finally to the RTM version. This meant I had to modify some code because of the ViewBag change. However, since I didn't know exactly what else had changed, I created a brand new MVC3 application with the RTM version, created a controller by the same name, with the same action method, taking a model object similar to the currently used one, renamed the old web app directory and put this new one in place. Exactly the same thing happens - i.e. the parameter with the AllowHtml attribute comes through with all content when the request is made from the local machine, but if it comes from a remote machine, then the HTML (XML actually) is stripped out.
There is no exception. I've installed Elmah and verified this - no exception occurs, my action method is apparently just called with anything looking like XML stripped out from the parameters to the method.
Needless to say, this is driving me crazy. I had some advice yesterday to look at the source code of MVC3, but unfortunately that doesn't really help me, as I can't see anything obviously wrong there, and I can't debug code on the server in question.
Any insights still highly desired, thanks! :)
I cannot reproduce this.
Model:
using System.Web.Mvc;
namespace MvcApplication3.Models {
public class XmlModel {
[AllowHtml]
public string msg { get; set; }
}
}
Controller:
using System.Web.Mvc;
using MvcApplication3.Models;
namespace MvcApplication3.Controllers {
public class HomeController : Controller {
public ActionResult Index() {
return View();
}
[HttpPost]
public ActionResult Index(XmlModel model) {
return View();
}
}
}
View:
#model MvcApplication3.Models.XmlModel
#using (Html.BeginForm()) {
<div class="editor-label">
#Html.LabelFor(model => model.msg)
</div>
<div class="editor-field">
#Html.EditorFor(model => model.msg)
#Html.ValidationMessageFor(model => model.msg)
</div>
}
These were added to a default empty MVC 3 project. Everything posts fine. When I remove [AllowHtml], it generates the appropriate error message.
I am answering this myself because this was an obscure situation, and MVC3 was not the problem.
The system that POSTed data to my application was doing so with malformed data. In addition to that, I was told that they were also POSTing to an older MVC2 application that worked just fine - this was wrong, it turned out they were GETting in that case, and GET they happen to do correctly.
If anything, fairly thorough testing has confirmed that the AllowHtml attribute actually works very well. Never trust your input, tho. :)

Testing a method that implements IHttpHandler.ProcessRequest

So I have a method that implements IHttpHandler.ProcessRequest. It accepts an HttpContext parameter. This parameter is just a form that is filled out with some XML. Here is the HTML that I am using to generate the post context:
<html>
<body>
<form name="form1" method="post" action="http://localhost:7703/api.ashx">
<textarea name="XML" id="XML" rows="25" cols="100"></textarea>
<br/>
<input type="submit" value="submit"/>
</form>
</body>
</html>
As you can see, very simple. This is just used for testing purposes. What I am doing is posting XML in that textbox, and hitting submit. However, I am not sure what to attach my visual studio project to in order to debug. I try attaching it to w3wp.exe like I do when I test the app in a browser and stuff, but that doesn't seem to be working. It still says "This breakpoint will never be hit, no symbols loaded..." blah blah blah, when I put a breakpoint next to the ProcessRequest method and attach.
How do I test this properly?
Thanks guys.
If you run this locally you should be able to "run" it from within Visual Studio and VS will automatically attach it self to the correct process.
If I attach to the development server at the same port as the post, it works! :)

Resources