Tabnine Logo
Response$Content
Code IndexAdd Tabnine to your IDE (free)

How to use
Response$Content
in
juzu

Best Java code snippets using juzu.Response$Content (Showing top 20 results out of 315)

origin: org.juzu/juzu-core

public Status asStatus(boolean verbose) {
 Response.Status response = Response.status(getStatus());
 if (verbose) {
  StringBuilder buffer = new StringBuilder();
  Formatting.renderStyleSheet(buffer);
  buffer.append("<div class=\"juzu\">");
  buffer.append("<h1>Oups something went wrong</h1>");
  // Use getCause as it can be overriden with subclasses
  Throwable c = getCause();
  if (c != null) {
   Formatting.renderThrowable(null, buffer, c);
  } else {
   // Use getMessage as it can be overriden with subclasses
   String m = getHtmlMessage();
   buffer.append(m);
  }
  buffer.append("</div>");
  response = response.content(buffer).withMimeType("text/html");
 }
 return response;
}
origin: exoplatform/platform

 return Response.ok(result.toString()).with(PropertyType.MIME_TYPE, "application/json");
} else {
 if (file != null && file.getContentType().contains("png")) {
origin: exoplatform/platform

set("eventsDisplayedList", eventsDisplayedList).
set("tasksDisplayedList", tasksDisplayedList).
set("date_act", dateLabel).ok().withCharset(Tools.UTF_8);
origin: exoplatform/platform

parameters.put(GettingStartedUtils.SHOW, Isshow.toString());
if ((isChange) || ("true".equals(reload))) {
  return gettingStartedList.ok(parameters).withCharset(Tools.UTF_8);
origin: juzu/juzu

result = new Response.Content(status.getCode(), wrapper);
origin: org.juzu/juzu-core

result = new Response.Content(status.getCode(), wrapper);
origin: exoplatform/platform

return Response.ok(result.toString()).with(PropertyType.MIME_TYPE, "application/json");
origin: exoplatform/platform

/**
 * return the object data contains the url of logo and the bar navigation
 * 
 * @param httpContext
 * @return Resource
 */
@Ajax
@Resource
public Response.Content getResource(HttpContext httpContext) {
 JSONObject json = new JSONObject();
 String style = "Dark";
 if (settingService.get(Context.GLOBAL, Scope.GLOBAL, BAR_NAVIGATION_STYLE_KEY) != null) {
  style = (String) settingService.get(Context.GLOBAL, Scope.GLOBAL, BAR_NAVIGATION_STYLE_KEY)
                  .getValue();
 }
 try {
  json.put("error", "0");
  json.put("style", style);
  json.put("logoUrl", getLogoUrl(httpContext, true));
 } catch (JSONException ex) {
  if (LOG.isErrorEnabled()) {
   LOG.error("Can not put json value", ex);
  }
 }
 return Response.ok(json.toString()).with(PropertyType.MIME_TYPE, "application/json");
}
origin: juzu/juzu

 @Override
 public Response handle(Stage.Unmarshalling argument) {
  Response result = argument.invoke();
  Request request = argument.getRequest();
  if (request.getPhase() == Phase.VIEW) {
   if (result instanceof Response.Content) {
    final Collection<Chunk.Property<String>> bar = foo(request.getHandler().getMethod(), Collections.<Chunk.Property<String>>emptyList());
    Response.Status status = (Response.Status)result;
    if ((bar.size() > 0)) {
     status = new Response.Content(status.getCode(), new StreamableDecorator(status.streamable()) {
      @Override
      protected void sendHeader(Stream consumer) {
       for (Chunk.Property<String> asset : bar) {
        consumer.provide(asset);
       }
      }
     });
     result = status;
    }
   }
  }
  return result;
 }
}
origin: exoplatform/platform

@Ajax
@Resource
public Response.Content setting() throws Exception {
  calendarDisplayedList.clear();
  calendarNonDisplayedList.clear();
  String username = RequestContext.getCurrentInstance().getRemoteUser();
  String defaultCalendarLabel = "Default";
  Iterator itr1 = getAllCal(username).iterator();
  while (itr1.hasNext()) {
    org.exoplatform.calendar.service.Calendar c = (org.exoplatform.calendar.service.Calendar) itr1.next();
    if(c.getGroups()==null) {
      if (c.getId().equals(Utils.getDefaultCalendarId(username)) && c.getName().equals(calendarService_.getDefaultCalendarName())) {
        c.setName(defaultCalendarLabel);
      }
    }
    if (CalendarPortletUtils.contains(nonDisplayedCalendarList, c.getId())) {
      calendarNonDisplayedList.add(c);
    } else {
      calendarDisplayedList.add(c);
    }
  }
  return setting.with().set("displayedCalendar", calendarDisplayedList).
      set("nonDisplayedCalendar", calendarNonDisplayedList).ok().withCharset(Tools.UTF_8);
}
origin: org.juzu/juzu-core

 @Override
 public Response handle(Stage.Unmarshalling argument) {
  Response result = argument.invoke();
  Request request = argument.getRequest();
  if (request.getPhase() == Phase.VIEW) {
   if (result instanceof Response.Content) {
    final Collection<Chunk.Property<String>> bar = foo(request.getHandler().getMethod(), Collections.<Chunk.Property<String>>emptyList());
    Response.Status status = (Response.Status)result;
    if ((bar.size() > 0)) {
     status = new Response.Content(status.getCode(), new StreamableDecorator(status.streamable()) {
      @Override
      protected void sendHeader(Stream consumer) {
       for (Chunk.Property<String> asset : bar) {
        consumer.provide(asset);
       }
      }
     });
     result = status;
    }
   }
  }
  return result;
 }
}
origin: juzu/juzu

/**
 * Parse the header into an {@link Element} and set it on the response as an header tag. This method
 * expects well formed XML, the parsed Element will be translated into markup according to the
 * response content type when the response will be written to the document.
 *
 * @param header the header string to parse
 * @return this object
 * @throws ParserConfigurationException any ParserConfigurationException
 * @throws SAXException any SAXException
 */
public Content withHeaderTag(String header) throws ParserConfigurationException, SAXException {
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 DocumentBuilder builder = dbf.newDocumentBuilder();
 try {
  Document doc = builder.parse(new InputSource(new StringReader(header)));
  Element elt =  doc.getDocumentElement();
  return withHeaderTag(elt);
 }
 catch (IOException e) {
  // Let's save user from IOException at least
  throw new UndeclaredIOException(e);
 }
}
origin: org.juzu/juzu-core

/**
 * Parse the header into an {@link Element} and set it on the response as an header tag. This method
 * expects well formed XML, the parsed Element will be translated into markup according to the
 * response content type when the response will be written to the document.
 *
 * @param header the header string to parse
 * @return this object
 * @throws ParserConfigurationException any ParserConfigurationException
 * @throws SAXException any SAXException
 */
public Content withHeaderTag(String header) throws ParserConfigurationException, SAXException {
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 DocumentBuilder builder = dbf.newDocumentBuilder();
 try {
  Document doc = builder.parse(new InputSource(new StringReader(header)));
  Element elt =  doc.getDocumentElement();
  return withHeaderTag(elt);
 }
 catch (IOException e) {
  // Let's save user from IOException at least
  throw new UndeclaredIOException(e);
 }
}
origin: juzu/juzu

public Status asStatus(boolean verbose) {
 Response.Status response = Response.status(getStatus());
 if (verbose) {
  StringBuilder buffer = new StringBuilder();
  Formatting.renderStyleSheet(buffer);
  buffer.append("<div class=\"juzu\">");
  buffer.append("<h1>Oups something went wrong</h1>");
  // Use getCause as it can be overriden with subclasses
  Throwable c = getCause();
  if (c != null) {
   Formatting.renderThrowable(null, buffer, c);
  } else {
   // Use getMessage as it can be overriden with subclasses
   String m = getHtmlMessage();
   buffer.append(m);
  }
  buffer.append("</div>");
  response = response.content(buffer).withMimeType("text/html");
 }
 return response;
}
origin: exoplatform/platform

@Ajax
@Resource
public Response saveSender(String name, String email) {
 JSON data = new JSON();
 data.set("name", name);
 data.set("email",email);
 if(name != null && name.length() > 0 && NotificationUtils.isValidEmailAddresses(email)) {
  settingService.set(org.exoplatform.commons.api.settings.data.Context.GLOBAL, Scope.GLOBAL,
            NotificationPluginUtils.NOTIFICATION_SENDER_NAME, SettingValue.create(name));
  settingService.set(org.exoplatform.commons.api.settings.data.Context.GLOBAL, Scope.GLOBAL,
            NotificationPluginUtils.NOTIFICATION_SENDER_EMAIL, SettingValue.create(email));
  data.set("status","OK");
 } else {
  data.set("status","NOK");
 }
 return Response.ok(data.toString()).withMimeType("application/json");
}
origin: exoplatform/platform

@Ajax
@Resource
public Response saveActivePlugin(String pluginId, String inputs) {
 JSON data = new JSON();
 try {
  Map<String, String> datas = parserParams(inputs);
  for (String channelId : datas.keySet()) {
   pluginSettingService.saveActivePlugin(channelId, pluginId, Boolean.valueOf(datas.get(channelId)));
  }
  data.set("status", "ok");
  data.set("result", datas);
 } catch (Exception e) {
  LOG.error("Failed to save settings", e);
  data.set("status", "false");
  data.set("error", "Exception: " + e.getMessage());
 }
 return Response.ok(data.toString()).withMimeType("application/json");
}

origin: juzu/juzu

public Content content(Streamable s) {
 return new Content(code, properties, s);
}
origin: juzu/juzu

public Content withTitle(String title) {
 return with(PropertyType.TITLE, title);
}
origin: org.juzu/juzu-core

public Content withTitle(String title) {
 return with(PropertyType.TITLE, title);
}
origin: org.juzu/juzu-core

public static Content content(int code, Streamable content) {
 return new Content(code, content);
}
juzuResponse$Content

Most used methods

  • withMimeType
  • with
  • <init>
  • withCharset
  • withHeader
  • withHeaderTag
    Set the provided element on the response as an HTML header.

Popular in Java

  • Making http requests using okhttp
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • startActivity (Activity)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now