Examples of HttpResponseException


Examples of org.jclouds.http.HttpResponseException

   public void handleError(HttpCommand command, HttpResponse response) {
      // it is important to always read fully and close streams
      byte[] data = closeClientButKeepContentStream(response);
      String message = data != null ? new String(data) : null;

      Exception exception = message != null ? new HttpResponseException(command, response, message)
              : new HttpResponseException(command, response);
      message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
              response.getStatusLine());
      switch (response.getStatusCode()) {
         case 400:
            break;
View Full Code Here

Examples of org.jclouds.http.HttpResponseException

      this.errorParser = errorParser;
   }

   public void handleError(HttpCommand command, HttpResponse response) {
      String message = errorParser.apply(response);
      Exception exception = new HttpResponseException(command, response, message);
      try {
         message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
               response.getStatusLine());
         switch (response.getStatusCode()) {
            case 401:
View Full Code Here

Examples of org.kohsuke.stapler.HttpResponses.HttpResponseException

     *
     * @param destination
     *      The page that the user will be taken to upon a successful submission (in case this is not via the "apply" button.)
     */
    public static HttpResponseException success(final String destination) {
        return new HttpResponseException() {
            public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException {
                if (isApply(req)) {
                    // if the submission is via 'apply', show a response in the notification bar
                    applyResponse("notificationBar.show('"+Messages.HttpResponses_Saved()+"',notificationBar.OK)")
                            .generateResponse(req,rsp,node);
View Full Code Here

Examples of org.kohsuke.stapler.HttpResponses.HttpResponseException

     * <p>
     * When the response HTML includes a JavaScript function in a pre-determined name, that function gets executed.
     * This method generates such a response from JavaScript text.
     */
    public static HttpResponseException applyResponse(final String script) {
        return new HttpResponseException() {
            public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException {
                rsp.setContentType("text/html;charset=UTF-8");
                rsp.getWriter().println("<html><body><script>" +
                        "window.applyCompletionHandler = function (w) {" +
                        "  with(w) {" +
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.