Announcement Announcement Module
No announcement yet.
recieving result from a spring controller method to a java servlet ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • recieving result from a spring controller method to a java servlet ?

    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


    tried doing this by just calling the spring controller by using URLConnection, but it have to be a better way to do it:

    protected boolean __authenticate( HttpServletRequest request,
    			HttpServletResponse response ){
    String urlName = "";
    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) {
    } catch (IOException e) {

  • #2
    Would it be possible to use requestdispatcher to the spring controller, by using somehting like this ?
    RequestDispatcher rd = getServletConfig().getServletContext().getRequestDispatcher("/springcontroller/springmethod");