问题列表 - 第36850页

无法使Spring 3 Session Concurency Control工作

使用Spring Security 3.1.0,我似乎无法使并发会话控制功能起作用.当我使用IE和FireFox(使用我的本地工作站)同时登录我的系统时,我在会话注册表中看到我的用户原则两次.我期待并发会话控制将我退出或抛出异常或做一些事情表明我多次登录该网站并且不允许这样做.

对于它的价值,即使指定我的站点使用自定义登录表单,我也无法使用HTTP名称空间元素的自动配置来使用并发控制.我想知道这可能是因为我的身份验证是通过LDAP提供的吗?

这是我的安全配置.

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
 xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/security
           http://www.springframework.org/schema/security/spring-security-3.0.xsd">

 <http auto-config="false" use-expressions="true" entry-point-ref="authenticationProcessingFilterEntryPoint">
     <custom-filter position="CONCURRENT_SESSION_FILTER" ref="concurrencyFilter" />
     <custom-filter position="FORM_LOGIN_FILTER" ref="myAuthFilter"/>
     <session-management session-authentication-strategy-ref="sas"/>
  <intercept-url pattern="/" access="permitAll" />
  <intercept-url pattern="/css/**" access="permitAll" />
  <intercept-url pattern="/images/**" access="permitAll" />
  <intercept-url pattern="/js/**" access="permitAll" />
  <intercept-url pattern="/public/**" access="permitAll" />
  <intercept-url pattern="/home/**" access="permitAll" />
  <intercept-url pattern="/admin/user/**" access="hasRole('AUTH_MANAGE_USERS')" />
  <intercept-url pattern="/admin/group/**" access="hasRole('AUTH_MANAGE_USERS')" />
  <intercept-url pattern="/**" access="isAuthenticated()" />
  <access-denied-handler error-page="/403.html"/>
  <logout invalidate-session="true" logout-success-url="/public/home.do"/>
 </http>

    <beans:bean id="authenticationProcessingFilterEntryPoint"
          class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
        <beans:property name="loginFormUrl" value="/public/login.do"/>
        <beans:property name="forceHttps" value="false"/> …
Run Code Online (Sandbox Code Playgroud)

session configuration spring-security

3
推荐指数
1
解决办法
3463
查看次数

为什么我需要使用.d来访问jQuery AJAX返回的数据?

我已经使用我在互联网上找到的一些教程汇总了一些jQuery AJAX代码.我是jQuery的新手,想学习如何做更好的事情.我有一个同事使用大量的jQuery组装了一个漂亮的Web应用程序.

我在这里最困惑的是:为什么在引用我的Web方法的响应时它是否有必要使用".d"以及它代表什么?

    // ASP.net C# code
    [System.Web.Services.WebMethod]
    public static string hello()
    {
        return ("howdy");
    }

// Javascript code
function testMethod() {
    $.ajax({
        type: "POST",
        url: "ViewNamesAndNumbers.aspx/hello",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            alert(msg);   // This doesn't display the response.
            alert(msg.d); // This displays the response.
        } // end success:
    }) // end $.ajax
Run Code Online (Sandbox Code Playgroud)

asp.net jquery serialization json

10
推荐指数
2
解决办法
1万
查看次数

在用户离开页面之前显示模态表单

我曾经习惯window.onbeforeunload在用户试图离开网站时显示自定义消息.

例:

window.onbeforeunload = function(){
  if(some_condition){
    return "Are you sure you want to navigate away from this page?\nAll unsaved changes will be lost.";
  }
};


+--------------------------------------------------------+
| Are you sure you want to navigate away from this page? |
| All unsaved changes will be lost.                      |
|                                                        |
|          [ Yes ]  [ Cancel ]                           |
+--------------------------------------------------------+
Run Code Online (Sandbox Code Playgroud)

但是,我想稍微提高一点.如果可能的话,我想使用自定义模式表单而不是通用弹出窗口.

有没有办法做到这一点?

javascript jquery jquery-ui

8
推荐指数
2
解决办法
2万
查看次数

13
推荐指数
2
解决办法
1万
查看次数

关于SICP的问题chpt 4.1:(analyze expr)如何帮助加速eval?

我正在阅读SICP的以下部分

http://mitpress.mit.edu/sicp/full-text/book/book-ZH-26.html#%_sec_4.1.7

根据文本,以下eval改进将提高性能,因为多次评估的表达式只会被分析一次?

(define (eval exp env)
    ((analyze exp) env))
Run Code Online (Sandbox Code Playgroud)

这是analyze本书中给出的函数:

