当前位置: 首页>>代码示例>>Java>>正文


Java HttpConstraint类代码示例

本文整理汇总了Java中javax.servlet.annotation.HttpConstraint的典型用法代码示例。如果您正苦于以下问题:Java HttpConstraint类的具体用法?Java HttpConstraint怎么用?Java HttpConstraint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HttpConstraint类属于javax.servlet.annotation包,在下文中一共展示了HttpConstraint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: view

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@Secured ( false )
@RequestMapping ( value = "/channel/{channelId}/view", method = RequestMethod.GET )
@HttpConstraint ( PERMIT )
public ModelAndView view ( @PathVariable ( "channelId" ) final String channelId, final HttpServletRequest request, final HttpServletResponse response ) throws ServletException, IOException
{
    final Optional<ChannelInformation> channel = this.channelService.getState ( By.name ( channelId ) );
    if ( channel.isPresent () )
    {
        return new ModelAndView ( String.format ( "redirect:/channel/%s/view", channel.get ().getId () ) );
    }
    else
    {
        request.getRequestDispatcher ( "tree" ).forward ( request, response );
        return null;
    }
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:17,代码来源:ChannelController.java

示例2: viewValidation

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@Secured ( false )
@RequestMapping ( value = "/channel/{channelId}/validation", method = RequestMethod.GET )
@HttpConstraint ( PERMIT )
public ModelAndView viewValidation ( @PathVariable ( "channelId" ) final String channelId )
{
    try
    {
        return this.channelService.accessCall ( By.id ( channelId ), ReadableChannel.class, channel -> {
            final ModelAndView result = new ModelAndView ( "channel/validation" );

            result.put ( "channel", channel.getInformation () );
            result.put ( "messages", channel.getInformation ().getState ().getValidationMessages () );
            result.put ( "aspects", Activator.getAspects ().getAspectInformations () );

            return result;
        } );
    }
    catch ( final ChannelNotFoundException e )
    {
        return CommonController.createNotFound ( "channel", channelId );
    }
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:23,代码来源:ChannelController.java

示例3: details

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@Secured ( false )
@RequestMapping ( value = "/channel/{channelId}/details", method = RequestMethod.GET )
@HttpConstraint ( PERMIT )
public ModelAndView details ( @PathVariable ( "channelId" ) final String channelId )
{
    final ModelAndView result = new ModelAndView ( "channel/details" );

    try
    {
        this.channelService.accessRun ( By.id ( channelId ), ReadableChannel.class, ( channel ) -> {
            result.put ( "channel", channel.getInformation () );
        } );
    }
    catch ( final ChannelNotFoundException e )
    {
        return CommonController.createNotFound ( "channel", channelId );
    }

    return result;
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:21,代码来源:ChannelController.java

示例4: helpP2

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@RequestMapping ( "/channel/{channelId}/help/p2" )
@Secured ( false )
@HttpConstraint ( PERMIT )
public ModelAndView helpP2 ( @PathVariable ( "channelId" ) final String channelId )
{
    return withChannel ( channelId, ReadableChannel.class, channel -> {
        final Map<String, Object> model = new HashMap<> ();

        model.put ( "channel", channel.getInformation () );
        model.put ( "sitePrefix", this.sitePrefix.getSitePrefix () );

        model.put ( "p2Active", channel.hasAspect ( "p2.repo" ) );

        return new ModelAndView ( "channel/help/p2", model );
    } );
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:17,代码来源:ChannelController.java

示例5: viewCacheEntry

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@RequestMapping ( value = "/channel/{channelId}/viewCacheEntry", method = RequestMethod.GET )
@HttpConstraint ( rolesAllowed = { "MANAGER", "ADMIN" } )
public ModelAndView viewCacheEntry ( @PathVariable ( "channelId" ) final String channelId, @RequestParameter ( "namespace" ) final String namespace, @RequestParameter ( "key" ) final String key, final HttpServletResponse response )
{
    return withChannel ( channelId, ReadableChannel.class, channel -> {

        if ( !channel.streamCacheEntry ( new MetaKey ( namespace, key ), entry -> {
            logger.trace ( "Length: {}, Mime: {}", entry.getSize (), entry.getMimeType () );

            response.setContentLengthLong ( entry.getSize () );
            response.setContentType ( entry.getMimeType () );
            response.setHeader ( "Content-Disposition", String.format ( "inline; filename=%s", URLEncoder.encode ( entry.getName (), "UTF-8" ) ) );
            // response.setHeader ( "Content-Disposition", String.format ( "attachment; filename=%s", entry.getName () ) );
            ByteStreams.copy ( entry.getStream (), response.getOutputStream () );
        } ) )
        {
            return CommonController.createNotFound ( "channel cache entry", String.format ( "%s:%s", namespace, key ) );
        }

        return null;
    } );
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:23,代码来源:ChannelController.java

示例6: exportAllFsPost

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@HttpConstraint ( rolesAllowed = "ADMIN" )
@RequestMapping ( value = "/system/storage/exportAllFs", method = RequestMethod.POST )
public ModelAndView exportAllFsPost ( @Valid @FormData ( "command" ) final ExportAllFileSystemCommand command, final BindingResult result)
{
    if ( result.hasErrors () )
    {
        return new ModelAndView ( "exportAllFs" );
    }

    File location;
    try
    {
        location = performExport ( command );
    }
    catch ( final IOException e )
    {
        return CommonController.createError ( "Spool out", null, e, true );
    }

    final String bytes = Strings.bytes ( location.length () );

    return CommonController.createSuccess ( "Spool out", "to file system", String.format ( "<strong>Complete!</strong> Successfully spooled out all channels to <code>%s</code> (%s)", location, bytes ) );
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:24,代码来源:StorageController.java

示例7: info

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@RequestMapping ( value = "/{channelId}/info" )
@Secured ( false )
@HttpConstraint ( PERMIT )
public ModelAndView info ( @PathVariable ( "channelId" ) final String channelId) throws Exception
{
    return Channels.withChannel ( this.service, channelId, ReadableChannel.class, channel -> {
        final Map<String, Object> model = new HashMap<> ();

        final Map<MetaKey, String> metaData = channel.getMetaData ();

        final P2MetaDataInformation channelInfo = new P2MetaDataInformation ();
        MetaKeys.bind ( channelInfo, metaData );

        model.put ( "channel", channel.getInformation () );
        model.put ( "channelInfo", channelInfo );

        return new ModelAndView ( "p2info", model );
    } );

}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:21,代码来源:P2MetaDataController.java

示例8: info

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@RequestMapping ( value = "/{channelId}/info" )
@Secured ( false )
@HttpConstraint ( PERMIT )
public ModelAndView info ( @PathVariable ( "channelId" ) final String channelId) throws Exception
{
    return Channels.withChannel ( this.service, channelId, ReadableChannel.class, channel -> {

        final Map<String, Object> model = new HashMap<> ();

        final Map<MetaKey, String> metaData = channel.getMetaData ();

        final P2ChannelInformation channelInfo = new P2ChannelInformation ();
        MetaKeys.bind ( channelInfo, metaData );

        model.put ( "channel", channel.getInformation () );
        model.put ( "channelInfo", channelInfo );

        return new ModelAndView ( "p2info", model );
    } );
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:21,代码来源:P2RepoController.java

示例9: isCallAllowed

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
public static boolean isCallAllowed ( final ControllerMethod m, final HttpServletRequest request )
{
    HttpConstraint constraint = m.getMethod ().getAnnotation ( HttpConstraint.class );

    if ( constraint == null )
    {
        constraint = m.getControllerClazz ().getAnnotation ( HttpConstraint.class );
    }

    if ( constraint == null )
    {
        return true;
    }

    return HttpContraintControllerInterceptor.isAllowed ( constraint, request );
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:17,代码来源:HttpConstraints.java

示例10: viewUser

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@RequestMapping ( value = "/{userId}/view", method = RequestMethod.GET )
@HttpConstraint ( value = EmptyRoleSemantic.PERMIT )
public ModelAndView viewUser ( @PathVariable ( "userId" ) final String userId, final HttpServletRequest request )
{
    final boolean you = isYou ( userId, request );

    if ( !you && !request.isUserInRole ( "ADMIN" ) )
    {
        return CommonController.createAccessDenied ();
    }

    final DatabaseUserInformation user = this.storage.getUserDetails ( userId );

    if ( user == null || user.getDetails ( DatabaseDetails.class ) == null )
    {
        return CommonController.createNotFound ( "user", userId );
    }

    final ModelAndView model = new ModelAndView ( "user/view" );
    model.put ( "user", user );
    model.put ( "you", you );
    return model;
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:24,代码来源:UserController.java

示例11: view

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@Secured ( false )
@RequestMapping ( value = "/channel/{channelId}/view", method = RequestMethod.GET )
@HttpConstraint ( PERMIT )
public ModelAndView view ( @PathVariable ( "channelId" ) final String channelId, final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException
{
    final Optional<ChannelInformation> channel = this.channelService.getState ( By.name ( channelId ) );
    if ( channel.isPresent () )
    {
        return new ModelAndView ( String.format ( "redirect:/channel/%s/view", channel.get ().getId () ) );
    }
    else
    {
        request.getRequestDispatcher ( "tree" ).forward ( request, response );
        return null;
    }
}
 
开发者ID:ctron,项目名称:package-drone,代码行数:17,代码来源:ChannelController.java

示例12: viewValidation

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@Secured ( false )
@RequestMapping ( value = "/channel/{channelId}/validation", method = RequestMethod.GET )
@HttpConstraint ( PERMIT )
public ModelAndView viewValidation ( @PathVariable ( "channelId" ) final String channelId)
{
    try
    {
        return this.channelService.accessCall ( By.id ( channelId ), ReadableChannel.class, channel -> {
            final ModelAndView result = new ModelAndView ( "channel/validation" );

            result.put ( "channel", channel.getInformation () );
            result.put ( "messages", channel.getInformation ().getState ().getValidationMessages () );
            result.put ( "aspects", Activator.getAspects ().getAspectInformations () );

            return result;
        } );
    }
    catch ( final ChannelNotFoundException e )
    {
        return CommonController.createNotFound ( "channel", channelId );
    }
}
 
开发者ID:ctron,项目名称:package-drone,代码行数:23,代码来源:ChannelController.java

示例13: details

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@Secured ( false )
@RequestMapping ( value = "/channel/{channelId}/details", method = RequestMethod.GET )
@HttpConstraint ( PERMIT )
public ModelAndView details ( @PathVariable ( "channelId" ) final String channelId)
{
    final ModelAndView result = new ModelAndView ( "channel/details" );

    try
    {
        this.channelService.accessRun ( By.id ( channelId ), ReadableChannel.class, ( channel ) -> {
            result.put ( "channel", channel.getInformation () );
        } );
    }
    catch ( final ChannelNotFoundException e )
    {
        return CommonController.createNotFound ( "channel", channelId );
    }

    return result;
}
 
开发者ID:ctron,项目名称:package-drone,代码行数:21,代码来源:ChannelController.java

示例14: helpP2

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@RequestMapping ( "/channel/{channelId}/help/p2" )
@Secured ( false )
@HttpConstraint ( PERMIT )
public ModelAndView helpP2 ( @PathVariable ( "channelId" ) final String channelId)
{
    return withChannel ( channelId, ReadableChannel.class, channel -> {
        final Map<String, Object> model = new HashMap<> ();

        model.put ( "channel", channel.getInformation () );
        model.put ( "sitePrefix", this.sitePrefix.getSitePrefix () );

        model.put ( "p2Active", channel.hasAspect ( "p2.repo" ) );

        return new ModelAndView ( "channel/help/p2", model );
    } );
}
 
开发者ID:ctron,项目名称:package-drone,代码行数:17,代码来源:ChannelController.java

示例15: viewCacheEntry

import javax.servlet.annotation.HttpConstraint; //导入依赖的package包/类
@RequestMapping ( value = "/channel/{channelId}/viewCacheEntry", method = RequestMethod.GET )
@HttpConstraint ( rolesAllowed = { "MANAGER", "ADMIN" } )
public ModelAndView viewCacheEntry ( @PathVariable ( "channelId" ) final String channelId, @RequestParameter ( "namespace" ) final String namespace, @RequestParameter ( "key" ) final String key, final HttpServletResponse response)
{
    return withChannel ( channelId, ReadableChannel.class, channel -> {

        if ( !channel.streamCacheEntry ( new MetaKey ( namespace, key ), entry -> {
            logger.trace ( "Length: {}, Mime: {}", entry.getSize (), entry.getMimeType () );

            response.setContentLengthLong ( entry.getSize () );
            response.setContentType ( entry.getMimeType () );
            response.setHeader ( "Content-Disposition", String.format ( "inline; filename=%s", URLEncoder.encode ( entry.getName (), "UTF-8" ) ) );
            // response.setHeader ( "Content-Disposition", String.format ( "attachment; filename=%s", entry.getName () ) );
            ByteStreams.copy ( entry.getStream (), response.getOutputStream () );
        } ) )
        {
            return CommonController.createNotFound ( "channel cache entry", String.format ( "%s:%s", namespace, key ) );
        }

        return null;
    } );
}
 
开发者ID:ctron,项目名称:package-drone,代码行数:23,代码来源:ChannelController.java


注:本文中的javax.servlet.annotation.HttpConstraint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。