Rookie question on request variable

I'm from another world ;-), but i have (and want) to implement a java solution within my world (Peoplesoft). From within my code I'm able to instantiate classes, and use their methods (there are limits though).

Now what I'm trying to do is build a class (wrapper) that will do somethings for me that I'm unable to do in my world. Currently my class looks like

Obvious this will not implement the functionality that I'm looking for, but the class i'm working on won't compile because it is unable to find request (and response). The code that I'm trying to build a wrapper for is coming from a JSP. I understand the functionality behind the request/response variables, but I wonder how you can make these variables available within a class that you want to compile (I do this with "javac -classpath <dir/jars> test.java)

Basically I need to intregrate OpenAM with Peoplesoft. I only need to integrate the return part.

A user connects to the webserver for Peoplesoft, and will be presented with a jsp page that will send them to the IDP to authenticate. Once authenticated the IDP will redirect the user back to the application. Currently this application is a JSP page, however I would prefer to remove that layer, and directly integrate it with Peoplesoft.

This means I need from within Peoplesoft to access the classes (there are a bunch of them) directly, or a class that works as a wrapper. As I'm able to access the java classes from within Peoplesoft and I don't want to over complicate the work within Peoplesoft (reduce the risk of errors), I prefer the 2nd option. The code below is from the JSP that acts as the application in the OpenAm solution. This code needs to be available by a wrapper class, or by a direct call. The first 'try' line uses the request/response object. As this was failing I thought to strip the code, and focus on understanding how these objects work. I've learned that these are 'special' variables. I'm sorry to ask such basic question, but I haven't done much Java yet, so obvious that the main part is there as all tutorials are starting with this ;-).

Just tell me if what I'm doing is feasible in Java or not. I don't have that insight (yet), however I would believe you can call the response/request variables from within a package. I would be surprised that these variables are only available with a *.jsp file.

How is the JSP activated from the system? If it's by making an HTTP request, the JSP can easily be replaced by a servlet that responds to the same URL (whichis preferable -- these days Java code ina JSP is a huge no-no).

But only a servlet running in a servlet container (just as the JSP is now), will do. A general Java class cannot be used.

Well because of your previous hint, I worked it out. I'm able to call the java class, but unfortunately I don't think I will have the request object. As the time this class is called, the executer is not anymore at the webserver level, but at an application server level. I'm not yet giving up, but I have this feeling that it isn't gonna be easy. anyway it isn't easy for me. Fortunately some colleague of mine has some more java knowledge, and he will help me out next week

Thanks a lot for your earlier response, this is what I need to proceed. If I do get it to work, I will drop the results and I hope you don't mind to give me your feedback on it.