i have this problem. Need help to find a nice easy way of doing this.
I have my java webapp (war-file). Which is a spring 3 application with a controller (which uses dependency injections to make sql calls trhough a dao). All well.
In this webapp i have now included birt framework(datawarehouse eclipse jars). This jar has it own servlets. (non-spring). I need to call and recieve result from my spring controller method from one of the birt servlets. The spring controller just returns a flag result, if the user has access to a resource or not.
So my question is how should i call my spring controller method from the servlet ? they both are in the same webapp. I would like to use the spring methods (as it has dependency injections to daos) to check if user has access to the resource or not.
Hope its clear what i need
thanks.
tried doing this by just calling the spring controller by using URLConnection, but it have to be a better way to do it:
Code:protected boolean __authenticate( HttpServletRequest request, HttpServletResponse response ){ String urlName = "http://192.168.1.102:8080/reports/hasAccessToReport/2"; URL url; try { url = new URL(urlName); URLConnection conn = url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = in.readLine()) != null) { System.out.println("Output from Server :: "+line); //do something with the output } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }



Reply With Quote