• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Notify servlet url from android application to a servlet which resides in a remote server

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone !
I have an Android application which connects to a servlet (On Tomcat) which queries an SQL server.

First I tried it in my computer. My Tomcat was running in my local machine.
The tree (in Eclipse) was seen like this:
myServletProjectName--->java resources--->src---->myServletPackName---->myServletClassName

The url from my application didn't mention all this path, but only the servletProjectName and the servletClassName:


Everything works fine.

Now, I upload a war file of the servlet to a remote server (not the Tomcat is running on that server).
The tree over there (not in Eclipse but in regular folders is):
home--->tomcat--->webapps---->domainName--->ROOT--->webInf--->classes---->myServletPackName--->myServletClassName

May you please tell me, what should be my url in order to connect  my Android application to this servlet? (Ofcours I know the ip address,
but I don't know what are the folders I should write in the url -- I don't see my project name in this tree).

Thanks a lot,
          Eli.
 
Saloon Keeper
Posts: 7594
177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The URL would generally be the same, except for the IP address and port (probably 80 rather than 8080).

The "ROOT" part indicates that the app is deployed not as a separate project, which means the "myServletProjectName" part of the URL should be omitted.

Also note that you should map servlets to names in the web.xml, and not address them via their package and class name.
 
Eli Ean
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim, thank you for your answer.
I tried what you wrote:

and it didn't work. When I write "didn't work", I mean there is no connection between my application and the Tomcat server.
I checked The tomcat and it is running.

Is there maybe other thing I need to do in order to have a connection between them?

When I used the application in my house, my wireless connection was enabled because I made the phone and the
computer surf on the same new (a WiFi net from my router).

Here I don't do anything. should I?

I can say that where I check if I can surf the www.domainName.com from my phone
through the regular internet I can.

So, in your opinion, is it the Url issue or something else?

Eli.

 
Eli Ean
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
Prbblem was solved!
Instead of writting a number and ports, just write the domain name (without www).
For example: If the domain is www.abc.com, the
url will be:

Tim thanks for the note about :

The "ROOT" part indicates that the app is deployed not as a separate project,
which means the "myServletProjectName" part of the URL should be omitted.


It helped.

Thank you,
          Eli.
 
Oh. Hi guys! Look at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic