Created
July 31, 2013 06:19
-
-
Save chkal/6119756 to your computer and use it in GitHub Desktop.
Simple Servlet to control Togglz features using GET requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@WebServlet(urlPatterns = "/FeatureServlet") | |
public class FeatureServlet extends HttpServlet { | |
private static final long serialVersionUID = 1L; | |
@Override | |
protected void doGet( HttpServletRequest req, HttpServletResponse resp ) throws ServletException, IOException { | |
Feature feature = new NamedFeature( req.getParameter( "feature" ) ); | |
boolean enabled = "on".equals( req.getParameter( "state" ) ); | |
FeatureState state = new FeatureState( feature ) | |
.setEnabled( enabled ); | |
FeatureContext.getFeatureManager().setFeatureState( state ); | |
resp.getOutputStream().println( "OK" ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment