1

I have a building block using Spring MVC.

The controller looks like this:

@RequestMapping(value = "/addUpdateUser",method = {RequestMethod.GET, RequestMethod.POST})  
@ResponseBody
public String getAddUpdateUser(HttpServletRequest request) {
    String xml = request.getParameter("xml");
....

When I call this from my application like this:

    URI url = new URI(baseUrl+"/users/addUpdateUser");
    HttpClient httpclient = HttpClients.createDefault();
    HttpPost httppost = new HttpPost(url);
    HttpResponse response = httpclient.execute(httppost);
    HttpEntity entity = response.getEntity();

it fails... I get a web page saying that I do not have access to this page, but If I change the code to a HttpGet like this:

    URI url = new URI(baseUrl+"/users/addUpdateUser");
    HttpClient httpclient = HttpClients.createDefault();
    HttpGet httpget = new HttpGet(url);
    HttpResponse response = httpclient.execute(httpget);
    HttpEntity entity = response.getEntity();

It works fine....

Why cant I do a POST to a blackboard Buildingblock?

mmaceachran
  • 3,178
  • 7
  • 53
  • 102

1 Answers1

0

Blackboard Learn blocks external posts by default.

You will need to add the @NoXSRF annotation above the @RequestMapping, with this should allow you access it.

Ethaan
  • 11,291
  • 5
  • 35
  • 45