Package org.kohsuke.stapler

Examples of org.kohsuke.stapler.StaplerRequest


     * @param servletHandler
     *      Instance of Rack::Handler::Servlet which wraps the actual rack application and provides
     *      the ruby part of the rack implementation.
     */
    public void rack(IRubyObject servletHandler) {
        final StaplerRequest req = Stapler.getCurrentRequest();
        // we don't want the Rack app to consider the portion of the URL that was already consumed
        // to reach to the Rack app, so for PATH_INFO we use getRestOfPath(), not getPathInfo()
        ServletRackEnvironment env = new ServletRackEnvironment(req, rackContext) {
            @Override
            public String getPathInfo() {
                return req.getRestOfPath();
            }
        };
        DefaultRackApplication dra = new DefaultRackApplication();
        dra.setApplication(servletHandler);
        dra.call(env)
View Full Code Here


            return compareAsStandardDate(userValue.toString());
        } catch (ParseException e) {
            //didn't work, move on
        }
        Locale locale;
        StaplerRequest currentRequest = Stapler.getCurrentRequest();
        if (currentRequest != null) {
            locale = currentRequest.getLocale();
        //If no locale could be found, try to use the System locale.
        } else {
            String property = System.getProperty("user.language");
            locale = new Locale(property);
        }
View Full Code Here

        serveRequest(new BridgeRepository(null), req.getContextPath()+"/plugin/repository");
    }

    public void serveRequest(IDavRepo repo, String root) {
        StaplerRequest req = Stapler.getCurrentRequest();
        StaplerResponse rsp = Stapler.getCurrentResponse();
        try
        {
            if (repo.getMimeTypeResolver() == null)
            {
                ServletContextMimeTypeResolver ctx = new ServletContextMimeTypeResolver();
                ctx.setServletContext(req.getSession().getServletContext());
                repo.setMimeTypeResolver(ctx);
            }
            IMethod method = methodFactory.createMethod(req, rsp);
            method.init(req, rsp, null, repo, root);
            method.invoke();
View Full Code Here

     * Configure the SVN workspace format - i.e. the format of the local workspace copy.
     *
     * @param format one of the WC constants form SVNAdminAreaFactory or SubversionWorkspaceSelector.WC_FORMAT_17
     */
    protected void configureSvnWorkspaceFormat(int format) throws Exception {
      StaplerRequest req = mock(StaplerRequest.class);
      when(req.getParameter("svn.workspaceFormat")).thenReturn(""+format);
     
      JSONObject formData = new JSONObject();
     
      this.descriptor.configure(req, formData);
    }
View Full Code Here

        super(project, buildDir);
    }

    @Override
    public String getUpUrl() {
        StaplerRequest req = Stapler.getCurrentRequest();
        if (req != null) {
            List<Ancestor> ancs = req.getAncestors();
            for (int i = 1; i < ancs.size(); i++) {
                if (ancs.get(i).getObject() == this) {
                    if (ancs.get(i - 1).getObject() instanceof IvyModuleSetBuild) {
                        // if under IvyModuleSetBuild, "up" means IMSB
                        return ancs.get(i - 1).getUrl() + '/';
View Full Code Here

        return super.getUpUrl();
    }

    @Override
    public String getDisplayName() {
        StaplerRequest req = Stapler.getCurrentRequest();
        if (req != null) {
            List<Ancestor> ancs = req.getAncestors();
            for (int i = 1; i < ancs.size(); i++) {
                if (ancs.get(i).getObject() == this) {
                    if (ancs.get(i - 1).getObject() instanceof IvyModuleSetBuild) {
                        // if under IvyModuleSetBuild, display the module name
                        return getParent().getDisplayName();
View Full Code Here

    }

    public String name() {
        ItemGroup ig = null;

        StaplerRequest request = Stapler.getCurrentRequest();
        for( Ancestor a : request.getAncestors() ) {
            if(a.getObject() instanceof BuildMonitorView) {
                ig = ((View) a.getObject()).getOwnerItemGroup();
            }
        }
View Full Code Here

    private final String url;

    public POSTHyperlinkNote(String url, int length) {
        super("#", length);
        if (url.startsWith("/")) {
            StaplerRequest req = Stapler.getCurrentRequest();
            if (req != null) {
                url = req.getContextPath() + url;
            } else {
                Jenkins j = Jenkins.getInstance();
                if (j != null) {
                    String rootUrl = j.getRootUrl();
                    if (rootUrl != null) {
View Full Code Here

        this(script, false);
    }

    @DataBoundConstructor
    public CpsFlowDefinition(String script, boolean sandbox) {
        StaplerRequest req = Stapler.getCurrentRequest();
        this.script = sandbox ? script : ScriptApproval.get().configuring(script, GroovyLanguage.get(), ApprovalContext.create().withCurrentUser().withItemAsKey(req != null ? req.findAncestorObject(Item.class) : null));
        this.sandbox = sandbox;
    }
View Full Code Here

        throw new IllegalStateException();
    }

    @JellyAccessible
    public String getRootPath() {
        StaplerRequest req = Stapler.getCurrentRequest();
        checkState(req != null, "StaplerRequest not bound");
        return req.getContextPath();
    }
View Full Code Here

TOP

Related Classes of org.kohsuke.stapler.StaplerRequest

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.