小编Zhe*_*nch的帖子

显示PNG图像作为对jQuery AJAX请求的响应

是否可以在HTML的主流中显示由jQuery AJAX调用返回的图像?

我有一个脚本绘制带有标题的图像(图像/ PNG).当我在浏览器中调用它时,会显示图像.

但是当我在这个脚本上使用jQuery进行AJAX调用时,我无法显示干净的图像,我有很多奇怪的符号.这是我的脚本,使图像具有标题(图像/ PNG).

#!/usr/bin/perl 

use strict;
use CGI;
use Template;
use CGI::Carp qw(fatalsToBrowser);
use lib qw(lib);
use GD;

my $cgi    = new CGI;

my $id_projet            =  $cgi   -> param('id_projet') ;      # 

# Create a new image
my $image = new GD::Image(985,60) || die;
my $red =  $image->colorAllocate(255, 0, 0);
my $black =  $image->colorAllocate(0, 0, 0);

$image->rectangle(0,0,984,59,$black);
$image->string(gdSmallFont,2,10,"Hello $id_projet ",$black);
# Output the image to the browser

print $cgi -> header({-type => 'image/png',-expires => '1d'});

#binmode STDOUT;

print …
Run Code Online (Sandbox Code Playgroud)

ajax jquery image header request

29
推荐指数
3
解决办法
12万
查看次数

<f:viewParam>和<f:param>有什么区别?

<f:viewParam><f:param>JSF 2.1 之间有什么区别?

jsf jsf-2

8
推荐指数
1
解决办法
3996
查看次数

PrettyFaces 和 h:link 结果标签不会重定向到干净的 URL

我用 PrettyFaces 重写错误页面对 ah:link 不起作用,我不明白为什么。

我的链接应该重定向到login.xhtml,它应该是/Login.

发生了什么事,我错过了什么吗?

我的重写规则导航:

<navigation-rule>
    <from-view-id>/pageNotFound.xhtml</from-view-id> 
    <navigation-case>
        <from-outcome>login</from-outcome>
        <to-view-id>/login.xhtml</to-view-id>
        <redirect/>
    </navigation-case>
</navigation-rule>
Run Code Online (Sandbox Code Playgroud)

我的 web.xml 用于错误页面处理和漂亮的过滤器配置:

<error-page>
    <error-code>404</error-code>
    <location>/pageNotFound.xhtml</location>
</error-page>
<filter>
    <filter-name>Pretty Filter</filter-name>
    <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>Pretty Filter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
</filter-mapping>
Run Code Online (Sandbox Code Playgroud)

我的漂亮 config.xml:

    <url-mapping id="login">
    <pattern value="/Login" />
    <view-id value="/login.xhtml" />
</url-mapping>
Run Code Online (Sandbox Code Playgroud)

我的 pageNotFound.xhtml:

<rich:panel style="width:50%;margin-top:100px;" header="Page Not Found.">
    <h:link value="Login page" outcome="login" />
</rich:panel>
Run Code Online (Sandbox Code Playgroud)

url-rewriting jsf-2 prettyfaces

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

Spring security 3.1:会话并发控制无法正常工作,为什么?

我正在尝试使用spring security concurent session with spring security 3.1.4.但它不起作用我不明白为什么.Tomcat https配置为重定向http请求,但我不知道它是否在实际问题中发挥作用.

你能帮我个忙吗?

谢谢.

这是我的spring security xml.

 <security:http auto-config="true" use-expressions="true" disable-url-rewriting="true">
     <security:intercept-url pattern="/Loginsucess*" access="isAuthenticated()"  />
     <security:intercept-url pattern="/Login" access="hasRole('ROLE_ANONYMOUS')" />   
     <security:intercept-url pattern="/Login/Error" access="hasRole('ROLE_ANONYMOUS')" />    
     <security:form-login  login-page="/Login"  login-processing-url="/j_spring_security_check"  authentication-failure-url="/Login/Error" default-target-url="/Loginsucess" />
     <security:logout logout-url="/j_spring_security_logout" logout-success-url="/Login" delete-cookies="JSESSIONID"  invalidate-session="true"/>
     <security:anonymous/>
     <security:session-management invalid-session-url="/Login" >
        <security:concurrency-control max-sessions="1" error-if-maximum-exceeded="true"  />
     </security:session-management>
     <security:port-mappings>
      <security:port-mapping http="8086" https="8443"/>
     </security:port-mappings>
</security:http>
Run Code Online (Sandbox Code Playgroud)

我已经将它添加到我的web.xml中:

<listener>
<listener-class>
  org.springframework.security.web.session.HttpSessionEventPublisher
</listener-class>
Run Code Online (Sandbox Code Playgroud)

编辑:

1台机器上的第一个记录:

> 17:57:17,116 DEBUG FilterChainProxy:337 - /j_spring_security_check at
> position 1 of 11 in additional filter chain; firing …
Run Code Online (Sandbox Code Playgroud)

https spring spring-security

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

Hibernate:为什么我在每次插入一对多关系后都会得到更新?

我不明白我的休眠映射设置中哪些配置不正确。\n插入后很多次,我对包含在一对多关系中的链接表进行了更新。

\n\n

我不想要这个更新。\n我认为更新可能与级联或反向关键字有关......

\n\n

在我的示例中,我有 4 个类 AnalyseResult、VariationResult、Variation 和 VariationAnnotationNGS。

\n\n

