Spring Tomcat 403 forbidden

I can't understand while send ajax request from phonegap spring return 403 error without handle request with tomcat. If use jetty embeded work cool.

my controller

@Controller
public class TestController {
    @RequestMapping(value = "/", method = RequestMethod.POST)
    public String test() {
        return "Hello";
    }
}

How i can full log requests in tomcat or how fix it from spring. In simple rest clients work cool.

   @RequestMapping(value = "/login", method = RequestMethod.GET)
public @ResponseBody Object loginUser1(HttpServletRequest req , HttpServletResponse httpServletResponse) {
    Enumeration<String> headerNames = req.getHeaderNames();

    while (headerNames.hasMoreElements()) {

        String headerName = headerNames.nextElement();
        System.out.println(headerName);

        Enumeration<String> headers = req.getHeaders(headerName);
        while (headers.hasMoreElements()) {
            String headerValue = headers.nextElement();
            System.out.println(headerValue);
        }

    }
    return "Hello";
}

@RequestMapping(value = "/login", method = RequestMethod.POST)
public @ResponseBody Object loginUser2(HttpServletRequest req , HttpServletResponse httpServletResponse) {
    Enumeration<String> headerNames = req.getHeaderNames();

    while (headerNames.hasMoreElements()) {

        String headerName = headerNames.nextElement();
        System.out.println(headerName);

        Enumeration<String> headers = req.getHeaders(headerName);
        while (headers.hasMoreElements()) {
            String headerValue = headers.nextElement();
            System.out.println(headerValue);
        }

    }
    return "Hello";
}

Get return

host 10.0.0.42:8080 connection keep-alive accept / x-requested-with com.citronium.planReview user-agent Mozilla/5.0 (Linux; U; Android 4.2.1; en-us; e2001v21_v89_gq2008s Build/JOP40D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 accept-encoding gzip,deflate accept-language en-US accept-charset utf-8, utf-16, *;q=0.7

Answers


I resolve my problem. In Servlet 3, is the direction WebSockets. Tomcat 7 try implement Servlets 3 and start websocket listener. Phonegap< not send header Origin, tomcat not resolve any strange origins as: "null, file://" and other. Use other servers or, use old tomcat. I am use tomcat 6.37. It's resolve my problem.


Probably you need as @Anders said:

@RequestMapping(value = "/", method = RequestMethod.GET)

If you want to add logging to your web application, you can add log4j, which is a good logging framework.

At applicationContext-security.xml define

<intercept-url pattern="/default-page" access="permit all">


Need Your Help

Scrolling a table view with text fields when "Next" return button in keyboard

ios uitableview scroll keyboard uitextfield

I have a grouped table view with custom cells, and these cells have a UITextField. I've set the returnKeyType of the text fields to be UIReturnKeyNext (except for the last row), and I've implemented

RegisterClass error in Unity Editor when using Mono.WinForms

c# winforms mono unity3d registerclass

I'm using Mono.WinForms to create external windows in Unity and it works great except that I get this error message each time I play the scene (but never the first time when Unity is freshly starte...