Skip to content

Instantly share code, notes, and snippets.

@KAllan357
Created July 30, 2014 18:10
Show Gist options
  • Save KAllan357/6c170e37a97c3b310a77 to your computer and use it in GitHub Desktop.
Save KAllan357/6c170e37a97c3b310a77 to your computer and use it in GitHub Desktop.
package com.riotgames.nexus.rest;
import org.restlet.Context;
import org.restlet.data.Request;
import org.restlet.data.Response;
import org.restlet.resource.ResourceException;
import org.restlet.resource.Variant;
import org.sonatype.nexus.rest.AbstractNexusPlexusResource;
import org.sonatype.plexus.rest.resource.AbstractPlexusResource;
import org.sonatype.plexus.rest.resource.PathProtectionDescriptor;
import org.sonatype.plexus.rest.resource.PlexusResource;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Named
@Singleton
@Path("/hello")
@Produces("application/json")
public class HelloWorld extends AbstractNexusPlexusResource {
@Override
public String getResourceUri() {
return "/hello";
}
@Override
public PathProtectionDescriptor getResourceProtection() {
return new PathProtectionDescriptor( this.getResourceUri(), "anon" );
}
@Override
public Object getPayloadInstance() {
return null;
}
@Override
@GET
public Object get(Context context, Request request, Response response, Variant variant) throws ResourceException {
return "Hey buddy!";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment