当前位置: 首页>>代码示例>>Java>>正文


Java Results类代码示例

本文整理汇总了Java中org.jooby.Results的典型用法代码示例。如果您正苦于以下问题:Java Results类的具体用法?Java Results怎么用?Java Results使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Results类属于org.jooby包,在下文中一共展示了Results类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doUpdateEventTypePerAccount

import org.jooby.Results; //导入依赖的package包/类
public static Result doUpdateEventTypePerAccount(final ConfigurationDao dao, final UUID kbAccountId,
                                                 final UUID kbTenantId, final List<ExtBusEventType> eventTypes,
                                                 final DateTime utcNow)
{
    logger.debug(String.format("Enters update event types per account %s",kbAccountId));

    if (kbTenantId == null)
    {
        return Results.with("No tenant specified",Status.NOT_FOUND);
    }
    if (kbAccountId == null)
    {
        return Results.with("No account specified",Status.NOT_FOUND);
    }

    try {
        dao.updateConfigurationPerAccount(kbAccountId,kbTenantId,eventTypes,utcNow);
    } catch (SQLException e) {
        logger.error(e.getMessage());
        return Results.with(e.getMessage(), Status.SERVER_ERROR);
    }

    return Results.with(Status.CREATED);
}
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:25,代码来源:EmailNotificationService.java

示例2: download

