Package org.restlet

Examples of org.restlet.Context


    }
    component.getClients().add(Protocol.HTTP);
    component.getClients().add(Protocol.HTTPS);
    component.getLogService().setEnabled(false);

    Context appContext = component.getContext().createChildContext();
    sesameApplication = new SesameApplication(appContext, dataDir);

    component.getDefaultHost().attachDefault(sesameApplication);

    if (getShutdownKey() != null) {
View Full Code Here


    }
  }

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

    // Restore sessions
    root = new SessionFilter(c, root);
View Full Code Here

    LOG.info("zkDataTransferServer starting on Port " + _localWebservicePort + " zkAddress " + _zkAddress);
   
    _component = new Component();
   
    _component.getServers().add(Protocol.HTTP, _localWebservicePort);
    Context applicationContext = _component.getContext().createChildContext();
    applicationContext.getAttributes().put(SERVER, this);
    applicationContext.getAttributes().put(PORT, "" + _localWebservicePort);
    ZkPropertyTransferApplication application = new ZkPropertyTransferApplication(
        applicationContext);
    // Attach the application to the component and start it
    _component.getDefaultHost().attach(application);
    _timer = new Timer(true);
View Full Code Here

    if(_component == null)
    {
      _zkClient = new ZkClient(_zkServerAddress,  ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer());
      _component =  new Component();
      _component.getServers().add(Protocol.HTTP, _helixAdminPort);
      Context applicationContext = _component.getContext().createChildContext();
      applicationContext.getAttributes().put(RestAdminApplication.ZKSERVERADDRESS, _zkServerAddress);
      applicationContext.getAttributes().put(RestAdminApplication.PORT, ""+_helixAdminPort);
      applicationContext.getAttributes().put(RestAdminApplication.ZKCLIENT, _zkClient);
      _adminApp = new RestAdminApplication(applicationContext);
      // Attach the application to the component and start it
      _component.getDefaultHost().attach(_adminApp);
      _component.start();
    }
View Full Code Here

   * @throws Exception
   */
  public static void main(String[] args) throws Exception
  {
    processCommandLineArgs(args);
    _context = new Context();
    MockEspressoService service = new MockEspressoService(_context);
    service.run();
   
  }
View Full Code Here

    public RestletProducer(RestletEndpoint endpoint) throws Exception {
        super(endpoint);
        this.throwException = endpoint.isThrowExceptionOnFailure();
        client = new Client(endpoint.getProtocol());
        client.setContext(new Context());
        client.setConnectTimeout(100);
        client.getContext().getParameters().add("socketTimeout", String.valueOf(endpoint.getSocketTimeout()));
        client.getContext().getParameters().add("socketConnectTimeoutMs", String.valueOf(endpoint.getSocketTimeout()));
    }
View Full Code Here

    public RestletProducer(RestletEndpoint endpoint) throws Exception {
        super(endpoint);
        this.throwException = endpoint.isThrowExceptionOnFailure();
        client = new Client(endpoint.getProtocol());
        client.setContext(new Context());
        client.getContext().getParameters().add("socketTimeout", String.valueOf(endpoint.getSocketTimeout()));
        client.getContext().getParameters().add("socketConnectTimeoutMs", String.valueOf(endpoint.getSocketTimeout()));
    }
View Full Code Here

                                + applicationClassName, e);
            }
        }

        if (application != null) {
            final Context applicationContext = application.getContext();

            // Copy all the servlet parameters into the context
            String initParam;

            // Copy all the Servlet component initialization parameters
            final javax.servlet.ServletConfig servletConfig = getServletConfig();
            for (final Enumeration<String> enum1 = servletConfig
                    .getInitParameterNames(); enum1.hasMoreElements();) {
                initParam = enum1.nextElement();
                applicationContext.getParameters().add(initParam,
                        servletConfig.getInitParameter(initParam));
            }

            // Copy all the Servlet application initialization parameters
            for (final Enumeration<String> enum1 = getServletContext()
                    .getInitParameterNames(); enum1.hasMoreElements();) {
                initParam = enum1.nextElement();
                applicationContext.getParameters().add(initParam,
                        getServletContext().getInitParameter(initParam));
            }
        }

        return application;
View Full Code Here

    @SuppressWarnings("unchecked")
    protected Component createComponent() {
        Component component = null;

        // Look for the Component XML configuration file.
        Client client = createWarClient(new Context(), getServletConfig());
        Response response = client.get("war:///WEB-INF/restlet.xml");
        if (response.getStatus().isSuccess() && response.isEntityAvailable()) {
            component = new Component(response.getEntity());
        }
View Full Code Here

     *
     * @return True if the Component is the default one, false otherwise.
     */
    private boolean isDefaultComponent() {
        // The Component is provided via an XML configuration file.
        Client client = createWarClient(new Context(), getServletConfig());
        Response response = client.get("war:///WEB-INF/restlet.xml");
        if (response.getStatus().isSuccess() && response.isEntityAvailable()) {
            return false;
        }

View Full Code Here

TOP

Related Classes of org.restlet.Context

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.