我们使用Spring SAML Security Extension在我们的应用程序中实现SAML.我们现在有以下问题:
我们的一位客户正在为其身份提供商提供包含参数的URL.元数据看起来像这样(为简洁起见,大量缩写):
<EntityDescriptor>
<IDPSSODescriptor>
<SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="https://idp.example.com/login?parameter=value"/>
</IDPSSODescriptor>
</EntityDescriptor>
Run Code Online (Sandbox Code Playgroud)
可以看出,有一个名为"parameter"的参数,其值为"value".生成的重定向URL中不存在此参数.我调试了一下,发现从绑定中SAMLProcessorImpl获取MessageEncoder(HTTPRedirectDeflateEncoder用于HTTP重定向)并委托编码消息.编码器依次在其buildRedirectURL方法中执行以下操作:
// endpointURL is https://idp.example.com/login?parameter=value here
URLBuilder urlBuilder = new URLBuilder(endpointURL);
List<Pair<String, String>> queryParams = urlBuilder.getQueryParams();
queryParams.clear(); // whoops
Run Code Online (Sandbox Code Playgroud)
因此,出于某种原因,有意无条件地剥离参数.
为什么会出现这种情况?如何以最有效的方式解决这个问题?
我有一个数组,其中包含我作为参数传递的其他数组.我request.getParameterValues()用来获取参数,但问题是只有原始数组以数组格式出现.数组中的数组正在转换为字符串.还有另一种发送和接收多维数组的方法吗?
我有一个模型,用于在服务器上创建 Web 服务端点。客户端使用相同的模型。但是,当向服务器添加新操作但客户端仍使用旧模型时,服务创建会失败,并出现如下异常(为了清楚起见,添加了换行符):
Exception in thread "main" javax.xml.ws.WebServiceException:
Method someNewMethod is exposed as WebMethod, but there is no
corresponding wsdl operation with name someNewMethod in the
wsdl:portType{http://example.com}MyService
Run Code Online (Sandbox Code Playgroud)
我理解这个问题,但是可以忽略它吗?我希望在使用 Web 服务时能够向后兼容。只要添加方法,大多数时候就应该可以正常工作。
问题出现在getPort方法中:
Service s = Service.create(
new URL("http://example.com/foo?wsdl"),
new QName("http://example.com", "MyService"));
MyService m = s.getPort(MyService.class);
Run Code Online (Sandbox Code Playgroud) 我有东西Read; 目前是File。我想从中读取一些字节,这些字节仅在运行时才知道(二进制数据结构中的长度前缀)。
所以我尝试了这个:
let mut vec = Vec::with_capacity(length);
let count = file.read(vec.as_mut_slice()).unwrap();
Run Code Online (Sandbox Code Playgroud)
但count为零,因为vec.as_mut_slice().len()也为零。
[0u8;length] 当然不起作用,因为必须在编译时知道其大小。
我想做
let mut vec = Vec::with_capacity(length);
let count = file.take(length).read_to_end(vec).unwrap();
Run Code Online (Sandbox Code Playgroud)
但是take的接收者参数是a T并且我只有&mut T(而且我不确定为什么还是需要它)。
我想我可以代替File使用BufReader和舞蹈周围fill_buf和consume这听起来够复杂了,但我还是纳闷:难道我忽略了什么?
我有一个vaadin应用程序,我正在尝试提供一些由Spring MVC提供的REST URL - 我的web.xml在下面.我只在/ info获得404s - 似乎Vaadin窃取所有网址模式.
如果我删除Vaadin,我可以访问/ info并获取该网址的内容.如何让他们一起玩得很好?
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<description>Vaadin production mode</description>
<param-name>productionMode</param-name>
<param-value>false</param-value>
</context-param>
<servlet>
<servlet-name>Vaadin Application Servlet</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<!-- replace standard applicationServlet with the ICEpush one -->
<!--<servlet-class>org.vaadin.artur.icepush.ICEPushServlet</servlet-class>-->
<init-param>
<description>Vaadin application class to start</description>
<param-name>application</param-name>
<param-value>myapp.vaadin.MyVaadinApp</param-value>
</init-param>
<init-param>
<param-name>widgetset</param-name>
<param-value>myapp.gwt.MyAppWidgetSet</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Vaadin Application Servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Vaadin Application Servlet</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>info</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>info</servlet-name>
<url-pattern>/info</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud) 我写了下面的代码.要从Java应用程序运行bat文件,我使用process.exec().但是蝙蝠可能会在某个时候挂起,所以我需要为这个过程设置一个超时.我在线程中启动一个新线程和一个新进程,我在线程中设置了一个超时,并在超时时终止该线程.但我发现超时发生时无法销毁进程.所以我很担心如何杀死这条庄园?
代码:
StreamGobbler:
import java.util.*;
import java.io.*;
class StreamGobbler extends Thread
{
InputStream is;
String type;
StreamGobbler(InputStream is, String type)
{
this.is = is;
this.type = type;
}
public void run()
{
try
{
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line=null;
while ( (line = br.readLine()) != null)
System.out.println(type + ">" + line);
} catch (IOException ioe)
{
ioe.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
主要:
public class test
{
public static void main(String args[]) throws InterruptedException
{ …Run Code Online (Sandbox Code Playgroud) 当我查看File文档时,我发现该take方法需要一个self,而不是一个&self.但是我仍然可以在借用的引用上调用该方法:
fn foo(file: &File) {
let _ = file.take(1); // why does this work?
println!("can still use the file: {:?}", file);
}
Run Code Online (Sandbox Code Playgroud)
我认为self通过所有权,但我甚至可以file在通话后使用take所以所有权显然留在里面foo.
如果我自己在带有方法的自定义结构上执行此操作,则它不起作用:
struct Foo;
impl Foo {
fn foo(self: Foo) { }
}
fn main() {
let foo = &Foo;
foo.foo(); // error: cannot move out of borrowed content
}
Run Code Online (Sandbox Code Playgroud)
这完全是预料之中的.
同样根据文档,File据我所知,没有实现任何特殊的特征.引起我注意的是Read有一种by_ref()方法,但我没有称之为一切仍然有效.
这里发生了什么?(使用rustc 1.3.0-dev)
我有来自用户的以下脚本.在perl 5.8.4和5.12.4上运行时,它打印1,但不打印在5.10.0(打印0).
perl -e ' my $a=0; my $net="<*2>ColBnk<2"; if (($net =~ s/([(<])/$1/g) != ($net =~ s/([>)])/$1/g)){$a++} print $a;'
Run Code Online (Sandbox Code Playgroud)
这是代码的问题(比较字符串变量!=而不是ne或者这可能是因为之后缺少分号$a++).我尝试通过打印($net =~ s/([(<])/$1/g)和($net =~ s/([>)])/$1/g)的值来调试它,并且两者都打印相同的值.请参考以下代码
use strict;
use warnings;
#/mu/bin/perl -e '
my $a=0;
my $net="<*2>ColBnk<2";
my $test="<*2>ColBnk<2";
$test =~ s/([(<])/$1/g;
print "\n$test" ;
$test =~ s/([>)])/$1/g;
print "\n$test" ;
if (($net =~ s/([(<])/$1/g) ne ($net =~ s/([>)])/$1/g)){$a++;}
print "\n Value of a =$a";
#'
Run Code Online (Sandbox Code Playgroud)
能不能提供任何指示.谢谢你的帮助,Ashish
我需要使用我的mac应用程序打印我的视图内容.我得到了打印选项的标准面板.但是预览我的页面设置是不合适的.
我正在使用以下代码对打印按钮执行操作
- (void)print:(id)sender {
[[NSPrintOperation printOperationWithView:staticText] runOperation];
float horizontalMargin, verticalMargin;
NSSize bounds = [printInfo imageablePageBounds].size;
NSSize size = [printInfo paperSize];
horizontalMargin = 0;
verticalMargin = 0;
[self setPrintInfo:[NSPrintInfo sharedPrintInfo]];
[printInfo setLeftMargin:horizontalMargin];
[printInfo setRightMargin:horizontalMargin];
[printInfo setTopMargin:verticalMargin];
[printInfo setBottomMargin:verticalMargin];
}
Run Code Online (Sandbox Code Playgroud)
