在我的应用程序中,我想应用一些过滤器,但我不希望所有的请求都必须转到该过滤器.这将是一个性能问题,因为我们已经有了一些其他的过滤器.
我希望我的过滤器仅适用于HTTP POST方法..有什么办法吗?
请帮我解决这个问题.
谢谢Kiran
嗨,我正在研究XSS(跨站脚本)问题.我的应用程序在oracle weblogic门户上开发.我们使用Servlet 2.5版本.
我在过滤器中添加了以下3行代码,用于设置httponly和安全cookie.它工作正常.
String sessionid = req.getSession().getId();
res.setHeader("Set-Cookie", "JSESSIONID=" + sessionid + ";HttpOnly");
res.setHeader("SET-COOKIE", "JSESSIONID=" + sessionid + "; secure");
Run Code Online (Sandbox Code Playgroud)
问题是,当我在同一个浏览器中注销并立即登录时,我能够登录,但在jsp页面上,我收到会话超时问题.我们使用weblogic相关的apis.request.getuserprinical()api返回null ..猜测它设置为null.
任何想法请分享.
如果有任何其他方式设置httponly或安全标志请帮助.
在下面的代码中,生成的 orderObj 没有合约 ID、订单号详细信息。它仅对带有连字符的字段进行反序列化。据我所知@jsonproperty应该映射。
请帮助获取我的结果 orderObj 中的所有字段。
import com.fasterxml.jackson.annotation.JsonProperty;
public class Order implements Serializable {
private static final long serialVersionUID = 6791737023394030929L;
@JsonProperty("id")
private String id;
@JsonProperty("contract-id")
private String contractId;
@JsonProperty("order-number")
private String orderNumber;
}
final ObjectMapper mapper = new ObjectMapper();
mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(mapper.getTypeFactory()));
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
Response response = orderServiceTarget.queryParam("contract-id",contractId).request().accept(MediaType.APPLICATION_JSON).headers(headersMap).get();
final String serverResponseStr = response.readEntity(String.class);
Order orderObj = objectMapper.readValue(serverResponseStr, Order.class);
Run Code Online (Sandbox Code Playgroud)
结果对象是:它缺少其他字段,
{
"id": "7FABA1724B8F15306447852233",
}
Run Code Online (Sandbox Code Playgroud)
这是服务器响应:
{
"id": "7FABA1724B8F15306447852233",
"contract-id": "42BAD9AAA5231BD",
"order-number": "ADD",
"market-segment": "COM",
}
Run Code Online (Sandbox Code Playgroud) 我正在 Jenkins 上设置一个 Spring 启动应用程序。对于单元测试,我遇到了以下错误。此错误并非特定于一个测试用例。每次我运行它都会给我不同的测试错误。我不确定出了什么问题。同一个项目在本地和其他环境(如开发、阶段)上运行良好(构建和单元测试)。有以下错误的想法吗?
00:49:42.836 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.abc.services.tokens.crypto.aws.AesGcmDynamoCryptoCipherProviderTest]
00:49:42.836 [main] INFO org.springframework.test.context.support.DefaultTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@43195e57, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@333291e3, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@479d31f3, org.springframework.test.context.support.DirtiesContextTestExecutionListener@40ef3420]
Run Code Online (Sandbox Code Playgroud)
这是测试类
@SuppressWarnings("unchecked")
public class AesGcmDynamoCryptoCipherProviderTest extends AbstractTestNGBeanMockingTests {
@MockBean
AwsCrypto awsCrypto;
@MockBean
DynamoDBProvider dynamoDBProvider;
@MockBean
MasterKeyProvider masterKeyProvider;
@MockBean
Table table;
private static Item mockCipherItem(UUID cipherId) {
Item item = mock(Item.class);
return item;
}
private static <T> CryptoResult<T, ?> mockCryptoResult(T result) {
// do something
return …
Run Code Online (Sandbox Code Playgroud) 我想在Karaf上安装两个捆绑包.对于其中一个捆绑我得到错误,当我看到捆绑:diag我收到以下消息.在日志中也同样适用.类似的bundle已经部署,它具有相同的依赖关系.第一个工作正在工作,但第二个工具包我得到低于错误.有什么想法吗?
opendaylight用户@根>束:DIAG
状态:GracePeriod Blueprint 2/10/16 6:07 PM缺少依赖项:(objectClass = org.osgi.service.http.HttpService)
2016-02-10 23:54:07.113 GMT + 00:00 [蓝图扩展器:3]错误oaabcBlueprintContainerImpl - 由于未解析的依赖关系,无法启动bundle com.xyz.videosdn.tesweb的蓝图容器[(objectClass = org.osgi. service.http.HttpService)] java.util.concurrent.TimeoutException:null at org.apache.aries.blueprint.container.BlueprintContainerImpl $ 1.run(BlueprintContainerImpl.java:336)[org.apache.aries.blueprint.core:1.4 .0] at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[org.apache.aries.blueprint.core:1.4.0]
java ×4
apache-aries ×1
apache-karaf ×1
httponly ×1
json ×1
opendaylight ×1
osgi ×1
osgi-bundle ×1
security ×1
servlets ×1
spring-boot ×1
spring-test ×1
testng ×1
xss ×1