aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes How set Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How set "launch configuration" in Eclipse?" Watch "How set "launch configuration" in Eclipse?" New topic
Author

How set "launch configuration" in Eclipse?

Al Koch
Ranch Hand

Joined: Aug 24, 2011
Posts: 46

Hello,

I am running Eclipse Indigo against Tomcat. My servlet is running fine but I'd like to specify a "launch configuration" so that the starting URL submitted to to Tomcat has a Query String.

My web.xml specifies:

<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.domainname.projectname.MainClassName</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/run/*</url-pattern>
</servlet-mapping>

When I run the servlet in Eclipse (<F11>) I see the URL of the native browser comes up as:

http://localhost/MainClassName/run/*

However, what I need to launch with is (append the "?p=123")"
http://localhost/MainClassName/run?p=123

I've experimented with<url-pattern> in web.xml. In addition, I have also tried using the Project's Properties' Run/Debug Settings. Either these are not the right way to do this or I am using them wrong.

Can someone tell me how to get Eclipse to launch with the URL above?

Thank you.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Welcome to the JavaRanch, Al!

Eclipse doesn't submit ANY URLs to Tomcat. Eclipse itself doesn't even understand J2EE, so what J2EE support you get comes from plug-ins. Several of the Eclipse.org downloads come with such plugins pre-installed.

However, none of them make requests to Tomcat or any other webapp server. They figure that's the client's job, and Eclipse is just responsible for the IDE and the debugger and maybe launching/controlling the Tomcat server.

The URL patterns in web.xml are what Tomcat uses to figure out where to send URL requests. So for example, you've told Tomcat that URLs whose post-context URLs begin with /run/ will be routed to MyServlet.

Or, in other words, nothing in web.xml has to do with sending URLs, only in what to do with them when they are received.


Customer surveys are for companies who didn't pay proper attention to begin with.
Al Koch
Ranch Hand

Joined: Aug 24, 2011
Posts: 46

Hi Tim,

Thanks for the reply; I'm new to Eclipse so sorry for being a bit vague.

I am running Eclipse with the Sysdeo plugin. I realize that Eclipse is "just" a framework that we hang plugins on but I'm not sure where else to ask my question which I think many other people must have.

My understanding of web.xml is that it just tells Tomcat what class to execute when "something sends" it a particular URL (which is what you said) so I'm not surprised that it is not the solution. But Eclipse does show (or is it the Sysdeo plugin?) the Properties > Run/Debug Settings window which "sounds" like what I need but I don't see how to make that work for me. But no matter what, Eclipse must be involved in some fashion in launching the servlet because <F11> causes http://localhost/MyProject/run/* to be sent to Tomcat. (I can see this URL in the Eclipse "internal" browser window).

So, can you tell me how/"who" is sending that URL to Tomcat when I push <F11>? I can't be the only person who wants to launch a servlet out of Eclipse with a URL that has a query string on the end. Since I'm launching using Eclipse's <F11> it seems like this forum is the place to ask about this but if you know where I should be posting please let me know.

Thanks for your help.

Al
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How set "launch configuration" in Eclipse?