在我的web项目中,我使用jQuery.有一个注册到jQuery click事件的函数.
toggleCalculationSelection : function(ev) {
var src = typeof ev !== 'undefined' ? $(ev.target) : $('form.attribute input[name="calculation"][value="3"]');
Run Code Online (Sandbox Code Playgroud)
jQuery提供具有目标属性的事件对象.JetBrains Webstorms告诉我,这target是一个未解决的变量.
我不想完全关掉这张支票.
我怎么能告诉Jetbrains在这种情况下忽略这个错误或教它,jQuery有这个属性?
我使用以下库.
在Apache Tomcat/7.0.52(Ubuntu)上.
我使用Spring来配置Quartz.
@Configuration
class QuartzConfig {
@Bean
FactoryBean<Scheduler> scheduler() {
final SchedulerFactoryBean factory = new SchedulerFactoryBeanWithShutdownDelay();
final Map<String, Object> map = new LinkedHashMap<>();
map.put("settingsService", settingsService);
final List<AbstractQuartzJob> jobs = new LinkedList<>();
jobs.add(dbBackupJob());
jobs.add(csvExportJob());
jobs.add(csvImportJob());
jobs.add(dbMaintenanceJob());
jobs.add(filesystemCleanupJob());
map.put("jobs", jobs);
factory.setSchedulerContextAsMap(map);
factory.setTriggers(new Trigger[] {cronTrigger});
return factory;
}
}
Run Code Online (Sandbox Code Playgroud)
今天搜索了很多为什么调度程序任务没有正确关闭...
Jun 24, 2014 5:14:38 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/feeder##1.5.0] appears to have started a thread named [scheduler_Worker-1] but has failed to stop it. This is very …Run Code Online (Sandbox Code Playgroud) 我的gulpfile.js的一部分
const del = require('del');
const chrome_dir = 'build/chrome';
const ff_dir = 'build/firefox';
gulp.task('clean', function (cb) {
del([chrome_dir, ff_dir], cb);
});
gulp.task('default', ['clean'], function () {
gulp.start('build packages', 'JS Backend', 'i18n', 'ExtRes', 'styles', 'JS Content', 'templates');
});
Run Code Online (Sandbox Code Playgroud)
运作良好.
然后我安装了一个新系统,可能有新版本的gulp和del等等.
现在gulp在清洁后停止.
我可以手动调用所有任务,这工作正常.
只能改变del的行为......
我怎样才能解决这个问题?
我的宁静JSON服务的下一个问题.
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author Martin Burchard
*
*/
@XmlRootElement(name = "user")
@XmlAccessorType(XmlAccessType.FIELD)
public class User {
private String id;
private String nickname;
private String email;
private String password;
private Map<String, String> user_attributes;
}
Run Code Online (Sandbox Code Playgroud)
目前,该服务提供以下JSON(缩进以便更好地阅读):
{
"user" : {
"id" : "9bdf40ea-6d25-4bc3-94ad-4a3d38d2c3ca",
"email" : "test.user@test.de",
"password" : "xXpd9Pl-1pFBFuX9E0hAYGSDTyJQPYkOtXGvRCrEtMM",
"user_attributes" : {
"entry" : [{
"key" : "num",
"value" : 123
}, {
"key" : "type",
"value" : "nix"
}
]
}
}
} …Run Code Online (Sandbox Code Playgroud) 我已经尝试了一整天,让我的自定义身份验证失败处理程序与Spring 3.1.3一起使用.
我认为它配置正确
<http use-expressions="true" disable-url-rewriting="true">
<intercept-url pattern="/rest/login" access="permitAll" />
<intercept-url pattern="/rest/**" access="isAuthenticated()" />
<intercept-url pattern="/index.html" access="permitAll" />
<intercept-url pattern="/js/**" access="permitAll" />
<intercept-url pattern="/**" access="denyAll" />
<form-login username-parameter="user" password-parameter="pass" login-page="/rest/login"
authentication-failure-handler-ref="authenticationFailureHandler" />
</http>
<beans:bean id="authenticationFailureHandler" class="LoginFailureHandler" />
Run Code Online (Sandbox Code Playgroud)
我的实现是这样的
public class LoginFailureHandler implements AuthenticationFailureHandler {
private static final Logger log = LoggerFactory.getLogger(LoginFailureHandler.class);
public LoginFailureHandler() {
log.debug("I am");
}
@Autowired
private ObjectMapper customObjectMapper;
@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
AuthenticationException exception) throws IOException, ServletException {
log.debug("invalid login");
User user = new …Run Code Online (Sandbox Code Playgroud) 今天,我试图修复Web应用程序中的一些潜在的内存泄漏。
我使用以下库。
首先,我错过了关闭MongoClient的操作,但是以这种方式更改了我的配置。
@Configuration
public class MongoDBConfiguration implements DisposableBean {
private MongoClient mongoClient;
@Bean
public MongoTemplate mongoTemplate() {
try {
final Properties props = loadProperties();
log.debug("Initializing Mongo DB client");
mongoClient =
new MongoClient(getProperty(props, "host", "localhost"), cint(getProperty(props, "port",
"27017")));
UserCredentials credentials = null;
final String auth = getProperty(props, "auth", null);
if (auth != null && auth.equalsIgnoreCase("true")) {
final String user = getProperty(props, "user", null);
final String pass = getProperty(props, "pass", null);
if (user != null && pass != …Run Code Online (Sandbox Code Playgroud) 今天我将Eclipse升级到4.5版.从那以后,它形成了不同的形式:
之前:
@Override
public void close() {
try {
engine.closeSession(session);
status = NOT_CONNECTED;
} catch (final OpenpagesException e) {
log.error("Closing connection failed", e);
}
}
Run Code Online (Sandbox Code Playgroud)
现在:
@Override
public void close() {
try {
engine.closeSession(session);
status = NOT_CONNECTED;
} catch (final OpenpagesException e) {
log.error("Closing connection failed", e);
}
}
Run Code Online (Sandbox Code Playgroud)
这也适用于:switch,for,if和其他......
看起来方法体内的第一个缩进级别被破坏了.
我查看了格式设置,但没有看到可能对此负责的内容.
这是一个错误,还是有设置?
更新:01.07.2015
它只会发生,如果标签大小设置为2,如果它设置为4除了浪费空间外,一切看起来都很好......
解决方法
在格式化程序设置中,仅从Tabs切换到混合.
然后为Indention尺寸添加2,为Tab尺寸添加2.
将设置切换回选项卡并应用所有内容.
现在格式化工作与4.4版本一样,它使用2作为选项卡,而不是4.
我是java XML绑定的新手.
这是我的班级
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author Martin Burchard
*
*/
@XmlRootElement(name = "user")
public class User {
private String id;
private String nickname;
private String email;
private String password;
@XmlElement(name = "id")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@XmlElement(name = "nickname")
public String getNickName() {
return nickname;
}
public void setNickName(String nickname) {
this.nickname = nickname;
}
@XmlElement(name = "email")
public String getEMail() {
return email; …Run Code Online (Sandbox Code Playgroud) 如果字符串看起来像数字,例如.111 CXF不会将其作为字符串返回,而是作为数字返回.
<bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
<property name="serializeAsArray" value="true" />
<property name="arrayKeys" ref="jsonKeys" />
</bean>
Run Code Online (Sandbox Code Playgroud)
可以看出,我使用的是JSON提供程序.如何强制它,提供正确的JSON字符串?
{object:{"name":"111"}} instead of {object:{"name":111}}
Run Code Online (Sandbox Code Playgroud)
提前致谢...
我使用 Spring Boot 1.5.7。
我还没有配置 CommonsMultipartResolver,因为 Spring Boot 已经处理文件上传了。
如果我的上传超过允许的最大大小,则会抛出一个丑陋的异常。
这是由我的控制器处理的。
@ControllerAdvice
public abstract class DefaultController implements InitializingBean {
@ExceptionHandler(Exception.class)
public ResponseEntity<ServiceException> handleException(final Exception ex) {
...
} else if (ex instanceof MultipartException) {
MultipartException me = (MultipartException) ex;
Throwable cause = ex.getCause();
if (cause instanceof IllegalStateException) {
Throwable cause2 = cause.getCause();
if (cause2 instanceof SizeLimitExceededException) {
// this is tomcat specific
SizeLimitExceededException slee = (SizeLimitExceededException) cause2;
}
}
}
Run Code Online (Sandbox Code Playgroud)
这种处理不仅复杂而且可悲的是 Tomcat 特定的,因为 SizeLimitExceededException 在包中org.apache.tomcat.util.http.fileupload.FileUploadBase。
我如何处理错误情况,即有人上传更大的文件然后允许并返回一条不错的消息,无论使用哪个 Servlet 引擎?
java ×6
cxf ×3
jax-rs ×3
spring ×3
javascript ×2
jaxb ×2
xml ×2
eclipse ×1
gulp ×1
jquery ×1
memory-leaks ×1
mongodb ×1
node.js ×1
spring-boot ×1
spring-mvc ×1
webstorm ×1