org.apache.tiles.request.Request类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(422)

本文整理了Java中org.apache.tiles.request.Request类的一些代码示例,展示了Request类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request类的具体详情如下:
包路径:org.apache.tiles.request.Request
类名称:Request

Request介绍

[英]Encapsulation of request information.
[中]请求信息的封装。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public ViewPreparer getPreparer(String name, Request context) {
  WebApplicationContext webApplicationContext = (WebApplicationContext) context.getContext("request").get(
      DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE);
  if (webApplicationContext == null) {
    webApplicationContext = (WebApplicationContext) context.getContext("application").get(
        WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
    if (webApplicationContext == null) {
      throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?");
    }
  }
  return getPreparer(name, webApplicationContext);
}

代码示例来源:origin: org.apache.tiles/tiles-ognl

@Override
public String getSourceAccessor(OgnlContext context, Object target,
    Object index) {
  Request request = (Request) target;
  String attributeName = (String) index;
  for (String scopeName : request.getAvailableScopes()) {
    Map<String, Object> scope = request.getContext(scopeName);
    if (scope.containsKey(attributeName)) {
      return ".getContext(\"" + scopeName + "\").get(index)";
    }
  }
  return null;
}

代码示例来源:origin: org.springframework.webflow/spring-webflow

ApplicationContext tilesAppContext = tilesRequest.getApplicationContext();
BasicTilesContainer container = (BasicTilesContainer) TilesAccess.getContainer(tilesAppContext);
  tilesRequest.getContext("request").put(ServletRequest.FORCE_INCLUDE_ATTRIBUTE_NAME, true);

代码示例来源:origin: org.apache.tiles/tiles-core

/** {@inheritDoc} */
  public Locale resolveLocale(Request request) {
    Locale retValue = null;
    Map<String, Object> session = request.getContext("session");
    if (session != null) {
      retValue = (Locale) session.get(DefaultLocaleResolver.LOCALE_KEY);
    }
    if (retValue == null) {
      retValue = request.getRequestLocale();
    }

    return retValue;
  }
}

代码示例来源:origin: org.apache.tiles/tiles-ognl

/** {@inheritDoc} */
  public ApplicationContext getNestedObject(Request obj) {
    return obj.getApplicationContext();
  }
}

代码示例来源:origin: org.apache.tiles/tiles-request-api

/** {@inheritDoc} */
public Writer getWriter() throws IOException {
  return context.getWriter();
}

代码示例来源:origin: org.apache.tiles/tiles-request-api

/** {@inheritDoc} */
  public List<String> getAvailableScopes() {
    return context.getAvailableScopes();
  }
}

代码示例来源:origin: stackoverflow.com

try
  nTime12 = Integer.parseInt(request.getParam("hour12"));
  if( nTime12 <= 0 || nTime12 > 12 )
try
  pm = AMPM.lookup(request.getParam("pm"));

代码示例来源:origin: org.apache.tiles/tiles-ognl

@Override
public Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name) {
  Request request = (Request) target;
  String attributeName = (String) name;
  for (String scopeName : request.getAvailableScopes()) {
    Map<String, Object> scope = request.getContext(scopeName);
    if (scope.containsKey(attributeName)) {
      return scope.get(attributeName);
    }
  }
  return null;
}

代码示例来源:origin: org.apache.tiles/tiles-api

/**
   * Returns the current container that has been set, or the default one.
   *
   * @param request The request to use.
   * @return The current Tiles container to use in web pages.
   * @since 2.1.0
   */
  public static TilesContainer getCurrentContainer(Request request) {
    ApplicationContext context = request.getApplicationContext();
    Map<String, Object> requestScope = request.getContext("request");
    TilesContainer container = (TilesContainer) requestScope.get(CURRENT_CONTAINER_ATTRIBUTE_NAME);
    if (container == null) {
      container = getContainer(context);
      requestScope.put(CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
    }

    return container;
  }
}

代码示例来源:origin: org.apache.tiles/tiles-request-api

/** {@inheritDoc} */
public ApplicationContext getApplicationContext() {
  return context.getApplicationContext();
}