import org.jooby.Results; //导入依赖的package包/类
@Override
public void download(final String filename, final String location) throws Throwable {
  URL url = getClass().getResource(location.startsWith("/") ? location : "/" + location);
  if (url == null) {
    throw new FileNotFoundException(location);
  }
  // handle type
  type(type().orElseGet(() -> MediaType.byPath(filename).orElse(MediaType.byPath(location)
      .orElse(MediaType.octetstream))));

  URLAsset asset = new URLAsset(url, location, type().get());
  length(asset.length());

  contentDisposition(filename);
  send(Results.with(asset));
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:17,代码来源:ResponseImpl.java

示例3: getEventTypes

import org.jooby.Results; //导入依赖的package包/类
public static Result getEventTypes(final ConfigurationDao dao, final List<UUID> kbAccountId, final UUID kbTenantId)
{
    logger.debug(String.format("Enters get event types for %s accounts - %s",kbAccountId.size(),kbTenantId));

    List<EmailNotificationsConfiguration> eventTypes = null;
    try {
        eventTypes = dao.getEventTypes(kbAccountId, kbTenantId);
    } catch (SQLException e) {
        logger.error(e.getMessage());
        return Results.with(e.getMessage(), Status.SERVER_ERROR);
    }

    return eventTypes == null  || eventTypes.size() == 0? Results.with(Status.NOT_FOUND) : Results.json(eventTypes);
}
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:15,代码来源:EmailNotificationService.java

示例4: getEventTypesPerAccount

import org.jooby.Results; //导入依赖的package包/类
public static Result getEventTypesPerAccount(final ConfigurationDao dao, final UUID kbAccountId, final UUID kbTenantId)
{
    logger.debug(String.format("Enters get event types %s - %s",kbAccountId,kbTenantId));

    List<EmailNotificationsConfiguration> eventTypes = null;
    try {
        eventTypes = dao.getEventTypesPerAccount(kbAccountId, kbTenantId);
    } catch (SQLException e) {
        logger.error(e.getMessage());
        return Results.with(e.getMessage(), Status.SERVER_ERROR);
    }

    return eventTypes == null  || eventTypes.size() == 0? Results.with(Status.NOT_FOUND) : Results.json(eventTypes);
}
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:15,代码来源:EmailNotificationService.java

示例5: getEventTypePerAccount

import org.jooby.Results; //导入依赖的package包/类
public static Result getEventTypePerAccount(final ConfigurationDao dao, final UUID kbAccountId, final UUID kbTenantId, final ExtBusEventType eventType )
{
    logger.debug(String.format("Enters get event type %s - %s",kbAccountId,kbTenantId));

    EmailNotificationsConfiguration eventTypeRsp = null;
    try {
        eventTypeRsp = dao.getEventTypePerAccount(kbAccountId, kbTenantId, eventType);
    } catch (SQLException e) {
        logger.error(e.getMessage());
        return Results.with(e.getMessage(), Status.SERVER_ERROR);
    }

    return eventTypeRsp == null ? Results.with(Status.NOT_FOUND) : Results.json(eventTypeRsp);
}
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:15,代码来源:EmailNotificationService.java

示例6: commitTransaction

import org.jooby.Results; //导入依赖的package包/类
@Test
public void commitTransaction() throws Exception {
  new MockUnit(Handle.class, Request.class, Response.class)
      .expect(isInTransaction(true))
      .expect(unit -> {
        Handle handle = unit.get(Handle.class);
        expect(handle.commit()).andReturn(handle);
      })
      .run(unit -> {
        new CommitTransaction(unit.get(Handle.class))
            .handle(unit.get(Request.class), unit.get(Response.class), Results.ok());
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:14,代码来源:CommitTransactionTest.java

示例7: inactiveTransaction

import org.jooby.Results; //导入依赖的package包/类
@Test
public void inactiveTransaction() throws Exception {
  new MockUnit(Handle.class, Request.class, Response.class)
      .expect(isInTransaction(false))
      .run(unit -> {
        new CommitTransaction(unit.get(Handle.class))
            .handle(unit.get(Request.class), unit.get(Response.class), Results.ok());
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:10,代码来源:CommitTransactionTest.java

示例8: end

import org.jooby.Results; //导入依赖的package包/类
@Override
public void end(final ShellResponse response) {
  Status status = Status.SERVER_ERROR;
  if (response instanceof ShellResponse.Ok) {
    status = Status.OK;
  } else if (response instanceof ShellResponse.UnknownCommand) {
    status = Status.BAD_REQUEST;
  }
  deferred.accept(Results.with(buff.length() == 0 ? response.getMessage() : buff, status));
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:11,代码来源:SimpleProcessContext.java

示例9: redirect

import org.jooby.Results; //导入依赖的package包/类
@Override
public void redirect(final Status status, final String location) throws Throwable {
  requireNonNull(status, "Status required.");
  requireNonNull(location, "Location required.");

  send(Results.with(status).header(LOCATION, location));
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:8,代码来源:ResponseImpl.java

示例10: norenderer

import org.jooby.Results; //导入依赖的package包/类
@Test(expected = Err.class)
public void norenderer() throws Throwable {
  List<Renderer> renderers = new ArrayList<>();
  List<MediaType> produces = ImmutableList.of(MediaType.json);
  View value = Results.html("view");
  new MockUnit()
      .run(unit -> {
        new AbstractRendererContext(renderers, produces, StandardCharsets.UTF_8, Locale.US,
            Collections.emptyMap()) {

          @Override
          protected void _send(final byte[] bytes) throws Exception {
          }

          @Override
          protected void _send(final ByteBuffer buffer) throws Exception {
          }

          @Override
          protected void _send(final FileChannel file) throws Exception {
          }

          @Override
          protected void _send(final InputStream stream) throws Exception {
          }

        }.render(value);
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:30,代码来源:AbstractRendererContextTest.java

示例11: renderIgnored

import org.jooby.Results; //导入依赖的package包/类
@Test
public void renderIgnored() throws Exception {
  new MockUnit(Renderer.Context.class)
      .run(unit -> {
        BuiltinRenderer.text
            .render(Results.html("v"), unit.get(Renderer.Context.class));
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:9,代码来源:ToStringRendererTest.java

示例12: isListening

import org.jooby.Results; //导入依赖的package包/类
@GET
@Path("/")
public Result isListening() {
    logger.debug("Acknowledge from email notification plugin!!!, I am active and listening");
    return Results.ok();
}
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:7,代码来源:EmailNotificationServlet.java

示例13: getEventsToConsider

import org.jooby.Results; //导入依赖的package包/类
@GET
@Path("/eventsToConsider")
public Result getEventsToConsider()
{
    return Results.json(EmailNotificationListener.EVENTS_TO_CONSIDER);
}
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:7,代码来源:EmailNotificationServlet.java

示例14: install

import org.jooby.Results; //导入依赖的package包/类
static void install(final Env env, final Config conf) {
  Router routes = env.router();
  String path = conf.getString("crash.webshell.path");
  String title = conf.getString("application.name") + " shell";
  routes.assets(path + "/css/**", "META-INF/resources/css/{0}");
  routes.assets(path + "/js/**", "META-INF/resources/js/{0}");
  String rootpath = Route.normalize(conf.getString("application.path") + path);

  routes.get(path, req -> Results.ok("<!DOCTYPE HTML>\n" +
      "<html>\n" +
      "<head>\n" +
      "    <meta charset=\"utf-8\" />\n" +
      "    <title>" + title + "</title>\n" +
      "    <script src=\"" + rootpath + "/js/jquery-1.7.1.min.js\"></script>\n" +
      "    <script src=\"" + rootpath + "/js/jquery.mousewheel-min.js\"></script>\n" +
      "    <script src=\"" + rootpath + "/js/jquery.terminal-0.7.12.js\"></script>\n" +
      "    <script src=\"" + rootpath + "/js/crash.js\"></script>\n" +
      "    <link href=\"" + rootpath + "/css/jquery.terminal.css\" rel=\"stylesheet\"/>\n" +
      "</head>\n" +
      "<body>\n" +
      "\n" +
      "<script>\n" +
      "\n" +
      "  //\n" +
      "  $(function() {\n" +
      "    // Create web socket url\n" +
      "    var protocol;\n" +
      "    if (window.location.protocol == 'http:') {\n" +
      "      protocol = 'ws';\n" +
      "    } else {\n" +
      "      protocol = 'wss';\n" +
      "    }\n" +
      "    var url = protocol + '://' + window.location.host + '" + rootpath + "';\n" +
      "    var crash = new CRaSH($('#shell'));\n" +
      "    crash.connect(url);\n" +
      "  });\n" +
      "\n" +
      "</script>\n" +
      "\n" +
      "  <div id=\"shell\"></div>\n" +
      "\n" +
      "</body>\n" +
      "</html>").type(MediaType.html));

  routes.ws(path, new WebShellHandler()).consumes(MediaType.json).produces(MediaType.json);
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:47,代码来源:WebShellPlugin.java

示例15: wrap

import org.jooby.Results; //导入依赖的package包/类
private Result wrap(final Object value) {
  if (value instanceof Result) {
    return (Result) value;
  }
  return Results.with(value);
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:7,代码来源:MockRouter.java


注:本文中的org.jooby.Results类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。