AnalyseResult 可以有许多 VariationResults 子级。\n一个父 Variation 可以有多个 VariationResultChildren。\nVariation 可以有许多 VariationAnnotationNGS 子项。

\n\n

当我尝试插入新的 AnalyseResult 并附加所有子对象时,执行类似的操作

\n\n
\n

方法注释@Transactionnal\n AnalyseResultBo.save() {AnalyseResultDao.save() }

\n
\n\n

对于每个新的 VariationResult 插入,都会更新 Variation。(变化已经存储(持久化)在数据库中并重新附加到瞬态对象 VariationResult。

\n\n

这是我的映射。我需要更改什么才能使更新在插入后消失?

\n\n

谢谢

\n\n
         <!--AnalyseResult -->\n        <class name="com.clb.genomic.lyon.model.analysis.AnalyseResult" table="CORE_analyseResult"  >\n\n          <set name="ngsVariationResults" table="NGS_variationResult"  inverse="true" lazy="true"  cascade="all">\n               <key>\n               <column name="id_analyseResult_fk" not-null="true"  />\n               </key> \n               <one-to-many class="com.clb.genomic.lyon.model.ngs.VariationResultNGS" />\n          </set>\n\n         </class>\n\n      <!--VariationResultNGS -->\n      <class name="com.clb.genomic.lyon.model.ngs.VariationResultNGS" table="NGS_variationResult" >\n\n         <many-to-one name="analyseResult" class="com.clb.genomic.lyon.model.analysis.AnalyseResult" cascade="all" >\n            <column name="id_analyseResult_fk" …
Run Code Online (Sandbox Code Playgroud)

mapping hibernate insert updates

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

Centos 6 上使用 Apache 进行反向代理

我正在尝试使用 Apache 将 URL 转发到另一台服务器。我在httpd.conf中创建了一个虚拟主机。当我尝试访问 ipServeur/test 时它不起作用。我无法访问该页面。

怎么了?

NameVirtualHost *:80 
<VirtualHost *:80>
    ServerName ipServeur
    ProxyRequests off
    ProxyPass /test http://ipOtherServeur:8080
    ProxyPassReverse /test http://ipOtherServeur:8080
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

apache reverse-proxy virtualhost centos6

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

@RetryTransaction:如何在发现死锁时使其工作

Concurent Transaction使我的Sql语句失败.我正在尝试使用[这] dellroad-stuff 1.但它似乎被忽略了.我正在使用spring 3和hibernate 4.

错误 :

15:32:11,331 WARN SqlExceptionHelper:145 - SQL Error: 1213, SQLState: 40001
15:32:11,331 ERROR SqlExceptionHelper:147 - Deadlock found when trying to get lock; try restarting transaction
15:32:11,334 INFO AbstractBatchImpl:195 - HHH000010: On release of batch it still contained JDBC statements
Run Code Online (Sandbox Code Playgroud)

如果失败则重写事务的annoted函数:

@Override   
@RetryTransaction   
@Transactional  
public void save(AnalyseResult analyseResult) {
    final int attempt = RetryTransactionAspect.aspectOf().getAttemptNumber();
    System.out.println("#############");
    System.out.println("Retry Transact : "+attempt);
    System.out.println("#############"); 
    analyseResultDao.save(analyseResult);
}
Run Code Online (Sandbox Code Playgroud)

Beans.xml

<!--  An @AspectJ aspect will be interpreted as an aspect by …
Run Code Online (Sandbox Code Playgroud)

java spring transactions aspectj

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

是否富有:(RC 4.3.4)中的fileUpload组件在Apache Tomcat7和JSF 2.2上工作?:"请求prolog无法读取"

我正在尝试使用richfaces fileupload组件上传文件.我的豆子在景观中.

我的代码是从展示中提取的.

            <rich:fileUpload  id="upload" immediateUpload="true" fileUploadListener="#{analyse.listener}"  acceptedTypes="png" ontyperejected="alert('Seulement les fichiers avec l'extension bam et pdf sont acceptés.');" maxFilesQuantity="3">
                  <a4j:ajax event="uploadcomplete" execute="@none" />        
            </rich:fileUpload>
Run Code Online (Sandbox Code Playgroud)

bean函数叫:

    public void listener(FileUploadEvent event) throws Exception {


    System.out.println("Listenner");

    UploadedFile item = event.getUploadedFile();

    System.out.println(item.getName());
    System.out.println(item.getSize());
    System.out.println(item.getContentType()) ;

}     
Run Code Online (Sandbox Code Playgroud)

当我尝试添加上传文件时,我收到一个漂亮的错误:-(欢迎提供帮助.

6 nov. 2013 19:00:43 org.richfaces.request.MultipartRequest25 parseIfNecessary GRAVE: Exception parsing multipart request: Request prolog cannot be read org.richfaces.exception.FileUploadException: Exception parsing multipart request: Request prolog cannot be read at org.richfaces.request.MultipartRequestParser.parse(MultipartRequestParser.java:156) at org.richfaces.request.MultipartRequest25.parseIfNecessary(MultipartRequest25.java:77) at org.richfaces.request.MultipartRequest25.getParameter(MultipartRequest25.java:114) at com.sun.faces.context.RequestParameterMap.get(RequestParameterMap.java:75) at com.sun.faces.context.RequestParameterMap.get(RequestParameterMap.java:56) at …

file-upload richfaces jsf-2 tomcat7 view-scope

4
推荐指数
1
解决办法
2781
查看次数