Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7645275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:53:59+00:00 2026-05-31T09:53:59+00:00

Where can I embed startup initialization code in a Restlet web application, without using

  • 0

Where can I embed startup initialization code in a Restlet web application, without using a ServletContextListener?

I wish to have transparent deployment of my Restlet to a web server like JBoss/Tomcat and would like to get rid of the initialization logic in the Listener – so as to be able to conveniently deploy it outside of a web server, if the need be – definitely not for heavy production use, but it’s valuable nevertheless.

Would inserting it into org.restlet.Component‘s constructor ensure that it’ll only execute once? Is that the right place to put it?

public class MyComponent extends org.restlet.Component
{
  public MyComponent() //constructor
  {
    //insert initialization code here that should run ONLY ONCE?

    this.getDefaultHost().attach(new MyApplication()); // MyApplication extends org.restlet.Application
  }
}

I went through the docs and also looked at a similar post: RESTlet startup initialization deprecated? but I’m still not sure if it’s the right way. I would like to remove the dependency on the Listener if at all possible.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T09:54:00+00:00Added an answer on May 31, 2026 at 9:54 am

    Using the constructor of the Component is a good place for initialization processing and you can be sure that such processing are only executed once.

    You can notice that the method start / stop of the component can also be used in your case. Don’t forget to call the super method in them. These methods are called when you start / stop your component that is commonly done once…

    Hope it helps you.
    Thierry

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to write a PHP code (using public id) that can embed into HTML
Can I embed the following bash shell code: for name in $(git diff --name-only
How can I embed a CR + LF in a command I'm using at
how can I set embed parameters for html wrapper using Flex Builder ? For
I'm trying to find some javascript code that I can embed on my website
I have looked for months now, for JavaScript-based HTML editor I can embed onto
Somebody talking the python's code can embed into C#'s code. What the mechanism to
Using .NET (Windows), you can embed an ActiveX Flash player into a Windows form,
Is there a way (using html/jquery) I can embed radio buttons in the options
Using h:outputStylesheet I can embed CSS resources in the HTML head section, but how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.