(define (analyze-if exp)
(let ((pproc (analyze (if-predicate exp)))
    (cproc (analyze (if-consequent exp)))
        (aproc (analyze (if-alternative exp))))
    (lambda (env)
        (if (true? (pproc env))
            (cproc env)
                (aproc env)))))
Run Code Online (Sandbox Code Playgroud)

我不明白为什么这本书说analyze只会运行一次.没有了身体eval,这是((analyze exp) env))基本上是说,每次eval被调用时,analyze将一个名为exp作为它的参数?这意味着analyze每次调用时eval都会调用它.

我的理解有什么问题?我将不胜感激任何反馈,谢谢!

lisp scheme sicp

8
推荐指数
2
解决办法
400
查看次数

在循环中,是否在每次迭代中评估最终条件中的任何操作?

在以下代码中:

for (var i = 0; i < object.length; i++){  
    ....  
}  
Run Code Online (Sandbox Code Playgroud)

object.length每次迭代时都会对操作进行评估吗?
最有意义的是语言将对此进行一次评估并保存结果.但是,我正在阅读一些代码,其中有人在循环开始之前评估了操作,并将其存储在最终条件中使用的变量中.
不同的语言处理不同吗?Javascript的任何特定信息?

javascript for-loop

7
推荐指数
1
解决办法
632
查看次数

系统听起来像Java

我正在尝试编写错误对话框,我希望它能够调用正确的系统指定声音.有没有办法从Java访问系统声音(即启动声音,默认蜂鸣声,星号,关键停止等)?

注意:我知道java.awt.Toolkit.getDefaultToolkit().beep();

java system-sounds

11
推荐指数
1
解决办法
2万
查看次数

Delphi - 何时调用DragAcceptFiles

我有

procedure TMainForm.FormCreate(Sender: TObject);
begin
DragAcceptFiles (Handle, True ) ; 
end ;
Run Code Online (Sandbox Code Playgroud)

但表单不接受拖动文件 - 没有删除游标,没有触发WM_DROPFILES消息.

我在FormShow事件中有以下构造(出于不同的原因 - 在创建表单后,我只想执行一次代码,并且FormShow在初始化期间多次触发):

procedure TMainForm.FormShow(Sender: TObject);

begin
if (not FRunOnce) then  // as FormShow can be called twice - if Form.Position assigned to
    begin
    DragAcceptFiles (Handle, True ) ; 
    FRunOnce := True ;
    end ;
end ;
Run Code Online (Sandbox Code Playgroud)

在显示的位置DragAcceptFiles(Handle,True)仍然不起作用.如果我将它移动到例程的顶部(因此它执行两次),它确实有效:

procedure TMainForm.FormShow(Sender: TObject);

begin
DragAcceptFiles (Handle, True ) ; 
if (not FRunOnce) then  // as FormShow can be called twice - if Form.Position assigned to
    begin
    FRunOnce …
Run Code Online (Sandbox Code Playgroud)

forms delphi drag-and-drop oncreate

5
推荐指数
1
解决办法
1843
查看次数

在编写语义HTML时,哪个更好:使用<h1>到<h6>标签进行范围设定或使用id属性和<span>标签进行范围界定?

我正在尝试编写高质量的语义HTML5.

以下两个选项中的哪一个在语义上更好:


选项1:

通过使用ID选择跨度来定义样式:

%body
  %header#global-header
    %h1
      My Startup Name
    %h2
      Home of the best offers in the Motor City

  %section#offers
    %h1
      Today&apos;s Offers
    %h2
      Here are the current offers for your city:

    %article.offer
      %header.offer-header
        %span.restaurant-name 
          Some Burger Joint
        %span.offer-title 
          80&#37; off a burger
        %section.price-details
          %ul
            %li.original-price
              %p
                Original Price
              %p
                &#36;30
            %li.offer-price
              %p
                Price
              %p
                &#36;10
        %section.offer-description
          %p
            Some burger joint is the most popular burger joint in the Motor City. Buy a big burger or a bunch of …
Run Code Online (Sandbox Code Playgroud)

html5 semantic-web semantic-markup css-selectors semantics

2
推荐指数
1
解决办法
816
查看次数

CakePHP 1.3:在视图中检测ajax请求

在Cake 1.3之前,我会用简单的方法检查ajax请求$ajax->isAjax().既然AjaxHelper已经弃用了,我正在寻找在我的视图中检查ajax请求的正确方法.我在JsHelperHtmlHelper方法中找不到任何东西.这似乎是一件非常简单的事情,我希望我不会错过一些明显的东西!

顺便说一句,我知道RequestHandler组件($this->RequestHandler->isAjax()在控制器中),但我再次寻求有关如何在我的视图中进行ajax检测的帮助.

谢谢.

ajax cakephp

5
推荐指数
2
解决办法
3530
查看次数