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

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

本文整理了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

  1. @Override
  2. public ViewPreparer getPreparer(String name, Request context) {
  3. WebApplicationContext webApplicationContext = (WebApplicationContext) context.getContext("request").get(
  4. DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE);
  5. if (webApplicationContext == null) {
  6. webApplicationContext = (WebApplicationContext) context.getContext("application").get(
  7. WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
  8. if (webApplicationContext == null) {
  9. throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?");
  10. }
  11. }
  12. return getPreparer(name, webApplicationContext);
  13. }

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

  1. @Override
  2. public String getSourceAccessor(OgnlContext context, Object target,
  3. Object index) {
  4. Request request = (Request) target;
  5. String attributeName = (String) index;
  6. for (String scopeName : request.getAvailableScopes()) {
  7. Map<String, Object> scope = request.getContext(scopeName);
  8. if (scope.containsKey(attributeName)) {
  9. return ".getContext(\"" + scopeName + "\").get(index)";
  10. }
  11. }
  12. return null;
  13. }

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

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

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

  1. /** {@inheritDoc} */
  2. public Locale resolveLocale(Request request) {
  3. Locale retValue = null;
  4. Map<String, Object> session = request.getContext("session");
  5. if (session != null) {
  6. retValue = (Locale) session.get(DefaultLocaleResolver.LOCALE_KEY);
  7. }
  8. if (retValue == null) {
  9. retValue = request.getRequestLocale();
  10. }
  11. return retValue;
  12. }
  13. }

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

  1. /** {@inheritDoc} */
  2. public ApplicationContext getNestedObject(Request obj) {
  3. return obj.getApplicationContext();
  4. }
  5. }

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

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

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

  1. /** {@inheritDoc} */
  2. public List<String> getAvailableScopes() {
  3. return context.getAvailableScopes();
  4. }
  5. }

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

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

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

  1. @Override
  2. public Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name) {
  3. Request request = (Request) target;
  4. String attributeName = (String) name;
  5. for (String scopeName : request.getAvailableScopes()) {
  6. Map<String, Object> scope = request.getContext(scopeName);
  7. if (scope.containsKey(attributeName)) {
  8. return scope.get(attributeName);
  9. }
  10. }
  11. return null;
  12. }

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

  1. /**
  2. * Returns the current container that has been set, or the default one.
  3. *
  4. * @param request The request to use.
  5. * @return The current Tiles container to use in web pages.
  6. * @since 2.1.0
  7. */
  8. public static TilesContainer getCurrentContainer(Request request) {
  9. ApplicationContext context = request.getApplicationContext();
  10. Map<String, Object> requestScope = request.getContext("request");
  11. TilesContainer container = (TilesContainer) requestScope.get(CURRENT_CONTAINER_ATTRIBUTE_NAME);
  12. if (container == null) {
  13. container = getContainer(context);
  14. requestScope.put(CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
  15. }
  16. return container;
  17. }
  18. }

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

  1. /** {@inheritDoc} */
  2. public ApplicationContext getApplicationContext() {
  3. return context.getApplicationContext();
  4. }

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

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

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

  1. /** {@inheritDoc} */
  2. @Override
  3. public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
  4. Object base) {
  5. if (base != null) {
  6. List<FeatureDescriptor> retValue = Collections.emptyList();
  7. return retValue.iterator();
  8. }
  9. List<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>();
  10. Request request = (Request) context
  11. .getContext(Request.class);
  12. for (String scope : request.getAvailableScopes()) {
  13. FeatureDescriptor descriptor = new FeatureDescriptor();
  14. descriptor.setDisplayName(scope + "Scope");
  15. descriptor.setExpert(false);
  16. descriptor.setHidden(false);
  17. descriptor.setName(scope + "Scope");
  18. descriptor.setPreferred(true);
  19. descriptor.setShortDescription("");
  20. descriptor.setValue("type", Map.class);
  21. descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE);
  22. list.add(descriptor);
  23. }
  24. return list.iterator();
  25. }

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

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

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

  1. @Override
  2. public ViewPreparer getPreparer(String name, Request context) {
  3. WebApplicationContext webApplicationContext = (WebApplicationContext) context.getContext("request").get(
  4. DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE);
  5. if (webApplicationContext == null) {
  6. webApplicationContext = (WebApplicationContext) context.getContext("application").get(
  7. WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
  8. if (webApplicationContext == null) {
  9. throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?");
  10. }
  11. }
  12. return getPreparer(name, webApplicationContext);
  13. }

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

  1. @Override
  2. public String getSourceSetter(OgnlContext context, Object target,
  3. Object index) {
  4. Request request = (Request) target;
  5. String attributeName = (String) index;
  6. String[] availableScopes = request.getAvailableScopes().toArray(new String[0]);
  7. for (String scopeName : availableScopes) {
  8. Map<String, Object> scope = request.getContext(scopeName);
  9. if (scope.containsKey(attributeName)) {
  10. return ".getContext(\"" + scopeName + "\").put(index, target)";
  11. }
  12. }
  13. return ".getContext(\"" + availableScopes[0] + "\").put(index, target)";
  14. }

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

  1. /**
  2. * Sets the current container to use in web pages.
  3. *
  4. * @param request The request to use.
  5. * @param key The key under which the container is stored.
  6. * @since 2.1.0
  7. */
  8. public static void setCurrentContainer(Request request,
  9. String key) {
  10. ApplicationContext applicationContext = request.getApplicationContext();
  11. TilesContainer container = getContainer(applicationContext, key);
  12. if (container != null) {
  13. request.getContext("request").put(CURRENT_CONTAINER_ATTRIBUTE_NAME, container);
  14. } else {
  15. throw new NoSuchContainerException("The container with the key '"
  16. + key + "' cannot be found");
  17. }
  18. }

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

  1. /** {@inheritDoc} */
  2. public Object evaluate(String expression, Request request) {
  3. ELContextImpl context = new ELContextImpl(resolver);
  4. context.putContext(Request.class, request);
  5. context.putContext(ApplicationContext.class,
  6. request.getApplicationContext());
  7. ValueExpression valueExpression = expressionFactory
  8. .createValueExpression(context, expression, Object.class);
  9. return valueExpression.getValue(context);
  10. }
  11. }

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

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

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

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

相关文章