Package org.restlet

Examples of org.restlet.Restlet


  }

  @Override
  public synchronized Restlet createInboundRoot() {
    Context c = getContext();
    Restlet root = createRootRouter(c);

    // Restore sessions
    root = new SessionFilter(c, root);

    // Allow Accept-parameters to override Accept-headers:
View Full Code Here


    router.attach("", new QueryParser(c, QueryListResource.class));
    return router;
  }

  protected Restlet createSessionPath(Context c) {
    Restlet result = new Finder(c, SessionResource.class);

    String casServerURL = System.getProperty("org.openrdf.auth.cas.server");
    if (casServerURL != null) {
      result = new CasAuthFilter(casServerURL, c, result);
    }
View Full Code Here

import org.restlet.data.Protocol;
import org.restlet.resource.ClientResource;

public class HelloRestlet {
  public static void main(String[] args) throws Exception {
    Server server = new Server(Protocol.HTTP, 8182, new Restlet() {
      @Override
      public void handle(Request request, Response response) {
        response.setEntity("Hello, World", MediaType.TEXT_PLAIN);
      }
    });
View Full Code Here

    router.attach("/clusters/{clusterName}/configs/{scope}/{scopeKey1}", ConfigResource.class);
    router.attach("/clusters/{clusterName}/configs/{scope}/{scopeKey1}/{scopeKey2}", ConfigResource.class);
    router.attach("/zkPath", ZkPathResource.class).setMatchingMode(Template.MODE_STARTS_WITH);
    router.attach("/zkChild", ZkChildResource.class).setMatchingMode(Template.MODE_STARTS_WITH);

    Restlet mainpage = new Restlet()
    {
      @Override
      public void handle(Request request, Response response)
      {
        StringBuilder stringBuilder = new StringBuilder();
View Full Code Here

  @Override
  public Restlet createRoot()
  {
  Router router = new Router(_context);

    Restlet mainpage = new Restlet()
    {
      @Override
      public void handle(Request request, Response response)
      {
        StringBuilder stringBuilder = new StringBuilder();
View Full Code Here

    private boolean checkVirtualHost(VirtualHost host) throws Exception {
        boolean result = true;

        if (host != null) {
            for (Route route : host.getRoutes()) {
                Restlet next = route.getNext();

                if (next instanceof Application) {
                    Application application = (Application) next;

                    for (Protocol clientProtocol : application
View Full Code Here

     * @param host
     * @throws Exception
     */
    private void stopVirtualHostApplications(VirtualHost host) throws Exception {
        for (Route route : host.getRoutes()) {
            Restlet next = route.getNext();

            if (next instanceof Application) {
                Application application = (Application) next;

                if (application.isStarted()) {
View Full Code Here

            getRoutes().add(
                    new HostRoute(this, getComponent().getDefaultHost()));
        }

        // If no host matches, display and error page with a precise message
        Restlet noHostMatched = new Restlet(getComponent().getContext()) {
            public void handle(Request request, Response response) {
                response.setStatus(Status.CLIENT_ERROR_NOT_FOUND,
                        "No virtual host could handle the request");
            }
        };
View Full Code Here

    public RestletConsumer(Endpoint endpoint, Processor processor)
        throws Exception {
        super(endpoint, processor);
       
        restlet = new Restlet() {
            @Override
            public void handle(Request request, Response response) {
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Consumer restlet handle request method: " + request.getMethod());
                }
View Full Code Here

        if (LOG.isDebugEnabled()) {
            LOG.debug("MethodRouter (" + uriPattern + ") received request method: "
                    + request.getMethod());
        }
       
        Restlet target = routes.get(request.getMethod());
        if (target != null) {
            target.handle(request, response);
        } else {
            if (LOG.isDebugEnabled()) {
                LOG.debug("No route for request method: " + request.getMethod());
            }
            response.setStatus(Status.CLIENT_ERROR_NOT_FOUND);
View Full Code Here

TOP

Related Classes of org.restlet.Restlet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.