@ Bear - Am using a third party API program that is purely java classes i want to send data to that function. Since we cant send request parameter directly to java class without using servlet am trying an alternative way to achieve it. Is there any solution bear.
Sabarish Venkat wrote:Since we cant send request parameter directly to java class without using servlet
You are not passing request parameters, you are passing a file right?
Next technically there is no difference in the functionality a JSP and servlet perform.
You can instantiate the class and read the file directly from the JSP. I don't see this as a good implementation though.
Have you thought of thread-safety?
As i thought of calling API through servlets in have to get all the functionality that present in API. It will be difficult for me to find each and every functions that are doing some internal operations of API. So i dont want to repeat the same API as servlets or calling it as servlets
Sabarish Venkat wrote:As i thought of calling API through servlets in have to get all the functionality that present in API. It will be difficult for me to find each and every functions that are doing some internal operations of API. So i dont want to repeat the same API as servlets or calling it as servlets
I don't really understand what you are trying to say here, but regardless, you're going to have to use servlets to respond to the requests.
So is I understand this right:
- you have a 3rd party application.
- You want to write a web application front end to invoke that application, because it doesn't have a web front end.
Not knowing anything about the app you are invoking, what sort of parameters it takes etc makes it harder to answer the question.
Because you are passing up a file, I presume this 3rd party app requires a file as input.
Writing a servlet to handle the requests IS the obvious thing to do.
It should act as the bridge between the HTTP request and the API call, translating as necessary.
That means that yes, for each API call in the 3rd party app you want to handle via the web, you will have to invoke it from the servlet.
In essence your servlet becomes a dispatcher to go
- read the request
- invoke the business logic (3rd party app)
- provide a response???
Depending on the API, you should be able to make a generic dispatcher servlet that will serve 95% of use cases.
@Stefan Evans - Exactly you got my problem. The Third party API link is here Zencoder - API for Java . This zencoder is and video and audio encoder API where the input files will be converted into different formats as the user wish.
For more details about it you can see this link. Zencoder