Skip to content

tsugicontrib/tsugi-java-servlet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated: As of November 2018, this effort is deprecated. We are in the process of developing a new technology / apprach that will allow Tsugi tools to be built in a wide range of environments connected to the core of Tsugi using web services wather than through the database as is done in this approach. A simple servlet that that shows basic use of the Tsugi library.

Apereo Incubating badge

Pre-Setup

Here are the pre-steps:

  • Install PHP Tsugi and get it setup and working. Your PHP installation must be up and running as the Tsugi Sevlet just uses the PHP Tsugi database.

  • Checkout and compile the Java Tsugi Library so that it is in your maven repository

Build / Run

If you are running on Windows, you need to change the details in the file

./src/main/resources/tsugi.properties

Change a line to be something like:

tsugi.datasource.url=jdbc:mysql://localhost:3306/tsugi

Sorry about the Mac/MAMP-friendly defaults.

mvn clean compile install jetty:run

Then navigate to

http://localhost:8080/tsugi-servlet/hello

It will say something like this:

HTTP ERROR: 500
This tool must be launched using LTI
RequestURI=/tsugi-servlet/hello

It does not talk to the database if it rejects the request.

Launching with LTI

To launch this app, go to:

https://online.dr-chuck.com/sakai-api-test/lms.php

Launch to:

http://localhost:8080/tsugi-servlet/hello
12345 / secret

If all goes well for the launch, your Java Tsugi application will be showing in the window with some kind of output like:

Welcome to hello world!
Click here to see if we stay logged in with a GET
Content Title: Introduction to Programming
Context Settings: {"zap":"1234","count":"1"}

If your database connection is mis-configured or not working in the Tsugi servlet you will be splashed with plenty of traceback in the iframe:

HTTP ERROR: 500
Database server is down or tsugi database is missing
RequestURI=/tsugi-servlet/hello
Caused by:
java.lang.RuntimeException: Database server is down or tsugi database is missing
at org.tsugi.impl.jdbc.Tsugi_JDBC.getConnection(Tsugi_JDBC.java:82)
at org.tsugi.impl.jdbc.Tsugi_JDBC.getLaunch(Tsugi_JDBC.java:114)
at org.tsugi.base.BaseTsugi.getLaunch(BaseTsugi.java:51)
at org.tsugi.sample.TsugiServlet.doGet(TsugiServlet.java:50)
...

Fix the tsugi.properties and try again.

Other Source Code

Tsugi Second-level API library

https://github.com/tsugiproject/tsugi-java

Tsugi low-level API library (formerly sakai-basicltiutil)

https://github.com/tsugiproject/tsugi-util

About

A simple servlet that shows how to use the Tsugi Java library (deprecated)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •