我有一个下面的功能,在Chrome中工作正常但它在IE10中给出了以下错误
SCRIPT438: Object doesn't support property or method 'endsWith'
function getUrlParameter(URL, param){
var paramTokens = URL.slice(URL.indexOf('?') + 1).split('&');
for (var i = 0; i < paramTokens.length; i++) {
var urlParams = paramTokens[i].split('=');
if (urlParams[0].endsWith(param)) {
return urlParams[1];
}
}
}
Run Code Online (Sandbox Code Playgroud)
有人能告诉我这个功能有什么问题吗?
我有一个常见的CurrencyTypes示例列表
class CurrencyType
{
int id;
def code;
def currency;
CurrencyType(int _id, String _code, String _currency)
{
id = _id
code = _code
currency = _currency
}
}
def currenciesList = new ArrayList<CurrencyType>()
currenciesList.add(new CurrencyType(1,"INR", "Indian Rupee"))
currenciesList.add(new CurrencyType(1,"USD", "US Dollar"))
currenciesList.add(new CurrencyType(1,"CAD", "Canadian Dollar"))
Run Code Online (Sandbox Code Playgroud)
我希望代码列表以逗号分隔的值(如INR,USD,CAD)和最少的代码以及创建新列表.
我有下面的代码迭代Cookies重置名称匹配的cookieCookieSession.NAME
Cookie[] cookies = httpServletRequest.getCookies();
LOGGER.info("Clearing cookies on welcome page");
if (cookies != null)
for (Cookie cookie : cookies) {
if (cookie.getName().equals(CookieSession.NAME)) {
cookie.setValue(null);
cookie.setMaxAge(0);
cookie.setPath("/");
httpServletResponse.addCookie(cookie);
}
}
Run Code Online (Sandbox Code Playgroud)
有人可以使用java 8 lambda表达式来简化它
我有一个示例LEDES XML文件https://codebeautify.org/xmlviewer/cbdc79e7
使用xjc如下JDK生成的Ledesxmlebilling21类和Ledes21.xsd模式https://codebeautify.org/xmlviewer/cb974a2e
xjc -d src ledes21.xsd
Run Code Online (Sandbox Code Playgroud)
我正在使用JAX-B将XML转换为Java对象,如下所示
Ledesxmlebilling21 XMLtoObject(InputStream fis) throws Exception {
JAXBContext context = JAXBContext.newInstance(Ledesxmlebilling21.class)
Unmarshaller um = context.createUnmarshaller()
Ledesxmlebilling21 ledes = (Ledesxmlebilling21) um.unmarshal(fis)
return ledes
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用Invoice对象的invId属性值创建一个Map 作为Key,并将值作为所有Invoice对象的嵌套属性fileItemNbr值列表,如下所示
['Invoice 31' : [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]
'Invoice 32' : [50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73]
]
Run Code Online (Sandbox Code Playgroud)
有人可以帮我吗?
更新解决方案
def extractFileItemNbr(input, List<Integer> extracted) {
input.properties.each { prop, val -> //LedesXmlRuleProcessor.groovy:82)
if (prop in ["metaClass", "class"]) return
if (prop == 'file_item_nbr') {
extracted << val
} else {
extractFileItemNbr(val, …Run Code Online (Sandbox Code Playgroud) 我在我的spring应用程序中遇到会话管理问题,这是方案.当用户打开我的应用程序URL时,它会要求提供凭据并登录.用户进入后,如果他打开一个新选项卡并粘贴我的应用程序URL,它将再次请求凭据并且用户登录.
现在,如果用户在tab1中注销,并且如果用户想要在第二个选项卡中执行任何操作,则用户会在stacktrace下面收到错误并注销.
Oct 10, 2014 3:11:27 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [CollPortal] in context with path [/CollPortal] threw exception
java.lang.IllegalStateException: Cannot create a session after the response has been committed
at org.apache.catalina.connector.Request.doGetSession(Request.java:2886)
at org.apache.catalina.connector.Request.getSession(Request.java:2316)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:910)
at com.dc.core.common.FlashRecyclingFilter.doFilterInternal(FlashRecyclingFilter.java:22)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.dc.core.common.StripJSessionIdFilter.doFilter(StripJSessionIdFilter.java:101)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) …Run Code Online (Sandbox Code Playgroud) 我的配置中有以下配置application.yml
server:
#address:
port: 8443
sessionTimeout: 30
ssl:
client-auth: need
key-store: keyStore.jks
key-store-password: 12345
key-password: datacert
protocol: TLS
trust-store: truststore.jks
trust-store-password: 12345
Run Code Online (Sandbox Code Playgroud)
因为我有client-auth: need,所以我的应用程序提示所有 URL 的证书,我是否可以绕过client auth某些特定的 URL/info或\healthURL?
我正在使用jenkins管道脚本来运行jmeter脚本,并使用性能插件来创建performanceReport,如下所示
performanceReport parsers: [[$class: 'JMeterParser', glob: "**/*.jtl"]], modeOfThreshold: true,relativeFailedThresholdNegative: 1.2, relativeFailedThresholdPositive: 1.89, relativeUnstableThresholdNegative: 1.8, relativeUnstableThresholdPositive: 1.5
Run Code Online (Sandbox Code Playgroud)
在下面的性能趋势中虽然错误增加,但构建是绿色的,所以我试图将Jenkins性能插件配置为失败作业,如果错误的百分比增加X %或响应时间X % 相对于先前的构建减少/增加.有人可以帮我吗?
我试图在我的Java EE6应用程序(类名VisualizerRepository.java)中使用jdbc连接,我在nexus存储库中有jdbc驱动程序
该类必须执行存储过程并打印过程的结果.由于JPA 2.0不支持使用jdbc调用过程.
package com.nfsmith.crm.data.repository;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import oracle.jdbc.OracleTypes;
import org.jboss.logging.Logger;
@Named
@ApplicationScoped
public class VisualizerRepository
{
DataSource datasource;
Connection connection;
CallableStatement statement;
@PostConstruct
public void initDBConnection()
{
InitialContext context;
try
{
context = new InitialContext();
datasource = (DataSource) context.lookup("java:jboss/datasources/partmatchDatasource");
connection = null;
statement = null;
connection = datasource.getConnection();
}
catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} …Run Code Online (Sandbox Code Playgroud) 我在tomcat(jdk 7)上部署我的war文件,并且看到了以下错误.我不确定导致这个问题的原因.
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1d 5 Feb 2013)
Feb 27, 2014 11:02:50 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8081"]
Feb 27, 2014 11:02:50 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
Feb 27, 2014 11:02:50 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1588 ms
Feb 27, 2014 11:02:50 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Feb 27, 2014 11:02:50 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.42
Feb 27, 2014 11:02:50 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web …Run Code Online (Sandbox Code Playgroud) 我需要在下面的Runnable Thread中访问Spring bean(featureService和uxService),但是我得到了null值,applicationContext因此我无法在Runnable中获得Spring bean.我想知道是否可以访问runnable中的spring bean?如果没有,请建议我另一种方法.
我正在使用Spring 4.0.6和Java 8
@Component
public class UserMenuUpdateTask implements Runnable, Serializable, ApplicationContextAware {
private static final long serialVersionUID = 3336518785505658027L;
List<User> userNamesList;
FeatureService featureService;
UXService uxService;
private ApplicationContext applicationContext;
public UserMegaMenuUpdateTask() {}
public UserMegaMenuUpdateTask(List<User> userNamesList) {
this.userNamesList = userNamesList;
}
@Override
public void run() {
try {
for (User user : userNamesList) {
featureService = (FeatureService) applicationContext.getBean("featureService");
uxService = (UxService) applicationContext.getBean("uxService");
//.........
}
} catch …Run Code Online (Sandbox Code Playgroud) java ×7
spring ×3
groovy ×2
spring-mvc ×2
deployment ×1
java-8 ×1
java-ee-6 ×1
javascript ×1
jdbc ×1
jenkins ×1
lambda ×1
maven ×1
session ×1
spring-boot ×1
sql ×1
tomcat ×1
xml ×1