Ejemplo n.º 1
0
  public void createAnnotationInterceptor(String className, AnnotationHolder annotationHolder) {
    try {
      Class cclass = Utils.createClass(className);
      Interceptor inter = (Interceptor) cclass.getAnnotation(Interceptor.class);

      String name = cclass.getName();
      if (!UtilValidate.isEmpty(inter.value())) {
        name = inter.value();
      } else if (!UtilValidate.isEmpty(inter.name())) {
        name = inter.name();
      }

      annotationHolder.addComponent(name, cclass);
      annotationHolder.getInterceptors().put(name, cclass);
      if (!UtilValidate.isEmpty(inter.pointcut())) {
        String[] targets = inter.pointcut().split(",");
        for (int i = 0; i < targets.length; i++) {
          Class targetClass = annotationHolder.getComponentClass(targets[i]);
          if (targetClass != null) introduceInfoHolder.addTargetClassNames(targetClass, targets[i]);
        }
      }
      POJOTargetMetaDef pojoMetaDef = new POJOTargetMetaDef(name, className);
      annotationHolder.getTargetMetaDefHolder().add(name, pojoMetaDef);
      Debug.logVerbose(
          "[JdonFramework] load Annotation Interceptor name:" + name + " target class:" + className,
          module);
    } catch (Exception e) {
      Debug.logError(
          "[JdonFramework] createAnnotationInterceptorClass error:" + e + className, module);
    }
  }
Ejemplo n.º 2
0
  public ActionForward execute(
      ActionMapping actionMapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    // browser cache expire time;
    int expire = 2 * 60;
    if (request.getParameter("nocache") != null) { // for just modified and
      // view it
      expire = 0;
      return actionMapping.findForward(FormBeanUtil.FORWARD_SUCCESS_NAME);
    }

    String threadId = request.getParameter("thread");
    if ((threadId == null) || (!UtilValidate.isInteger(threadId))) {
      response.sendError(404);
      return null;
    }

    ForumMessageService forumMessageService =
        (ForumMessageService) WebAppUtil.getService("forumMessageService", request);
    ForumThread forumThread = forumMessageService.getThread(new Long(threadId));
    if (forumThread == null) {
      response.sendError(404);
      return null;
    }

    long modelLastModifiedDate = forumThread.getState().getModifiedDate2();

    if (!ToolsUtil.checkHeaderCache(expire, modelLastModifiedDate, request, response)) {
      return null; // response is 304
    }

    return actionMapping.findForward(FormBeanUtil.FORWARD_SUCCESS_NAME);
  }