代码示例来源:origin: org.apache.tiles/tiles-test-common

/** {@inheritDoc} */
@Override
public void render(String value, Request request) throws IOException {
  char[] array = value.toCharArray();
  char[] newArray = new char[array.length];
  for (int i = 0; i < array.length; i++) {
    newArray[array.length - i - 1] = array[i];
  }
  request.getWriter().write(String.valueOf(newArray));
}

代码示例来源:origin: org.apache.tiles/tiles-el

/** {@inheritDoc} */
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
    Object base) {
  if (base != null) {
    List<FeatureDescriptor> retValue = Collections.emptyList();
    return retValue.iterator();
  }
  List<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>();
  Request request = (Request) context
      .getContext(Request.class);
  for (String scope : request.getAvailableScopes()) {
    FeatureDescriptor descriptor = new FeatureDescriptor();
    descriptor.setDisplayName(scope + "Scope");
    descriptor.setExpert(false);
    descriptor.setHidden(false);
    descriptor.setName(scope + "Scope");
    descriptor.setPreferred(true);
    descriptor.setShortDescription("");
    descriptor.setValue("type", Map.class);
    descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE);
    list.add(descriptor);
  }
  return list.iterator();
}

代码示例来源:origin: org.apache.tiles/tiles-request-api

/** {@inheritDoc} */
public Map<String, String> getParam() {
  return context.getParam();
}

代码示例来源:origin: org.springframework/spring-webmvc

@Override
public ViewPreparer getPreparer(String name, Request context) {
  WebApplicationContext webApplicationContext = (WebApplicationContext) context.getContext("request").get(
      DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE);
  if (webApplicationContext == null) {
    webApplicationContext = (WebApplicationContext) context.getContext("application").get(
        WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
    if (webApplicationContext == null) {
      throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?");
    }
  }
  return getPreparer(name, webApplicationContext);
}

代码示例来源:origin: org.apache.tiles/tiles-ognl

@Override
public String getSourceSetter(OgnlContext context, Object target,
    Object index) {
  Request request = (Request) target;
  String attributeName = (String) index;
  String[] availableScopes = request.getAvailableScopes().toArray(new String[0]);
  for (String scopeName : availableScopes) {
    Map<String, Object> scope = request.getContext(scopeName);
    if (scope.containsKey(attributeName)) {
      return ".getContext(\"" + scopeName + "\").put(index, target)";
    }
  }
  return ".getContext(\"" + availableScopes[0] + "\").put(index, target)";
}

代码示例来源:origin: org.apache.tiles/tiles-api

/**
 * Sets the current container to use in web pages.
 *
 * @param request The request to use.
 * @param key The key under which the container is stored.
 * @since 2.1.0
 */
public static void setCurrentContainer(Request request,
    String key) {
  ApplicationContext applicationContext = request.getApplicationContext();
  TilesContainer container = getContainer(applicationContext, key);
  if (container != null) {
    request.getContext("request").put(CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
  } else {
    throw new NoSuchContainerException("The container with the key '"
        + key + "' cannot be found");
  }
}

代码示例来源:origin: org.apache.tiles/tiles-el

/** {@inheritDoc} */
  public Object evaluate(String expression, Request request) {
    ELContextImpl context = new ELContextImpl(resolver);
    context.putContext(Request.class, request);
    context.putContext(ApplicationContext.class,
        request.getApplicationContext());
    ValueExpression valueExpression = expressionFactory
        .createValueExpression(context, expression, Object.class);

    return valueExpression.getValue(context);
  }
}

代码示例来源:origin: org.apache.tiles/tiles-request-api

/** {@inheritDoc} */
@Override
public void render(String value, Request request) throws IOException {
  if (value == null) {
    throw new CannotRenderException("Cannot render a null string");
  }
  request.getWriter().write(value);
}

代码示例来源:origin: org.apache.tiles/tiles-request-api

/** {@inheritDoc} */
public Map<String, Object> getContext(String scope) {
  return context.getContext(scope);
}

相关文章