how to run my sip servlet in netbeans - netbeans

I am new in SIP server development. I read a lot about sipservlet and sailfin like
SIP servlets, chatserver
If I write that code in netbeans I cannot right click on the sip servlet and click run as it told me it doesnot contain main method or it is not in web.xml.
I am confused:
1- Why I need sailfin to run my sip application
2- Can I run my sipservlet in netbeans like httpservlet
3- How I can register my servlet with any ip.
Thanks

Sailfin has been killed by Oracle, please checkout Mobicents instead http://dzone.com/links/mobicents_sip_servlets_200final_with_support_for.html

Related

How to call a servlet on Glassfish server in Eclipse

I am trying to call a servlet form my android application in eclipse. I have to use the Glassfish application server(the servlet is in a different Mavan project). I had a few questions:
How to start a glassfish server in Eclipse?
What URL do I pass in the HttpPost() method?
Thank you.
There is the Servers view in which you can add you GF instance. However, this is not mandatory and you can run it from the command line (asadmin).
If your GF runs locally, the URL will start with
http :// localhost/webappName/servletPath
localhost or 127.0.0.1
I'd advise you to get a training as the more you'll progress, the more questions you'll have.

Java Servlets + JDBC + Postgres: How does it all interact?

I'm having trouble wrapping my head around how to use servlets properly
I've set up a postgres database, and downloaded a JDBC driver for it.
What I want to have is my webpages post to the servlet, and the servlet get info from the database. I understand how to code everything (eg add library for driver, open connections, execute queries), but I think I'm lacking knowledge in how to set up the file structure.
I have the postgresql database running on pgAdmin. Do I also need to have a server running to make the servlets work as well? Can't I just make a web.xml file that maps to the servlets, and open the webpages to use the website? If I run the project through an IDE with a server running (glassfish) everything works. If I close the IDE and go to open the webpages on my browser again, I get 404's whenever I submit to a servlet.
Can someone give me a bit of guidance on the big picture of how everything is supposed to interact (with details on servers please). I've been searching the web and I havent found anything that explains the big picture very well.
Thanks
A Java web application is a set of files obeying a well-defined structure, and which can be packaged in a war file.
This web application is deployed into a server (also called container), which understands the file structure, listens to HTTP requests, and calls the appropriate servlet of the appropriate deployed web application when it receives one.
And of course, if you shut down the server, nothing listens to the HTTP requests anymore, so you won't get any response.
You could read the Java EE tutorial for more explanations.

How I can deploy my GWT application on www

I created my first Java EE application (GWT + Hibernate). I want deploy my application on a Tomcat web server.
Could you give me a step by step tutorial?
You can start with Google App Engine + GWT tutorial if you are trying out deploying into Google Cloud - https://developers.google.com/web-toolkit/doc/latest/tutorial/appengine
This question is massive so I will try to bring it down to some steps that need some research to implement.
1st. You created an application using GWT and Hibernate. That means that you need some kind of a web server that understands java and can re-write the logic from java to javascript (for the clientside), and also connect to the database on the serverside and retrieve the data for the client.
This web server is tomcat so what you need is:
A computer that will work as a server. This could be your own machine or some server you can buy as a hosting solution. Buying something like this requires research and effort on your part and cannot be explained here.
A version of Tomcat or Resin or any other web server that understands java
A domain name. These can be bought from sites like this one, but there are some free ones around the web. They require static ips that is you cannot use them from a home line that changes ips. Even without a domain name you can host your site on the server but you need to access it by writing the machine's ip instead. - optional - A temporary solution would be to use some kind of dynamic dns service on your router.
After having set up tomcat (you might want to give port 80 to tomcat) and the server you can host your application by uploading the war file. You can make a war file from gwt by following the instructions here
To upload the war file you can use the tomcat manager interface, or you can connect to the server and place it manually in the folder used for the web applications.
I know that each step propably needs as much if not more explanation by I hope I cleared the area a little bit here.

Debugging a GWT app which needs access to an external resource (Same Origin Policy)

We have a GWT application which draws some resources from a separate servlet via async javascript. In production this poses no problems as both the producer servlet and the consumer GWT app will reside on the same server, however for development I can't find a way to make this happen as we are head to head with the Same Origin Policy.
As a temporary solution I have the servlet running on Tomcat, and I compile and deploy the GWT app to that same Tomcat instance - this of course works, and it does allow me to attach Eclipse for debugging. However there is the slight problem of the 40 second or so build time for each modification.
We would like to be able to debug via GWT's hosted mode w/ OOPHM - can anybody see a way for us to do this?
Thanks all!
you could use the -noserver option of gwt dev mode, which lets you run your server code with any servlet container.
Maybe you can deploy the producer servlet to Jetty.
http://www.enavigo.com/2008/08/29/deploying-a-web-application-to-jetty/
I think the Jetty home most reside somewhere in the Eclipse directories. A simple file search might help.
Good luck!
If you need just a servlet, why not define it in web.xml and start dev mode as usual?

gwt response at run as web application

In my gwt application,i am using php code for back end process...i can get response from that php file when i deploy on iis server...
but i can't get response from that php file when i running from the eclipse...
(i.e)
can get response from this url "http://localhost/sample/index.php"
can't get response from this url "http://localhost:8888/sample/index.php" it returns my php code...
It's probably possible to run PHP on Jetty, too: See these instructions - not sure, if they still work with Jetty 6, and I really haven't tried it.
But I would recommend to simply run a separate PHP server (maybe deployed from a separate Eclipse project). See this GWT FAQ entry: How do I use my own server in hosted mode instead of GWT's built-in Jetty instance
You could use the gwt -noserver option
"The -noserver option instructs hosted mode to not start the embedded Jetty instance. In its place, you would run the J2EE container of your choice and simply use that in place of the embedded Jetty instance."
I don't know if this would solve your problem