The tool I'm working on can only send GET requests, and I need to process heavy operations using the information contained within the request. These operations then return a String containing a URL I will use for redirection.
After doing some researches, I've found that doGet() method is rather used for pre-processing a request, while doPost() can be used for post-processing.
Is there any way I can do these heavy operations using the doGet() method ? If I have to use the doPost() method, how can I "turn" my request into a POST request ?
Thanks.
Edit : I've already tried to process these heavy operations within the doGet method. But it seems the servlet doesn't wait until the url String I use for redirection is generated. I've read it's a bad thing to try to synchronize your doGet() method performance-wise.
Edit 2 - About what I'm trying to do : The tool I'm working on is an Oracle solution. You can launch custom actions within the client, including web applications. Launching a custom action will send a GET request to the application, containing all the information about the page from which you launched the application (user, item selected, etc) and the application then uses this information to process the heavy operations I talked about. Operations consist of creating a new session on the Oracle client using the same IDs, making queries based on the item selected, creating XML Data and even using an external program located on the Oracle server. Finally, it returns a download URL from where you can download a PDF report, and I use this URL to redirect the application.
Here's the servlet code :
package com.servlets;
import java.io.IOException;
import javax.naming.InitialContext;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.actions.agileSessionHandler;
import com.actions.BOMComparisonReport;
public class DefaultServlet extends HttpServlet {
public void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException{
agileSessionHandler handler = new agileSessionHandler(...);
BOMComparisonReport report = new BOMComparisonReport(...);
handler.setSessionObject(request);
String url = report.generateBOMReport(...);
request.setAttribute("redirectURL", url);
this.getServletContext().getRequestDispatcher( "/WEB-INF/BOMCompDefault.jsp" ).forward( request, response );
}
}