目前我的web应用程序在jboss上运行,但我有一个apache服务器,用作我的应用程序的代理.我有能力在我的jboss服务器上上传XML文件.上传时,它返回HTTP 200和XML响应Content-Type: text/xml.
有些用户在重定向到jboss的apache实例上使用此功能.这些用户在上传文件和Accept:/ header时有时会使用Content-Type:application/xml.使用此标头jboss可以正常工作,但是apache总是会返回错误的响应:
HTTP/1.1 502 Bad Gateway
< Date: Mon, 31 Jan 2011 23:33:47 GMT
< Server: Apache/2.0.63 (Unix) mod_jk/1.2.27
< Content-Length: 232
< Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>502 Bad Gateway</title>
</head><body>
<h1>Bad Gateway</h1>
<p>The proxy server received an invalid
response from an upstream server.<br />
</p>
Run Code Online (Sandbox Code Playgroud)
当用户使用application/xml而不是text/xml标头值时,为什么会这样?apache会以某种方式比较这些标题吗?当用户使用text/xml值时,一切正常,apache打印jboss 200 OK响应.
是否可以在Java中对匿名类进行searialize/desearialize?
例:
ByteArrayOutputStream operationByteArrayStream = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(operationByteArrayStream);
oos.writeObject(new Task() {
public void execute() {
System.out.println("Do some custom task"));
}
});
Run Code Online (Sandbox Code Playgroud)
我的问题是我想做一些自定义管理任务,这样我就不需要每个任务都有一个版本.所以我正在尝试做的是 - 通过Groovy脚本引擎通过HTTP端点发布自定义任务并将它们序列化为db以及时运行它们.
在使用@RequestBody StreamSourcefind out时,如果请求体中的xml无效StreamSource则会抛出异常(导致400 Bad Request)并且我无法处理它(告诉客户端什么是坏的).
有没有办法处理这种异常?
你知道是否可以在jndi中通过datasource设置mongodb实例,就像任何其他数据库一样?
谢谢
我正在开发一个简单的应用程序,其中一个EJB应该注入另一个.我在IDEA Jetbrains IDE中开发.但是在我在Ejb本地statless类中创建@EJB注释后,我的IDE突出显示错误:找不到组件接口'ApplicationController'的EJB''.
有谁能说出为什么?
使用ThreadLocal作为Web应用程序中数据的上下文是一个好主意吗?
例如,我有两个豆子:
class Bean1 {
private SomeService service1;
private SomeService servive2;
private Bean2 bean2;
public void doStuff() {
service1.doActualStuff();
}
public void setBean2(Bean2 bean2) {
this.bean2 = bean2;
}
public Bean2 getBean2() { return this.bean2 }
}
class Bean2 {
private Bean1 bean1;
private SomeService3 service3;
public void init() {
bean1.doStuff();
}
public void setBean1(Bean1 bean1) {
this.bean1 = bean1;
}
}
Run Code Online (Sandbox Code Playgroud)
现在,如果我尝试以下面的方式配置它们:
<bean id="service1" class="SomeService">
...
</bean>
<bean id="bean1" class="Bean1">
<property name="bean2" ref="bean2"/>
<property name="service1" ref="service1"/>
...
</bean>
<bean id="bean2" …Run Code Online (Sandbox Code Playgroud) 我刚开始使用rails,我已经在我的ubuntu 11.04上完成了本教程http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac的所有步骤,但是我无法运行rake db :迁移.
它给出了这个输出:
/home/breedish/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:4: warning: already initialized constant MAJOR
/home/breedish/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:5: warning: already initialized constant MINOR
/home/breedish/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:6: warning: already initialized constant BUILD
/home/breedish/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:3: warning: already initialized constant NUMBERS
/home/breedish/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:9: warning: already initialized constant VERSION
/home/breedish/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake.rb:26: warning: already initialized constant RAKEVERSION
/home/breedish/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/early_time.rb:17: warning: already initialized constant EARLY
/home/breedish/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/alt_system.rb:32: warning: already initialized constant WINDOWS
/home/breedish/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:28: warning: already initialized constant DEFAULT_RAKEFILES
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/home/breedish/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task_arguments.rb:73: …Run Code Online (Sandbox Code Playgroud) 嗨,我是groovy的新手,我对groovy如何解析xml有误解
<schema-definition name="Standard" >
<field-type name="Standard:Integer" descr="A whole number." base-type="long"/>
<field-type name="Standard:Boolean" descr="A boolean value." base-type="boolean"/>
<field-type name="Standard:String" descr="A string" base-type="string"/>
</schema-definition>
Run Code Online (Sandbox Code Playgroud)
当我尝试
document = groovy.xml.DOMBuilder.parse(new FileReader('D:/test.xml'))
rootElement = document.documentElement
use(groovy.xml.dom.DOMCategory)
{
field-types=rootElement.field-type
println field-types
}
Run Code Online (Sandbox Code Playgroud)
我甚至没有编译:(field - types)是一个二进制表达式,但它应该是一行变量表达式:13列:20
java ×8
http ×2
jboss ×2
spring ×2
apache ×1
bad-request ×1
datetime ×1
dbmigrate ×1
ejb-3.1 ×1
groovy ×1
http-headers ×1
java-ee-6 ×1
jndi ×1
mongodb ×1
nosql ×1
rake ×1
ruby ×1
spring-mvc ×1
thread-local ×1
xml ×1