#263 What is shortest path: Haystack Java Toolkit To Running Eclipse Project?

paul gorbas Wed 18 Mar 2015

I could not find information on how to setup the "Haystack Java Toolkit" into a Java eclipse (Luna if it makes a difference) project in eclipse, perhaps running on Tomcat? I did checkout the code, but found it did not contain any .project

Can anyone point me at such a document, or clue me in on how to proceed?

paul gorbas Wed 18 Mar 2015

Until someone else point me in the right direction, here is what I did to get the sample code running in a local tomcat in my Eclipse IDE.

== project setup notes ===

1) Setup Eclipse so you can create and run Dynamic Web Projects on a internal Tomcat server

2) Clone down the Haystack Java Toolkit

3) In Eclipse create a new Dynamic web project - specify Tomcat and Java version ( I used Tomcat 7 and JDK 1.6 )

4) Import General | File Sytem | < path to where you downloaded the Haystack Java Toolkit >

5) In the WebContent | WEB-INF directory create a web.xml file

Mine looked like this:

<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app

PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<display-name>HaystackJavaToolkit</display-name>
<description>The base Haystack Java Toolkit</description>
<distributable/>

<context-param>
  <param-name>hjt</param-name>
  <param-value>HaystackJavaToolkit</param-value>
</context-param>

<servlet>
  <servlet-name>hjt</servlet-name>
  <servlet-class>org.projecthaystack.server.HServlet</servlet-class>
  <load-on-startup>0</load-on-startup>
</servlet>

<servlet-mapping>
  <servlet-name>hjt</servlet-name>
  <url-pattern>/hjt/*</url-pattern>
</servlet-mapping>

<mime-mapping>
    <extension>xsl</extension>
    <mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
    <extension>xml</extension>
    <mime-type>text/xml</mime-type>
</mime-mapping>

<!-- Welcome file processing order -->
<welcome-file-list>
  <welcome-file>welcome.html</welcome-file>
  <welcome-file>index.html</welcome-file>
</welcome-file-list>

</web-app>

6) Right click on the root project and select "Run As" or "Debug As" then either "Run on server" or "Debug on server"

7) You should get an index page of your web-inf deployment - will be empty unless you create a jsp or http page to put in there.

8) You should then be able to hit the servlet with ops request with an url like this: ==>http://localhost:8080/hjt/hjt/about<== or ==>http://localhost:8080/hjt/hjt/ops<== etc...

Login or Signup to reply.