Jetty Daemon Runner

Jetty daemon runner for Unix

License

License

Categories

Categories

Jetty Container Application Servers
GroupId

GroupId

com.nmote.jetty
ArtifactId

ArtifactId

jetty-daemon-runner
Last Version

Last Version

0.6
Release Date

Release Date

Type

Type

jar
Description

Description

Jetty Daemon Runner
Jetty daemon runner for Unix
Project URL

Project URL

https://github.com/vnesek/jetty-daemon-runner
Source Code Management

Source Code Management

https://github.com/vnesek/nmote-xr.git

Download jetty-daemon-runner

How to add to project

<!-- https://jarcasting.com/artifacts/com.nmote.jetty/jetty-daemon-runner/ -->
<dependency>
    <groupId>com.nmote.jetty</groupId>
    <artifactId>jetty-daemon-runner</artifactId>
    <version>0.6</version>
</dependency>
// https://jarcasting.com/artifacts/com.nmote.jetty/jetty-daemon-runner/
implementation 'com.nmote.jetty:jetty-daemon-runner:0.6'
// https://jarcasting.com/artifacts/com.nmote.jetty/jetty-daemon-runner/
implementation ("com.nmote.jetty:jetty-daemon-runner:0.6")
'com.nmote.jetty:jetty-daemon-runner:jar:0.6'
<dependency org="com.nmote.jetty" name="jetty-daemon-runner" rev="0.6">
  <artifact name="jetty-daemon-runner" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.nmote.jetty', module='jetty-daemon-runner', version='0.6')
)
libraryDependencies += "com.nmote.jetty" % "jetty-daemon-runner" % "0.6"
[com.nmote.jetty/jetty-daemon-runner "0.6"]

Dependencies

compile (3)

Group / Artifact Type Version
org.kohsuke : akuma jar 1.10
org.eclipse.jetty : jetty-runner jar 9.3.8.v20160314
net.java.dev.jna : jna jar 4.2.2

Project Modules

There are no modules declared in this project.

nmote-xr - Simple (X)ML-(R)PC library

Java 1.5+ client and server implementation of XML-RPC protocol. See http://en.wikipedia.org/wiki/XML-RPC

Features

  • Supports Java 1.5+
  • Reflective and programmable calls
  • Basic springframework integration
  • No external dependencies at all
  • Server and client support
  • BSD style license

Add to Your's Project

If you use maven for dependency management, add following snippet to pom.xml:

	<dependencies>
		...

		<dependency>
			<groupId>com.nmote.xr</groupId>
			<artifactId>nmote-xr</artifactId>
			<version>2.2.0</version>
		</dependency>

	</dependencies>

Building

To produce nmote-xr.jar you will need apache maven installed. Run:

mvn clean package

Usage

  • Call userland service
	Endpoint server = XR.client(new URI("http://betty.userland.com/RPC2"));
	MethodCall call = new MethodCall("examples.getStateName", 3);
	MethodResponse response = server.call(call);
	System.out.println(call + " => " + response);
  • Same as above, but use type safe interface 'Betty'
	interface Betty {
		@XRMethod("examples.getStateName")
		public String getStateName(int n);
	}

	Betty betty = XR.proxy(new URI("http://betty.userland.com/RPC2"), Betty.class);
	String result = betty.getStateName(41);
	System.out.println(result);
  • There is also a com.nmote.xr.Meta interface to support rudimentary reflection of XML-RPC
		Meta xrs = XR.proxy(new URI("http://betty.userland.com/RPC2"), Meta.class);
		System.out.println(xrs.listMethods());
  • To expose a simple XML-RPC HTTP server, you don't need no external dependencies
	@XRMethod(value = "example.helloWorld", help = "Returns 'Helo ' + argument")
	public static String hello(Object s) {
		return "Hello '" + s + "'";
	}

	public static void main(String[] args) throws Exception {
		NanoServer server = new NanoServer("http://localhost:7070");
		server.add(XR.server(HelloWorldServer.class));
		server.start();
	}
  • You can trace XML-RPC calls through LoggerAdapter. Configuration is made through EndpointBuilder::debug builder method
		String url = "http://www.cookcomputing.com/xmlrpcsamples/math.rem";
		Math m = EndpointBuilder.client(url, Math.class).debug().get();
		System.out.println(m.add(2, 3));

To use your's logging framework of choice instead of System.err, implement com.nmote.xr.log.LoggerAdapter interface.

  • For production you will need to expose com.nmote.xr.Endpoint via one or more com.nmote.xr.XRServlet instances. Endpoint handling client's request is passed in either as a servlet request attribute or a servlet context attribute named 'com.nmote.xr.Endpoint'. Attribute name can be configured through a servlet parameter 'endpointKey'.

    Add following snippet to web.xml:

  	<servlet>
		<servlet-name>xml-rpc</servlet-name>
		<servlet-class>com.nmote.xr.XRServlet</servlet-class>
		<init-param>
			<param-name>endpointKey</param-name>
			<param-value>My-XMLR-RPC-Server-Name</param-value>
		</init-param>
	</servlet>

You can also override XRServlet::getEndpoint() to expose service:

		@Override
		protected Endpoint getEndpoint(HttpServletRequest request) throws ServletException {
			class Server {
				@XRMethod
				public String hello(Object s) {
					return "Hello '" + s + "'";
				}
			}

			return new ObjectEndpoint().export(new Server(), null);
		}

(See the https://github.com/vnesek/nmote-xr/blob/master/src/main/java/com/nmote/xr/XRServlet.java source for more info)

  • Package com.nmote.xr.spring has support classes for exposing clients and server using springframework contexts.

Author Contact and Support

For further information please contact Vjekoslav Nesek ([email protected])

Versions

Version
0.6